Skip to main content

Quail

Quail (QUery Aware Inference Layer) is an open-source, extensible execution engine for AI-SQL, being developed at Full Stack Data Lab at CMU.

AI-SQL is a variant of SQL with operators that let you write logic in natural language for an LLM to evaluate on every row.

SELECT r.id
FROM reviews r
WHERE AI.IF(PROMPT('Does this review discuss the ending?\n\n{0}', r.body))

Documentation | Quickstart | QUAIL-B

Install

uv pip install quail-engine

Requires Python 3.12 and a CUDA GPU.

Example

import pyarrow as pa
import quail

reviews = pa.table({
    "id": ["r1", "r2", "r3"],
    "body": [
        "A beautiful film with outstanding performances.",
        "Terrible pacing and a nonsensical plot.",
        "The cinematography was stunning, though the story dragged.",
    ],
})

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
        FROM reviews r
        WHERE AI.IF(PROMPT(
            'Does this review mention a positive aspect of the movie?\n\n{0}',
            r.body))
    """, dialect="bq").collect()
    print(result)

Quail Server

Quail Server is an optional HTTP server that runs on the machine with the GPU. You start it once, send queries to it with endpoint, and the query keeps running after the client disconnects. submit() returns once the server has saved the record, and get_run reads that record later.

uv pip install "quail-engine[server]"
quail-server
import pyarrow as pa
import quail

reviews = pa.table({
    "id": ["r1", "r2"],
    "body": ["The ending was excellent.", "I liked the soundtrack."],
})
sql = """
    SELECT r.id
    FROM reviews r
    WHERE AI.IF(PROMPT('Does this discuss the ending? {0}', r.body))
"""
config = quail.EngineConfig(model="qwen3-4b-fp8", device="h100-sxm")

with quail.Session(
    config=config,
    endpoint="http://127.0.0.1:8642",
) as session:
    session.register(
        "reviews",
        quail.DocumentProvider.from_table(reviews, id_col="id"),
    )
    run = session.sql(sql, dialect="bq").submit()
    for status in run.watch():
        print(status.phase["message"])
    table = run.result().collect()
    print(table)

See Quail Server.

Supported operators

Quail currently supports AI-powered filters, joins, and EXISTS / NOT EXISTS. We are actively adding more operators (AI.CLASSIFY, AI.EXTRACT, AI.MAP).

We support two AI-SQL dialects: Snowflake AI_FILTER and BigQuery AI.IF, plus a Python builder API.

Supported models and GPUs

Model Device
Qwen3 4B fp8 NVIDIA H100 SXM
Qwen3 32B fp8 NVIDIA RTX PRO 6000 Blackwell Server Edition
DiffusionGemma 26B-A4B fp8 NVIDIA H100 SXM

1, 2, 4, or 8 GPUs per query. We are actively adding more models and hardware.

Development

uv run ruff check quail tests experiments tools
uv run python tools/check_long_strings.py
uv run vulture
uv run pytest -q

Contributing

See the contributing guide for how to propose and submit changes.

Release files for quail-engine 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quail-engine 0.1.0
File Size Uploaded
quail_engine-0.1.0.tar.gz 274.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for quail-engine 0.1.0
File Interpreter ABI Platform
quail_engine-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 598.6 kB

Release files / quail_engine-0.1.0.tar.gz

Download URL quail_engine-0.1.0.tar.gz
Size 274.1 kB
Tags Source
SHA-256 checksum
How to use checksums
08ca00ba1d16cc9ca3880698dbcb91b425bc7acfb78bfd910cd15dd1dac3aa88
BLAKE2b-256 checksum
How to use checksums
26482dca89846cebe66dbaf75c29ce4a1a57c1367bd94e535b0b1dc25c239d63
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":"24.04","id":"noble","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 Sep 24, 2026.

Transparency log

Release files / quail_engine-0.1.0-py3-none-any.whl

Download URL quail_engine-0.1.0-py3-none-any.whl
Size 324.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
55da25de9c7a578f3383554dfc054674df14f6f6b6afe9c64b145640ca855777
BLAKE2b-256 checksum
How to use checksums
75f54a9df8158d3f997290dcf8013af9beb475f8cf813b6190a51f99db4699d5
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":"24.04","id":"noble","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 Sep 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page