Ask natural language questions about your CSV data using AI
Project description
QueryMind
Ask natural language questions about your CSV data using AI. This package intelligently translates your questions into pandas code using Large Language Models (LLMs) and provides clear, concise answers.
Features
- 🤖 Natural language to pandas code translation
- 🔒 Safe code execution in a controlled environment
- 📊 Optional result summarization in natural language
- 🔌 Support for multiple LLM providers (OpenAI and Anthropic)
- 🛠️ Clean, maintainable, and extensible design
Installation
pip install querymind
Quick Start
from querymind import AIQuery
# Initialize with your CSV file and preferred LLM provider
ai = AIQuery(
csv_path="your_data.csv",
llm_provider="openai", # or "anthropic"
api_key="your-api-key"
)
# Ask questions in natural language
result = ai.ask("What is the average age of customers who made purchases over $100?")
print(result)
# Get raw results without summarization
raw_result = ai.ask("Show me the top 5 products by sales", summarize=False)
print(raw_result)
Supported LLM Providers
OpenAI
- Uses GPT-4 for code generation and summarization
- Requires an OpenAI API key
Anthropic
- Uses Claude 3 Opus for code generation and summarization
- Requires an Anthropic API key
Example Questions
Here are some example questions you can ask:
- "What is the average salary by department?"
- "Show me the top 10 customers by total purchase amount"
- "How many products are out of stock?"
- "What is the correlation between age and purchase amount?"
- "List all transactions from last month"
Security
The package executes generated code in a controlled environment with limited access to:
- The pandas DataFrame (
df) - The pandas library (
pd) - No access to other Python built-ins or system resources
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file querymind-0.1.0.tar.gz.
File metadata
- Download URL: querymind-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3051862f449f302a7d22bef6aff13e601265e48974785b637a52dac744437f28
|
|
| MD5 |
6d3c47d03c34702eae86ca6db2240c26
|
|
| BLAKE2b-256 |
6b11ae371c92f25357ab2e41d97d32399c9c12ece07ad16c86e54fea43e11a8e
|
File details
Details for the file querymind-0.1.0-py3-none-any.whl.
File metadata
- Download URL: querymind-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f57b8028f83547865d8089c883fb17201d4461c37253f562dd9d90a78adf95d6
|
|
| MD5 |
c4b65229bdb6629bce7322354c03e008
|
|
| BLAKE2b-256 |
f01fdb722ec07ad90085da9a63851adeaf37b0cc0146a9f47432a70703ecc482
|