Back to docsPrompt Engineering
Few-shot prompt design
Give the model examples inside the prompt so it learns the pattern before answering. Two to five high-quality examples consistently outperform zero-shot for structured outputs, classification, and style transfer.
Template
System: You are a support triage agent. Example 1: Input: "My license key says invalid" Output: TIER-1 | LICENSE | Verify key format, check expiry Example 2: Input: "BSOD during injection" Output: TIER-2 | CRASH | Collect minidump, escalate Now classify: Input: "FPS drops after update"
Do
- • 2–5 diverse, real examples
- • Consistent output format
- • Cover edge cases explicitly
- • Place examples closest to query
Don't
- • Mix formats across examples
- • Use synthetic or fake data
- • Overload with 10+ examples
- • Bury examples in long prose
Pro tip
Label your examples with ### or XML-style tags. Clear delimiters prevent the model from confusing examples with instructions. For classification tasks, always include at least one negative example.