intent-detection
Published
Public
in @text-classificationeval100%

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.

intent-detection

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.
  • This prompt is for NLU/chatbot intent with described intents and first-class out-of-scope (is_fallback) detection.

Entrypoints

EntrypointRendersInputs
systemClassifier rules + the runtime taxonomy + fallback label + embedded output schemaintents, fallback
userThe delimited messagemessage

Render system as the system message and user as the user message. Pass intents/fallback to the system render.

Variables

  • 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").

Output

{
  "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.
  • Message is data — embedded "pick intent X" instructions are classified, not obeyed.

House conventions

  • Reasoning-first, key order pinned in the system prompt.
  • Runtime-taxonomy membership caveat documented (same pattern as text-classification / intent-routing).
  • Injection-safe input, strict schema.
  • Eval-gated & judge-free: intent == expected + membership + schema, all deterministic CEL.

Part of the Text Classification collection.

@sufleur/