Classify a user message against a runtime intent taxonomy (label + description) for NLU and chatbots, with confidence and an explicit out-of-scope fallback flag.
Classify a user message against your intent taxonomy — supplied at runtime as labels with descriptions — for chatbots, NLU pipelines, and command routers. Returns the matched intent, a confidence, and an explicit is_fallback flag when the message is out of scope for every intent you defined. Getting out-of-scope detection right is the hard part: this prompt is told an honest fallback beats a forced wrong label.
How this differs from its siblings (cross-link, don't confuse):
intent-routing routes an inbound message to one of your support queues — operational triage, bare queue names. Use it for support ops.text-classification is general single-label classification against a caller label set. Use it for arbitrary buckets.is_fallback) detection.| Entrypoint | Renders | Inputs |
|---|---|---|
system | Classifier rules + the runtime taxonomy + fallback label + embedded output schema | intents, fallback |
user | The delimited message | message |
Render system as the system message and user as the user message. Pass intents/fallback to the system render.
message (string, required) — the user message to classify; may be empty.intents (array, required) — the taxonomy: each item { label, description }. The model matches on the descriptions, so write them well.fallback (string, required) — the label to return when nothing fits (e.g. "out_of_scope").{
"reasoning": "The user is reporting a failed charge, which matches the billing intent.",
"intent": "billing_issue",
"confidence": 0.9,
"is_fallback": false
}
intent is one of your labels, or the fallback. Because the taxonomy is runtime input, parseOutput() can't enum-check it — add a one-line membership check: myLabels.includes(result.intent). The published eval asserts both intent == expected and intent in the case's label set.is_fallback is the out-of-scope signal — true for greetings, unrelated topics, gibberish, empty messages.confidence is uncalibrated; lower for short/vague messages.text-classification / intent-routing).intent == expected + membership + schema, all deterministic CEL.Part of the Text Classification collection.