{
 "schema_version": 1,
 "generated": "2026-10-24",
 "id": "fsdatalab-quail--filter-table-rows-with-llm-in-sql",
 "repo": "fsdatalab/quail",
 "repo_url": "https://github.com/fsdatalab/quail",
 "repo_slug": "fsdatalab-quail",
 "title": "Filter table rows with an LLM question in SQL",
 "page_title": "How to filter table rows with an LLM question in SQL with Quail",
 "summary": "Keep only the rows where a language model answers yes to a question about the text.",
 "who": "A data analyst with a large text table and a CUDA GPU, who needs a yes or no judgment on every row.",
 "problem": "Asking a question of every row in a text column by hand or with one-off scripts is slow and hard to repeat.",
 "outcome": "A filtered result table where each row passed an LLM yes or no check written as a SQL AI.IF condition.",
 "steps": [
  "Run `uv pip install quail-engine` to install the package (the import name is Quail).",
  "Build a table with an id column and a text column, then register it with Quail.DocumentProvider.from_table(table, id_col=\"id\").",
  "Create Quail.EngineConfig with a supported model and device, for example model=\"qwen3-4b-fp8\" and device=\"h100-sxm\".",
  "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\".",
  "Call .collect() on the result and print it to check the matching rows."
 ],
 "agent_prompt": "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.",
 "agents": [
  "any"
 ],
 "difficulty": "Intermediate",
 "time": "1 hour",
 "basis": "readme",
 "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.",
 "category": "Data and analytics",
 "tags": [
  "Data and analytics"
 ],
 "lang": "python",
 "requirements": [
  "Python 3.12",
  "An NVIDIA CUDA GPU from the supported list (for example H100 SXM)",
  "uv installed to run the pip install command",
  "A table of text rows (for example reviews with an id and a body column)"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/fsdatalab-quail/filter-table-rows-with-llm-in-sql/",
 "md": "https://dedupedai.com/use-cases/fsdatalab-quail/filter-table-rows-with-llm-in-sql/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/fsdatalab-quail--filter-table-rows-with-llm-in-sql.json",
 "api_version": "v1"
}
