Few-shot prompting

Including one to five worked examples in the prompt so the model copies their format, tone and level of detail.

Last updated: · Markdown version

How to apply it in prompts

Use this concept to reduce ambiguity and improve consistency. If you need strict formatting, combine it with a JSON guide and a per-model template.

What it means
Copy-paste example
Convert each input to JSON with the keys name (string) and age (number).

Example 1
Input: "Name: Ana, Age: 31"
Output: {"name":"Ana","age":31}

Example 2
Input: "Luis, 27 years old"
Output: {"name":"Luis","age":27}

Now do this one.
Input:
"""[paste]"""
Output ONLY the JSON.
Opens the analyzer with the prompt prefilled.
Open in Promptea
FAQ
How many examples should I use?
Start with one or two. Add more only if the model is still inconsistent, and make the new ones cover a different case, not a repeat of the first.
What is the difference between few-shot and zero-shot?
Zero-shot gives only the instruction; few-shot adds worked examples. Use zero-shot for simple, well-defined tasks and few-shot when format or edge cases matter.