When to use it
Use this template when you want a language model to sort text into categories: support tickets, feedback themes, document types, lead quality, content moderation queues or survey answers. It is a good first step before training a dedicated classifier, and for many teams it is good enough on its own. It works in chat for small batches and as a template inside an application or spreadsheet integration.
How to customize it
- [TYPE OF TEXT] sets the context. Be specific: “app store reviews in English and Spanish”.
- [LABELS AND DEFINITIONS] are the heart of the prompt. Define each label and, just as important, what it does not include.
- unclear gives the model a safe option. Without it, ambiguous texts get forced into the wrong category.
- [EXAMPLES] should be real (anonymized) texts. Include at least one tricky boundary case and keep the labels roughly balanced.
- [TEXT TO CLASSIFY] is the variable you replace for each item.
Why it works
Few-shot examples show the model the exact decision you want, which is often more effective than a longer description. This is in-context learning: the model adapts its behavior to the pattern in the prompt without retraining. Boundary examples teach the hardest distinctions, and “does not include” definitions reduce overlap between labels.
The short reason field makes errors easier to diagnose, and a fixed JSON format means you can parse results and compare them with a labeled test set. The instruction to ignore commands inside the text reduces the risk of prompt injection when classifying user-submitted content. Our few-shot prompting guide covers example selection in more depth.
Tips and variations
- Label 50-100 texts yourself and measure accuracy per label before trusting the classifier.
- Vary the order of examples; models can be biased toward the label of the last example.
- Use a low temperature or structured output mode for consistent formatting.
- Review every “unclear” result; a high rate usually means a missing or badly defined label.
- Re-test after changing models, because the same prompt can behave differently.