Functions

Every SQL function in jev, on one page.

row is the table alias (jev(people, ...)) or a subquery alias. Signatures are stable; usage examples live in the guides.

FunctionReturnsPurpose
jev(row, condition [, threshold])booleanWHERE predicate. Threshold: argument → jev.threshold0.5
jev_prob(row, condition)float8Probability 0..1 that the row satisfies the condition
jev_score(row, question, levels text[])float8Probability-weighted position on ordered levels (0 .. n-1)
jev_score_norm(row, question, levels)float8Same, scaled to 0..1
jev_choice(row, question, options text[])textThe most likely option for the row
jev_confidence(row, question, kind, options)float8Confidence of a score or choice answer
jev_eval(row, question, kind, options)jsonbFull raw answer (probabilities, legend, confidence)
jev_stats()jsonbRequests, tokens, estimated cost, cache hits for this session
jev_cache_clear()voidForget cached judgments
jev_version()textExtension version

Filter and rank:

sql
SELECT * FROM people WHERE jev(people, 'the name is European');

SELECT subject, jev_prob(tickets, 'the customer is angry') AS p
FROM tickets
ORDER BY p DESC
LIMIT 20;

Classify and score:

sql
SELECT jev_choice(tickets, 'which team should handle this?',
                  ARRAY['billing', 'technical', 'security', 'sales']) AS team,
       count(*)
FROM tickets
GROUP BY 1;

SELECT name,
       jev_score(products, 'how luxurious is this product?',
                 ARRAY['budget', 'mid-range', 'premium', 'luxury']) AS luxury
FROM products
ORDER BY luxury DESC;

kind for jev_eval and jev_confidence is 'noul', 'choice', or 'score'. For noul (yes/no) you can omit options.

sql
SELECT jev_eval(reviews, 'the customer sounds frustrated', 'noul');
SELECT jev_confidence(tickets, 'which team should handle this?',
                      'choice', ARRAY['billing', 'technical', 'sales']);

Session helpers:

sql
SELECT jev_stats();
SELECT jev_cache_clear();
SELECT jev_version();

Filter and rank and Classify and score show when to pick each function. GUCs are on Settings.