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,
"db_type": postgress|mongodb
"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
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 querybuilder_llm-0.2.0.tar.gz.
File metadata
- Download URL: querybuilder_llm-0.2.0.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fbcb5a9fc06dc42be103b339c485f7202576e6b33b559006a58234be12b4f31
|
|
| MD5 |
5562374ebeb894147eb6c165bba921c7
|
|
| BLAKE2b-256 |
4e15ffb7b8f2b328dd06f4345d17eac0ca4967241069d658518ced28f84a2a7d
|
File details
Details for the file querybuilder_llm-0.2.0-py3-none-any.whl.
File metadata
- Download URL: querybuilder_llm-0.2.0-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
836584623bcce47dd3def015aff95bc10102fb4712a32d89b71b155368a5da41
|
|
| MD5 |
304b84590ab0a2aadb4a93a250284601
|
|
| BLAKE2b-256 |
1e95eddf5d43da829d5cbb4af1d1d63ee589e14bc77475592ce0f59b98674080
|