Metadata-Version: 2.4
Name: pyprik
Version: 0.2.1
Summary: Intelligent data matching library with LLM-powered natural language responses
Home-page: https://github.com/pruthvikmachhi/pyprik
Author: Pruthvik
Author-email: pruthvikmachhi7@gmail.com
License: MIT
Project-URL: Bug Reports, https://github.com/pruthvikmachhi/pyprik/issues
Project-URL: Source, https://github.com/pruthvikmachhi/pyprik
Project-URL: Documentation, https://github.com/pruthvikmachhi/pyprik#readme
Keywords: data matching,search,llm,ai,natural language,fastapi
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: pandas>=2.1.4
Requires-Dist: fastapi>=0.104.0
Requires-Dist: uvicorn>=0.24.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: openai>=1.0.0
Requires-Dist: google-generativeai>=0.3.0
Provides-Extra: dev
Requires-Dist: pytest>=8.2.2; extra == "dev"
Requires-Dist: twine>=5.1.1; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# pyprik

**pyprik** is an intelligent data matching library that finds the best matching items based on your requirements. The library includes Large Language Model (LLM) integration for natural language responses and conversational search capabilities.

## Features

- **Intelligent Data Matching**: Advanced algorithms for finding relevant items in datasets
- **LLM Integration**: Natural language responses for search results
- **Conversational Search**: Search using natural language queries
- **Smart Explanations**: Detailed explanations of why certain results were matched
- **REST API Server**: FastAPI server with intelligent endpoints
- **Multi-LLM Support**: Compatible with OpenAI GPT and Google Gemini models
- **Agent Architecture**: Modular design with dedicated agent components

## Installation

```bash
pip install pyprik
```

## Quick Start

### Basic Data Matching

```python
from pyprik import find_top_matching
import pandas as pd

# Your data
data = {
    'Product': ['Laptop', 'Smartphone', 'Tablet'],
    'Brand': ['Dell', 'Apple', 'Samsung'],
    'RAM': ['8GB', '4GB', '6GB'],
    'Price': [600, 999, 300]
}
products = pd.DataFrame(data)

# Find matches
requirements = {'Brand': 'Apple', 'RAM': '4GB'}
results = find_top_matching(products, requirements, top_n=2)
print(results)
```

### Agent-Based Server

```python
from pyprik.agent import serveragent

# Start server
serveragent.run_server(host="127.0.0.1", port=8000)

# Or create server instance
server = serveragent.create_server_agent()
```

### LLM-Enhanced Search

```python
from pyprik import smart_product_search, setup_default_llm

# Setup LLM (requires API key)
setup_default_llm('openai', 'gpt-3.5-turbo')

# Get natural language response
response = smart_product_search(
    dataset=products,
    requirements={'Brand': 'Apple'},
    top_n=3,
    natural_response=True
)
print(response)
```

## REST API Server

Start an intelligent search server:

```python
from pyprik.agent import serveragent
serveragent.run_server(host="127.0.0.1", port=8000)
```

### API Endpoints

- `POST /search` - Intelligent product search
- `POST /conversational-search` - Natural language search
- `POST /explain` - Explain search results
- `POST /configure-llm` - Configure LLM settings
- `POST /upload-dataset` - Upload your dataset
- `GET /dataset-info` - Get dataset information

## LLM Configuration

1. **Get an API Key**:
   - OpenAI: https://platform.openai.com/api-keys
   - Google AI Studio: https://makersuite.google.com/app/apikey

2. **Set Environment Variable**:
   ```bash
   # For OpenAI
   export OPENAI_API_KEY="your-api-key-here"
   
   # For Gemini
   export GEMINI_API_KEY="your-api-key-here"
   ```

3. **Install Optional Dependencies** (if not auto-installed):
   ```bash
   pip install openai google-generativeai fastapi uvicorn
   ```

## Core Functions

### Data Matching Functions
- `find_top_matching(dataset, requirements, top_n)` - Find best matches
- `find_matching(dataset, requirements)` - Get all matches with scores

### LLM Functions
- `smart_product_search()` - Enhanced search with LLM responses
- `conversational_search()` - Natural language search
- `explain_search_results()` - Detailed explanations
- `setup_default_llm()` - Configure LLM settings

### Server Functions
- `run_server()` - Start FastAPI server
- `create_server_agent()` - Create server instance

## Use Cases

- **E-commerce**: Find products matching specific criteria
- **Real Estate**: Search properties with natural language
- **Job Matching**: Match candidates to positions
- **Product Catalogs**: Intelligent product recommendations
- **Data Analysis**: Understand matching algorithms and results

## License

MIT License - see LICENSE.txt for details.
