cd /news/ai-tools/duckdb-extension-typed-jev-answers-aโ€ฆ ยท home โ€บ topics โ€บ ai-tools โ€บ article
[ARTICLE ยท art-135047] src=github.com โ†— pub= topic=ai-tools verified=true sentiment=โ†‘ positive

DuckDB extension: typed Jev answers as real SQL types

TypeSafe released a DuckDB extension for Jev, its model for typed answers, that lets users ask questions about every row of a table in SQL and receive a real SQL type back rather than free text. The extension exposes four functions โ€” jev_choice, jev_score, jev_noul and jev_ask โ€” whose criteria literal defines both the permitted answer set and the column type, returning ENUM, DOUBLE or STRUCT values, with invalid criteria failing at query planning rather than mid-execution. Requests are batched 16 rows at a time, identical requests are cached for the life of the process, and the extension is MIT licensed.

read3 min views1 publishedSep 20, 2026
DuckDB extension: typed Jev answers as real SQL types
Image: Michielbdejong (auto-discovered)

Ask a question about every row of a table, in SQL, and get a real SQL type back. A DuckDB extension over Jev, TypeSafe's model for typed answers instead of text.

The data you want to ask about already sits in a table or a Parquet file, and SQL is the query language everyone has. So ask the question where the data is, instead of pulling it out, wrapping an API in a script and writing the answer back.

Jev picks from a set you define instead of writing an answer you then check. The result is typed by construction, not by validation, and not generating is what makes it cheap enough to run on every row.

D CREATE SECRET (TYPE jev, API_KEY 'sk-...');

ENDPOINT and MODEL are optional. With no secret, queries fail when planned rather than part-way through.

Each function takes the row's text, then a criteria literal. The criteria is both the set of permitted answers and the column's type, so it must be constant.

Call Criteria Column
jev_choice(text, MAP{option: meaning}) what each option means ENUM of those options
jev_score(text, [worst, ..., best]) an ordered rubric DOUBLE on that scale
jev_noul(text, MAP{'true': โ€ฆ, 'false': โ€ฆ}) what yes and no mean DOUBLE , probability of yes
jev_ask(text, {name: criteria, โ€ฆ}) any mix STRUCT , one field per question

The descriptions are the only thing telling the model what an option means.

One request carries many questions, so ask them together. Each field takes its type from its criteria; choice and score carry a <name>_confidence beside them.

D WITH asked AS (
      SELECT id, jev_ask(body, {
          intent:   MAP{'refund': 'wants money back', 'bug': 'something broken',
                        'praise': 'a compliment'},
          severity: ['trivial', 'minor', 'normal', 'serious', 'critical'],
          urgent:   MAP{'true': 'needs a reply today', 'false': 'can wait'}
      }) AS a FROM tickets)
  SELECT id, a.intent, round(a.severity, 1) AS severity, round(a.urgent, 2) AS urgent
  FROM asked ORDER BY id;
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  id   โ”‚             intent              โ”‚ severity โ”‚ urgent โ”‚
โ”‚ int32 โ”‚ enum('refund', 'bug', 'praise') โ”‚  double  โ”‚ double โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚     1 โ”‚ refund                          โ”‚      1.7 โ”‚   0.52 โ”‚
โ”‚     2 โ”‚ bug                             โ”‚      3.0 โ”‚   0.49 โ”‚
โ”‚     3 โ”‚ praise                          โ”‚      0.6 โ”‚   0.46 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

An empty option map, a duplicate option, a one-level rubric, over 255 options or a non-constant criteria all fail when the query is planned, not on row 400,000.

One request per row, so treat these like a join against a paid service. Rows in a chunk go out sixteen at a time. Identical requests are cached for the life of the process. DuckDB evaluates a function once per place it appears, so without that the same call in WHERE and SELECT bills twice per row. Rate limits, server errors and dropped connections retry with backoff; anything else fails at once.

D SELECT * FROM jev_usage();
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ requests โ”‚ cache_hits โ”‚ input_tokens โ”‚ output_tokens โ”‚
โ”‚  int64   โ”‚   int64    โ”‚    int64     โ”‚     int64     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚        3 โ”‚          0 โ”‚         1163 โ”‚           208 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

SET jev_on_error = 'null' loses the row instead of the query.

MIT

โ”€โ”€ more in #ai-tools 4 stories ยท sorted by recency
โ”€โ”€ more on @duckdb 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain โ€” perfect for shipping the agent you just read about.

$git push zahid main
โ†’ Live at https://your-agent.zahid.host โœ“
Get free account โ†’ Pricing
from โ‚ฌ0/mo ยท no card required
LIVE [news/duckdb-extension-typโ€ฆ] indexed:0 read:3min 2026-09-20 ยท โ€”