FietSQL Prompt & Eval Toolkit
Utilities for building high-quality prompts and validating SQL produced by the cwolff/fietSQL text-to-SQL model (also packaged for Ollama as cowolff/fietSQL). Supply your database schema plus a natural-language question, and this package will both format the chat prompt expected by the model and sanity-check the SQL it returns by running it inside an in-memory SQLite database.
Features
- Prompt builder: creates the
<|im_start|>style prompt template used to steer the fietSQL model. - Schema-aware evaluation: applies your DDL to SQLite and runs the generated SQL to verify executability.
- Lightweight footprint: pure-Python utilities that work in notebooks, batch jobs, or services.
Installation
pip install fietSQL
Or install straight from source:
pip install git+https://github.com/trl-lab/FietSQL-Package.git
Quick start
from fietSQL import build_prompt, evaluate_executability
SCHEMA = '''
CREATE TABLE customers (
id INTEGER PRIMARY KEY,
name TEXT,
city TEXT
);
CREATE TABLE orders (
id INTEGER PRIMARY KEY,
customer_id INTEGER,
total NUMERIC
);
'''
question = "Which city has the highest total sales?"
prompt = build_prompt(SCHEMA, question)
# send `prompt` to cwolff/fietSQL via Hugging Face or Ollama
sql = '''
SELECT c.city, SUM(o.total) AS total_sales
FROM customers c
JOIN orders o ON o.customer_id = c.id
GROUP BY c.city
ORDER BY total_sales DESC
LIMIT 1;
'''
report = evaluate_executability(SCHEMA, sql)
assert report.is_executable, report.details
Related resources
- Hugging Face model card: https://huggingface.co/cwolff/fietSQL
- Pulling the Ollama build:
ollama pull cowolff/fietSQL - Issues and discussions: https://github.com/trl-lab/FietSQL-Package/issues
License
Released under the MIT License. See LICENSE for details.
Metadata
Release files for fietSQL 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fietsql-0.1.0.tar.gz | 5.8 kB | Without provenance | Details for fietsql-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fietsql-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for fietsql-0.1.0-py3-none-any.whl |
Total release size: 11.5 kB
Release files / fietsql-0.1.0.tar.gz
| Download URL | fietsql-0.1.0.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5af5651413a0bc375c69bac457b6184d43827404acd9a7f4c1cca5139aa251cc
|
|
BLAKE2b-256 checksum How to use checksums |
27d9d9430b3a13063f419e0b04d68df3d7ae9a9b80538b986ab60f9e823a0cda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.8
|
Release files / fietsql-0.1.0-py3-none-any.whl
| Download URL | fietsql-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e975ffb9fe91d2f19ddd980835eda91468867ceb570865ea0ca2efe50210274
|
|
BLAKE2b-256 checksum How to use checksums |
8d429d2aab129a7225ef38fd1d8a88ebb3a33428522cf4f5d5a91bb659b420ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.8
|
Security for fietSQL 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.