Quick start

Set a TypeSafe API key and run the first jev() query.

You need the extension loaded (Installation or Docker) and a TypeSafe API key from console.typesafe.ai.

Set the key for this session, or persist it on a role:

sql
SET jev.api_key = 'your-key';
-- ALTER ROLE analyst SET jev.api_key = 'your-key';

The PostgreSQL server process can also read TYPESAFE_API_KEY from its environment. See Settings for jev.api_key and the other GUCs.

Run a query until a row comes back:

sql
SELECT * FROM reviews
WHERE jev(reviews, 'the customer sounds frustrated');

On the first run you should see a NOTICE with request count, tokens, estimated cost, and time (jev.notices defaults to on). Re-run the same query in the same session: the session cache answers from memory.

If nothing matches, look at the probabilities before you change the wording:

sql
SELECT subject, jev_prob(reviews, 'the customer sounds frustrated') AS p
FROM reviews
ORDER BY p DESC
LIMIT 10;

Ambiguous rows sit near 0.5. Writing conditions covers how to make the question literal. Filter and rank covers thresholds.