# Quail: A fast engine for AI functions in SQL

> Source: <https://fsdatalab.github.io/quail/docs>
> Published: 2026-11-28 17:28:30+00:00

**Key takeaway:** Quail's quail-engine lets developers call AI.IF and PROMPT inside SQL SELECT statements so each row gets an AI-generated answer usable as a normal column value, but it requires Python 3.12 and a supported CUDA GPU or Modal/Quail Server.



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

| id | body | AI.IF | 
|---|---|---|
| r1 | The ending was perfect and the cast was great. | true | 
| r2 | Too long, and the ending made no sense. | true | 
| r3 | Great music, but I want my money back. | false | 

## AI functions

Each AI function returns one answer per row. SQL uses the answer like any other value.

## Install

Quail needs Python 3.12 and a supported CUDA GPU.

The package is `quail-engine`, and you import it as `quail`. With no
local GPU, run Quail on [Modal](https://fsdatalab.github.io/quail/docs/user-guide/models#no-local-gpu-use-modal)
or connect to [Quail Server](https://fsdatalab.github.io/quail/docs/user-guide/server).
