Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

querymind-0.1.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

querymind-0.1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file querymind-0.1.1.tar.gz.

File metadata

  • Download URL: querymind-0.1.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for querymind-0.1.1.tar.gz
Algorithm Hash digest
SHA256 52f4363c206370d4ef8b0de0d8a67ebc7c5a56868e3b1647bbe6e68411e6d3b9
MD5 5cab995c81a10537f74407f57c668805
BLAKE2b-256 5faf17bc220afad0231afefd215d74263e5f6bb6f26765a2a44e6bc77ff1c3a2

See more details on using hashes here.

File details

Details for the file querymind-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: querymind-0.1.1-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

Hashes for querymind-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 94054c16101b4bceca82a33ffb75347a0df8582b5822a43c517f37240cf1dc19
MD5 f8237f08cc5d8b42a44ccf2dc2755732
BLAKE2b-256 9675b469e2c65e36d99d0bc44521c95dbe25ee6144fbe00c8ffda33e4f897549

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page