Skip to main content

High-performance SDK to convert natural language prompts to MongoDB queries using AI (OpenAI GPT or Anthropic Claude)

Project description

Prompt to Query - Python SDK

High-performance Python SDK to convert natural language prompts to MongoDB queries using AI (OpenAI GPT or Anthropic Claude).

Installation

pip install prompt-to-query

Quick Start

from prompt_to_query import PromptToQuery

# Initialize the client
ptq = PromptToQuery(
    llm_provider="openai",
    api_key="your-api-key",
    db_schema_path="schema.json"
)

# Generate a MongoDB query from natural language
query = ptq.generate_query("Get all active users from last month")
print(query)
# Output: {'operation': 'find', 'collection': 'users', 'filter': {...}}

Features

  • 🚀 High Performance: Native Go library with Python bindings
  • 🔄 Cross-Platform: Supports Linux (glibc/musl), macOS (Intel/ARM), and Windows
  • 🎯 Zero External Dependencies: Uses only Python's standard library (ctypes)
  • 🤖 Multiple LLM Providers: OpenAI (GPT-4) and Anthropic (Claude)
  • 📊 Flexible Schema: JSON-based database schema definition

Supported Platforms

The package includes pre-built native libraries for:

  • Linux: x86_64 (glibc), x86_64 (musl/Alpine), ARM64 (glibc), ARM64 (musl/Alpine)
  • macOS: x86_64 (Intel), ARM64 (Apple Silicon)
  • Windows: x86_64

Documentation

For complete documentation, examples, and API reference, visit: https://github.com/dimarborda/prompt-to-query

Development

Building from Source

# Install dependencies
pip install -e .

# Build native libraries for current platform
python scripts/build-native.py

# Build for all platforms (requires Docker)
python scripts/build-native.py --all

Running Tests

pytest tests/

License

MIT License - see LICENSE file for details

Links

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

prompt_to_query-1.0.0.tar.gz (24.8 MB view details)

Uploaded Source

Built Distribution

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

prompt_to_query-1.0.0-py3-none-any.whl (24.9 MB view details)

Uploaded Python 3

File details

Details for the file prompt_to_query-1.0.0.tar.gz.

File metadata

  • Download URL: prompt_to_query-1.0.0.tar.gz
  • Upload date:
  • Size: 24.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for prompt_to_query-1.0.0.tar.gz
Algorithm Hash digest
SHA256 95a3d22ee199dccfaef9f03f5f8caad4d4ec87fe18c61e5d6d2a2568356ef9bd
MD5 9c1a8662981e803262a5ccbb5dadfead
BLAKE2b-256 81af0ac085606e05e1aed2473c1e817e2369cab15051dd6fc6617299d77d3cf3

See more details on using hashes here.

File details

Details for the file prompt_to_query-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for prompt_to_query-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 955ad78b3514d7ceb4514df4db647e042c3f64ffe9b8415d0f0acd455d7a5f3c
MD5 0dc58ae2b3a0198d255c50a0f215f5b8
BLAKE2b-256 d6fb05b2f6ccc3360e60564c7e701c20a9a3595a29b24d4dc4ecd5823a93eacd

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