Rank a group of items by a subjective multi-factor criterion
Per-group — reads the whole group in one call.
RANK_SEMANTIC({{ values }}, '{{ criteria }}'){{ values }} RANKED BY '{{ criteria }}'| name | type | description |
|---|---|---|
| values | VARCHAR | Values to rank |
| criteria | VARCHAR | Ranking criteria: 'by quality', 'by relevance to X', 'by completeness' |
Ranks answers by quality
WITH
test_data AS (
SELECT
*
FROM
(
VALUES
('Brief but vague answer'),
(
'Comprehensive detailed response with examples and citations'
),
('OK response')
) AS t (answer)
)
SELECT
RANK_SEMANTIC (answer, 'by quality and completeness')
FROM
test_dataReturns 0.0-1.0 relevance score for text vs criterion (cross-encoder)
LLM-backed 0.0-1.0 relevance score (escape hatch for ABOUT/RELEVANCE TO)
Pick the single best value from a group by a plain-English quality criterion
Find unusual or atypical items via embeddings (+ optional criteria)
LLM-backed outlier detection (escape hatch for OUTLIERS)
PageRank centrality on an ad-hoc edge list (NetworkX)
Rank a group of items by a subjective multi-factor criterion
Per-group — reads the whole group in one call.
RANK_SEMANTIC({{ values }}, '{{ criteria }}'){{ values }} RANKED BY '{{ criteria }}'| name | type | description |
|---|---|---|
| values | VARCHAR | Values to rank |
| criteria | VARCHAR | Ranking criteria: 'by quality', 'by relevance to X', 'by completeness' |
Ranks answers by quality
WITH
test_data AS (
SELECT
*
FROM
(
VALUES
('Brief but vague answer'),
(
'Comprehensive detailed response with examples and citations'
),
('OK response')
) AS t (answer)
)
SELECT
RANK_SEMANTIC (answer, 'by quality and completeness')
FROM
test_dataReturns 0.0-1.0 relevance score for text vs criterion (cross-encoder)
LLM-backed 0.0-1.0 relevance score (escape hatch for ABOUT/RELEVANCE TO)
Pick the single best value from a group by a plain-English quality criterion
Find unusual or atypical items via embeddings (+ optional criteria)
LLM-backed outlier detection (escape hatch for OUTLIERS)
PageRank centrality on an ad-hoc edge list (NetworkX)