surfaceclassificationcase
Classificationscalar · returns varchar

CASE

Multi-branch semantic classification via specialist zoo NLI

Per-row — runs once for each row.

classificationnlispecialist-zootext

Arguments

nametypedescription
textVARCHAR
conditionsVARCHAR
resultsVARCHAR
default(optional)VARCHAR

About

Multi-branch semantic classification. Evaluates text against a set of natural-language conditions and returns the result for the highest-scoring condition (or a default if no condition is confident enough). Backend: specialist zoo zero-shot NLI (deberta-v3-large-zeroshot-v2.0) via /classify. Each condition is a candidate label; the gateway scores them all in a single forward pass and returns a softmax distribution across the closed condition set. Unlike an LLM pass, there are no hallucinated results and the condition set is strictly respected. Note on "in order" semantics: the original LLM version checked conditions sequentially and returned the first match. The specialist backend scores all conditions simultaneously and picks the highest. For well-specified conditions these produce the same answer; if your conditions overlap semantically, put the more specific one first — order is still used as a tiebreaker when scores are close. For LLM-style reasoning with nuanced subjective judgment, use SEMANTIC_CASE_LLM — see semantic_case_llm.cascade.yaml.

Examples

Semantic CASE classifies tech topic

SELECT
  semantic_case (
    'software bug',
    '["matches tech topic", "matches food topic"]',
    '["tech", "food"]',
    'unknown'
  )

Semantic CASE classifies food

SELECT
  semantic_case (
    'pepperoni pizza delivery',
    '["tech product", "food item"]',
    '["tech", "food"]',
    'other'
  )

Nearby rabbit holes

same domain
Climb back to The Looking Glass