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.
| Function | Returns | Purpose |
|---|---|---|
jev(row, condition [, threshold]) | boolean | WHERE predicate. Threshold: argument → jev.threshold → 0.5 |
jev_prob(row, condition) | float8 | Probability 0..1 that the row satisfies the condition |
jev_score(row, question, levels text[]) | float8 | Probability-weighted position on ordered levels (0 .. n-1) |
jev_score_norm(row, question, levels) | float8 | Same, scaled to 0..1 |
jev_choice(row, question, options text[]) | text | The most likely option for the row |
jev_confidence(row, question, kind, options) | float8 | Confidence of a score or choice answer |
jev_eval(row, question, kind, options) | jsonb | Full raw answer (probabilities, legend, confidence) |
jev_stats() | jsonb | Requests, tokens, estimated cost, cache hits for this session |
jev_cache_clear() | void | Forget cached judgments |
jev_version() | text | Extension 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.