vgi-typesafe · a VGI worker by Query.Farm
TypeSafe System One questions — choice,
noul and score — as DuckDB table functions you can LATERAL join against.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
ATTACH 'typesafe' AS typesafe (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-typesafe'
);
-- The result columns are built from the `questions` argument at bind time —
-- one typed STRUCT per question, then `usage`. DESCRIBE only binds, so this
-- runs without an API key and issues no request.
DESCRIBE SELECT *
FROM typesafe.main.ask(
'a lost package',
questions => {'dept': {'type': 'choice',
'instructions': 'Which team?',
'criteria': {'shipping': 'Delays and lost packages',
'billing': 'Invoices'}},
'urgent': {'type': 'noul',
'instructions': 'Does this need a reply today?'}}
);
-- Route, flag and grade every row in one request each
SELECT t.id, a.dept.choice, a.urgent.noul
FROM (VALUES (1, 'My package is lost')) t(id, body),
LATERAL typesafe.main.ask(
t.body,
questions => {'dept': {'type': 'choice',
'instructions': 'Which team?',
'criteria': {'shipping': 'Lost packages',
'billing': 'Invoices'}},
'urgent': {'type': 'noul',
'instructions': 'Needs a reply today?'}}
) a;
-- Classify one text column with the single-question shorthand
SELECT choice, confidence
FROM typesafe.main.choice(
'I was charged twice',
instructions => 'Which team should handle this?',
criteria => MAP {'shipping': 'Lost packages',
'billing': 'Invoices'}
);- Orchard: vgi-typesafe: every function and table, with examples you can run, and setup for each way to run the worker (release binary, signed Docker image, or your own server).
- Catalog reference: the full list of functions and tables with their arguments and columns.
- Executed notebooks: worked analyses using the published worker.
- What is VGI?: the protocol that connects workers like this one to DuckDB.
make check # everything CI runs: lint, unit tests, SQL tests, metadata lintMIT, see LICENSE. Written by Query.Farm.
Copyright 2026 Query Farm LLC - https://query.farm
