surfaceclassificationclassify_llm
Classificationscalar · returns varchar

CLASSIFY_LLM

LLM-backed single-text classification (escape hatch for CLASSIFY_SINGLE)

Per-row — runs once for each row.

classificationllmllm-escape-hatchjson

Syntax

CLASSIFY_SINGLE_LLM({{ text }}, '{{ topics }}')
semantic_classify_llm({{ text }}, '{{ topics }}')

Arguments

nametypedescription
textVARCHAR
topicsJSON

About

LLM-backed escape hatch for single-text classification. Use when the canonical zero-shot NLI path (CLASSIFY_SINGLE) is insufficient because the classification requires world knowledge, nuanced criteria, or subjective judgment a closed-label NLI model will miss. Examples where CLASSIFY_SINGLE_LLM wins over CLASSIFY_SINGLE: - Fine-grained sentiment ("sarcastic praise" vs "genuine praise") - Policy-based routing ("VIP customer" vs "standard customer") - Domain-specific taxonomies needing common sense - Label sets where the hypothesis template feels unnatural For routine classification into a closed set of topics, prefer CLASSIFY_SINGLE — it is 100-1000x faster and handles most use cases.

Examples

LLM escape hatch: positive sentiment

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

LLM escape hatch: negative sentiment

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

Nearby rabbit holes

same domain
Climb back to The Looking Glass