surfaceclassificationclassify
Classificationscalar · returns varchar

CLASSIFY

Classify single text into one of the provided topics (zero-shot NLI)

Per-row — runs once for each row.

classificationnlispecialist-zoojson

Syntax

CLASSIFY_SINGLE({{ text }}, '{{ topics }}')

Arguments

nametypedescription
textVARCHAR
topicsJSON

About

Classify a single text into one of the provided topics. Used per-row by CLASSIFY_SINGLE() and as a helper by GROUP BY TOPICS to classify individual rows after topics have been extracted from the collection. Backend: specialist zoo zero-shot NLI (deberta-v3-large-zeroshot-v2.0) via /classify. Fans out one NLI pair per candidate label using a hypothesis template, softmaxes entailment scores across candidates, returns the top label. Labels are a closed set — the model can only pick from the provided topics, no hallucinated categories. For LLM-style classification with nuanced criteria or subjective judgment, use CLASSIFY_SINGLE_LLM — see classify_single_llm.cascade.yaml.

Examples

Function: Positive sentiment classified

SELECT
  semantic_classify (
    'I love this product!',
    'positive,negative,neutral'
  )

Function: Negative sentiment classified

SELECT
  semantic_classify (
    'This is terrible, worst purchase ever',
    'positive,negative,neutral'
  )

Function: Neutral statement classified

SELECT
  semantic_classify (
    'The item arrived on time',
    'positive,negative,neutral'
  )

Function: Support request classified

SELECT
  semantic_classify (
    'Need help with my broken laptop',
    'sales,support,billing,general'
  )

Function: Upgrade request (sales, billing, or support)

SELECT
  semantic_classify (
    'I want to upgrade my subscription',
    'sales,support,billing,general'
  )

Alias classify(): Business news classified

SELECT
  classify (
    'Stock market reaches all-time high',
    'sports,politics,business,technology'
  )

Nearby rabbit holes

same domain
Climb back to The Looking Glass