Quail
A fast engine for AI functions in SQL
from the Full Stack Data Lab at CMU
Quail runs SQL with AI functions. An AI function, such as
AI.IF, sends a row's text to a model and returns the model's answer.
Quail is an Apache DataFusion extension:
we use DataFusion to parse, plan, and run the rest of the SQL.
Documentation | Quickstart | QUAIL-B
Install
Quail needs Python 3.12 and a supported CUDA GPU.
uv pip install quail-engine
The package is quail-engine, and you import it as quail.
Install from source
to run the code on main, which can be ahead of the last release.
Example
The query below keeps the reviews that discuss the ending, and labels each one as praise or a complaint. It runs Qwen3 4B on one H100:
import pyarrow as pa
import quail
reviews = pa.table({
"id": ["r1", "r2", "r3"],
"body": [
"The ending was perfect and the cast was great.",
"Too long, and the ending made no sense.",
"Great music, but I want my money back.",
],
})
config = quail.EngineConfig(model="qwen3-4b-fp8", device="h100-sxm")
with quail.Session(config=config) as session:
session.register("reviews", quail.DocumentProvider.from_table(reviews, id_col="id"))
result = session.sql("""
SELECT r.id, AI.CLASSIFY(r.body, ['praise', 'complaint']) AS kind
FROM reviews r
WHERE AI.IF(PROMPT('Does the review discuss the ending? {0}', r.body))
""").collect()
print(result)
AI.IF keeps a review when the model answers yes, and AI.CLASSIFY
returns one of the two labels. Quail reads each review once for both
functions, and classifies only the reviews that AI.IF keeps.
AI functions
| Function | Returns |
|---|---|
AI.IF |
TRUE when the model answers yes; use it in a filter or a join |
AI.SCORE |
A number from 0 to 1; a higher number is a stronger yes |
AI.CLASSIFY |
The one label the model chooses from your list |
AI.EXTRACT |
Each question's answer, as text copied from the document |
AI.EXTRACT_SPAN |
The position of each AI.EXTRACT answer in the document |
AI.MAP |
Open-ended text: the model's answer to your instruction, up to a token limit |
AI.SAE_FEATURES |
The model's strongest internal features for the prompt |
The SQL reference describes each function. The model decides which functions you can use; Supported models and GPUs lists the models and the GPU each one needs.
Quail Server
Quail Server
runs your queries on a remote GPU. Start quail-server on the GPU
machine, and pass its address as endpoint when you create the session.
The server keeps a submitted query running after the client disconnects.
Rust
A Rust program adds the quail-engine crate and calls quail::Session.
A program with its own DataFusion session adds Quail's AI functions to
the session.
Use Quail from Rust
shows both.
Contributing
Report a bug on GitHub. Follow the developer guide to contribute to Quail; the guide says how to build from source and which checks to run.
Metadata
Release files for quail-engine 0.2.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 |
|---|---|---|---|---|
| quail_engine-0.2.0.tar.gz | 947.3 kB | With provenance | Details for quail_engine-0.2.0.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| quail_engine-0.2.0-cp312-abi3-manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ x86-64 | Details for quail_engine-0.2.0-cp312-abi3-manylinux_2_28_x86_64.whl |
| quail_engine-0.2.0-cp312-abi3-manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ ARM64 | Details for quail_engine-0.2.0-cp312-abi3-manylinux_2_28_aarch64.whl |
| quail_engine-0.2.0-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details for quail_engine-0.2.0-cp312-abi3-macosx_11_0_arm64.whl |
Total release size: 208.0 MB
Release files / quail_engine-0.2.0.tar.gz
| Download URL | quail_engine-0.2.0.tar.gz |
|---|---|
| Size | 947.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
92c2edac4e1e98aa94dd4fcbbd338f3ae28c45f94fbbfb66a4bb91256d49faba
|
|
BLAKE2b-256 checksum How to use checksums |
1d25cd974c395d42a866bc2457764585672ff4da154673724df03ba470f0e1b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / quail_engine-0.2.0-cp312-abi3-manylinux_2_28_x86_64.whl
| Download URL | quail_engine-0.2.0-cp312-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 70.5 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
025ab3c8470be083fa3eddd0eb08b415a26d66e71139c4a9616615bf3a92d128
|
|
BLAKE2b-256 checksum How to use checksums |
ab4e85b511f7617c8b0cd972a5b7b5611230b0e5d82e3256623b7782828ca58f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / quail_engine-0.2.0-cp312-abi3-manylinux_2_28_aarch64.whl
| Download URL | quail_engine-0.2.0-cp312-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 73.0 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8498759875bef6602e0528d048eabfe785b2e3a51859d7eb78f127c19eeab43a
|
|
BLAKE2b-256 checksum How to use checksums |
5916a2747623f7680f10298299e63c471b8cfd45fb0fc698975966168378d02f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / quail_engine-0.2.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | quail_engine-0.2.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 63.6 MB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
dec3b000fec6db7f178675781632b2f5e6702fecc507f5bce408abf53ed6e609
|
|
BLAKE2b-256 checksum How to use checksums |
923e1c7c34561928b0dd4452256aec4c8ed28f0e904e7435db155710ae75f6b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logSecurity for quail-engine 0.2.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.
Full provenance
All 4 files in this release have been uploaded with provenance metadata.
Attestation for quail_engine-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logA 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.