Few-Shot Classification Prompt
A compact few-shot prompt for labeling text with balanced examples, an explicit label set, and an escape label.
Guidelines
- Give 2-3 examples per label, balanced across labels, covering edge cases.
- Always include an
other/unclearlabel so the model is not forced into a wrong category. - Use
temperature: 0and constrain output to the label only.
Prompt
Classify the support message into exactly one label:
billing | bug | feature_request | account_access | other
Message: "I was charged twice this month."
Label: billing
Message: "The export button does nothing on Safari."
Label: bug
Message: "Could you add dark mode?"
Label: feature_request
Message: "I can't log in after resetting my password."
Label: account_access
Message: "Do you have an office in Berlin?"
Label: other
Message: "{{message}}"
Label:Evaluate against a labeled set of at least ~100 real messages and inspect the confusion matrix before deploying.
Failure modes
- Unbalanced examples bias the model toward the most common label.
- No 'other' label forces wrong categories on unusual inputs.
- Label definitions drift from examples over time; keep them in sync.
Markdown version: /blueprints/few-shot-classifier.md
Want a deeper build of this?
Vote for an extended, fully tested version (more tools, a full workflow file). Votes decide what we build next.
Get one fully built blueprint a week
A weekly email: one blueprint with config, cost, setup time and failure modes, plus a vote on what we build next.
Related blueprints
Chain-of-Verification Fact Check Prompt
Draft an answer, generate verification questions, answer them independently, then revise, reducing factual errors.
Production Agent System Prompt Template
A sectioned system prompt template covering role, context, tools, rules, and output format for tool-using agents.
Prompt Injection Defense for Tool-Using Agents
Layered mitigations for agents that read untrusted content such as web pages, emails, and documents.