# AI use cases for Quail (fsdatalab/quail)

Repo: [fsdatalab/quail](https://github.com/fsdatalab/quail) | Use cases: 4 | Page: https://dedupedai.com/use-cases/fsdatalab-quail/

Quail is an open-source inference engine that runs LLM-powered AI functions over large datasets from SQL on your own GPUs.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Filter table rows with an LLM question in SQL: https://dedupedai.com/use-cases/fsdatalab-quail/filter-table-rows-with-llm-in-sql/
- Extract answers from a text column with AI.EXTRACT: https://dedupedai.com/use-cases/fsdatalab-quail/extract-answers-from-text-column/
- Run a long LLM query on a GPU server and reconnect later: https://dedupedai.com/use-cases/fsdatalab-quail/run-long-llm-job-on-gpu-server/
- Run Snowflake AI_FILTER style queries on your own GPU: https://dedupedai.com/use-cases/fsdatalab-quail/port-snowflake-ai-filter-queries/

## How to filter table rows with an LLM question in SQL with Quail

Repo: [fsdatalab/quail](https://github.com/fsdatalab/quail) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Keep only the rows where a language model answers yes to a question about the text.

**Who it is for:** A data analyst with a large text table and a CUDA GPU, who needs a yes or no judgment on every row.

**The problem:** Asking a question of every row in a text column by hand or with one-off scripts is slow and hard to repeat.

**The outcome:** A filtered result table where each row passed an LLM yes or no check written as a SQL AI.IF condition.

### Steps

1. Run `uv pip install quail-engine` to install the package (the import name is Quail).
2. Build a table with an id column and a text column, then register it with Quail.DocumentProvider.from_table(table, id_col="id").
3. Create Quail.EngineConfig with a supported model and device, for example model="qwen3-4b-fp8" and device="h100-sxm".
4. Open a Quail.Session, then run session.sql with a WHERE AI.IF(PROMPT('Your question\n\n{0}', r.body)) clause and dialect="bq".
5. Call .collect() on the result and print it to check the matching rows.

### Prompt to paste into your agent

```text
Use the Python package quail-engine (import quail) in the repo fsdatalab/quail to filter the table <table_name> with a BigQuery-style AI.IF question about column <text_column>. Return the matching id values as a table. Verify that the number of returned rows is less than or equal to the input row count.
```

### Caveat

Quail needs Python 3.12 and a CUDA GPU from its supported model and device list, so it will not run on a CPU-only laptop.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/fsdatalab-quail/filter-table-rows-with-llm-in-sql/

## How to extract answers from a text column with AI.EXTRACT with Quail

Repo: [fsdatalab/quail](https://github.com/fsdatalab/quail) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Pull a short answer to a question out of each row's text in one SQL query.

**Who it is for:** An analyst who needs a specific detail, such as the actor a reviewer names, pulled from many free-text rows.

**The problem:** Reading each text row to find one fact does not scale, and regular expressions miss varied wording.

**The outcome:** A table with one extracted answer per row, produced by a single SQL query run on your GPU.

### Steps

1. Run `uv pip install quail-engine` to install the package.
2. Register your text table with Quail.DocumentProvider.from_table(table, id_col="id") inside a Quail.Session.
3. In the SQL, select AI.EXTRACT(r.body, {'field': 'Your question about the text?'}) AS answer from the table.
4. Run the query with session.sql(sql, dialect="bq").collect() and print the result.

### Prompt to paste into your agent

```text
Use the Python package quail-engine (import quail) from the repo fsdatalab/quail to run AI.EXTRACT over the text column <text_column> of the table <table_name> with the question <question>. Output a table of id and extracted answer. Verify that every id in the input appears in the output.
```

### Caveat

The README shows AI.EXTRACT in an example but does not describe how empty or unclear answers are returned, so check outputs on a few rows first.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/fsdatalab-quail/extract-answers-from-text-column/

## How to run a long LLM query on a GPU server and reconnect later with Quail

Repo: [fsdatalab/quail](https://github.com/fsdatalab/quail) | Difficulty: Advanced | Time: 1 hour 15 minutes | Basis: From the README

Submit a query to a Quail Server on your GPU machine, disconnect, and fetch results later.

**Who it is for:** A team member with a GPU machine who runs big jobs that take longer than a laptop session should stay connected.

**The problem:** A long-running LLM job can fail or be lost if the client disconnects while it runs.

**The outcome:** A saved query on the server that you can watch, reconnect to by query id, and collect results from when it finishes.

### Steps

1. On the GPU machine, run `uv pip install "quail-engine[server]"` to install the server extra.
2. Start the HTTP server by running `quail-server`.
3. From the client, open Quail.Session with endpoint set to the server address, then call session.sql(sql, dialect="bq").submit().
4. Call run.watch() to print progress, or note the query id and later call get_run(query_id) to reconnect.
5. Call run.result().collect() to get the table once the run is done.

### Prompt to paste into your agent

```text
Use the repo fsdatalab/quail to submit the SQL query in <sql_file> to a Quail Server at <server_address>, save the query id, and later call get_run to fetch the result table. Output the final table as CSV. Verify that the server returned a completed status before collecting results.
```

### Caveat

The server runs on the machine that has the GPU, so you need network access to that machine and the README does not describe authentication for the endpoint.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/fsdatalab-quail/run-long-llm-job-on-gpu-server/

## How to run Snowflake AI_FILTER style queries on your own GPU with Quail

Repo: [fsdatalab/quail](https://github.com/fsdatalab/quail) | Difficulty: Advanced | Time: 1 hour | Basis: From the README

Reuse Snowflake-style AI_FILTER SQL with Quail's dialect support on local GPUs.

**Who it is for:** A data engineer with existing Snowflake AI_FILTER queries who wants to run the same logic on their own GPU hardware.

**The problem:** Existing AI SQL written for one warehouse dialect cannot run on a GPU-based engine without changes.

**The outcome:** The same filter logic executed through Quail by setting the Snowflake dialect in session.sql.

### Steps

1. Run `uv pip install quail-engine` to install the package.
2. Register the source table with Quail.DocumentProvider.from_table(table, id_col="id").
3. Copy your AI_FILTER query into a string and pass it to session.sql with the Snowflake dialect setting, using the dialect value your code expects.
4. Call .collect() and compare the output with your Snowflake result on a small sample.
5. If the dialect value is not accepted, switch to the BigQuery AI.IF form shown in the README. (inferred, check the README)

### Prompt to paste into your agent

```text
Use the Python package quail-engine (import quail) from the repo fsdatalab/quail to run the Snowflake-style AI_FILTER query in <query_file> against the table <table_name>. Output the filtered rows. Verify that the output matches the Snowflake result for a sample of 10 rows.
```

### Caveat

The README lists both dialects but does not show the exact dialect value string for Snowflake, so confirm it in the documentation before relying on it.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/fsdatalab-quail/port-snowflake-ai-filter-queries/
