Build a few-shot classifier prompt with labels and an evaluation plan
Design a prompt that sorts texts (tickets, reviews, emails) into your labels, with clear definitions, balanced examples, structured output and a plan to measure its accuracy. Designed for ChatGPT, Claude, Gemini and Microsoft Copilot. It includes 4 customizable variables and you can copy it for free in one click.
Intermediate · Text · Pending editorial review
Prompt
Act as an NLP practitioner who designs classification prompts for production use.
Context:
- Texts to classify: {{text_type}}
- Labels I want to use: {{labels}}
- Labeled examples I already have: {{examples}}
- Desired output format: {{format}}
Deliverables:
1. Definition of each label: what it includes, what it excludes and one typical signal. Flag labels that overlap and propose how to separate or merge them.
2. Tie-break rules for ambiguous or multi-topic texts, plus an "other / unclear" label with a clear rule for when to use it.
3. Few-shot example selection: 2 per label, balanced, including at least one hard negative (a text that looks like one label but belongs to another). If my examples are not enough, propose new ones marked [SYNTHETIC: review].
4. Final classifier prompt in a code block: instructions, definitions, delimited examples and output in {{format}} with label, confidence (low/medium/high) and a one-sentence reason.
5. Evaluation plan: how to build a test set of at least 50 real texts that are not among the examples, which metrics to check (per-label precision and recall, confusion matrix) and how to iterate on the errors.
Constraints:
- Do not invent what a label means: if one is ambiguous, ask me first.
- The final prompt must return exactly one label from the list, never a new one.
- If it will run through an API, recommend a low temperature and validating the output in code.
Format: numbered sections, a definitions table and the final prompt ready to copy.How to use it
Paste 10 to 30 real labeled examples, even if there are only a few per label. Test the final prompt on new texts and manually review anything marked low confidence before you automate it.
Usage example
Texts: support tickets for an online store · Labels: shipping, return, payment, defective product, other · Format: JSON.
Sample output
1. Definitions
| Label | Includes | Excludes | Typical signal |
|---|---|---|---|
| food | taste, temperature, portions | dish prices | "the steak was cold" |
| service | attitude, attention, server mistakes | slowness | "really friendly" |
| price | cost, value for money | — | "pricey for what it is" |
| cleanliness | tables, restrooms, cutlery | — | "dirty restroom" |
| wait time | delays at table, kitchen or check | staff attitude | "40 minutes" |
Overlap: service vs wait time. Rule: if the complaint is the delay, wait time wins.
2. Tie-breaks
If a review covers several topics, pick the one in the most negative sentence. Use other / unclear if none of the five is mentioned.
3. Hard negative
"Our server took ages to bring the menus" → wait time, not service. [SYNTHETIC: review]
4. Final prompt (excerpt)
Classify the review inside <review></review> with ONE label:
food | service | price | cleanliness | wait time | other
Return JSON only:
{"label": "...", "confidence": "low|medium|high", "reason": "..."}
Recommendation: temperature 0 and validate in code that the label is in the list…
Key facts
- Category
- Programming & development · AI agents
- Output type
- Text
- Level
- Intermediate
- Designed for
- ChatGPT, Claude, Gemini and Microsoft Copilot
- Verified in
- Pending editorial verification
- Variables
- Texts to classify, Labels, Labeled examples and Output format
- Language
- English
- Price
- Free, no sign-up
- Updated
- Nov 7, 2026
Frequently asked questions
How many examples does a few-shot classifier need?
One to three per label is usually enough when the definitions are clear. More examples make the prompt longer without always helping; hard cases teach more than obvious ones.
Why not use the examples to evaluate it too?
The model has already seen them in the prompt and will get them right almost every time. To know how it really performs, measure it on texts that are not among the examples.
What is this prompt for?
Design a prompt that sorts texts (tickets, reviews, emails) into your labels, with clear definitions, balanced examples, structured output and a plan to measure its accuracy.
Which AI tools does it work with?
It is designed for ChatGPT, Claude, Gemini and Microsoft Copilot. We have not verified it in these tools yet, so results may vary between them.
How do I customize the prompt?
Click “Customize” and fill in the variables (Texts to classify, Labels, Labeled examples and Output format). The text updates instantly and you can then copy it in one click. Values are stored only in your browser.
Do I need experience to use it?
It is intermediate: it helps to know the topic so you can provide good context and review the result critically.
Is this prompt free?
Yes. Every HomeCasa Prompts prompt is free, with no sign-up or subscription. You can also use them in professional projects.
Can I trust the AI output?
Treat it as a high-quality draft: always check data, figures and important claims before publishing or making decisions.