Skip to main content

A pip package to generate SQL/Mongo queries from natural language using an LLM API

Project description

querybuilder-llm

A simple pip package that lets you generate SQL or MongoDB queries from natural language using your deployed LLM API.
Schema is passed in, and the LLM figures out the correct query.
All responses are wrapped with a success flag for safety.


Installation

pip install querybuilder-llm

Usage

from querybuilder_llm.client import build_query

# Example schema
schema = {
    "users": ["id", "name", "email", "age"]
}

result = build_query(schema, "Find all gmail users", "postgresql")

if result["success"]:
    print("SQL Query:", result["response"])
else:
    print("Error:", result["error"])

# --- Mongo Example ---
result = build_query(schema, "Find users older than 30", "mongodb")

if result["success"]:
    print("Mongo Query:", result["response"])
else:
    print("Error:", result["error"])

Response Format

{
  "success": True/False,
  "response": str | dict | None,
  "error": str | None
}

success: Whether query generation was successful

response: SQL string or MongoDB JSON dict (if success)

error: Error details if failed

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

querybuilder_llm-0.0.1.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

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

querybuilder_llm-0.0.1-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file querybuilder_llm-0.0.1.tar.gz.

File metadata

  • Download URL: querybuilder_llm-0.0.1.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for querybuilder_llm-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a75d627fd18e2b3e8a6979861a8a5dd623afd76dbf127d9f408ffa7f8bb078e7
MD5 23ab885fecfca4858eb29044c65ba4bc
BLAKE2b-256 bca6714ac477d3ebf7736194d59b8c4702b8dc96678fba69f149673d6f3c6eb2

See more details on using hashes here.

File details

Details for the file querybuilder_llm-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for querybuilder_llm-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe616f9954754937b5a5a8d90463401703778bfc623f8bda339070f98a4b7561
MD5 6382d8a9c45de28b20a48e99a5c78479
BLAKE2b-256 50041df323bcc8ed8640afccc80513b1b9653d9a934d228ec20b2f57bc9b60ed

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