Few-shot prompting includes 2-10 example input/output pairs in the prompt before the actual question. The model uses the examples as a pattern for what the response should look like. Few-shot is especially effective for tasks where the output format is specific (extract these fields, classify into these labels, format as this JSON shape) or where zero-shot produces inconsistent results.
A typical few-shot prompt looks like: "Input:
Few-shot tradeoffs: more examples = better consistency but more tokens consumed per call. For high-volume use cases, few-shot with 5 examples per call burns serious tokens; fine-tuning the behavior into model weights becomes worth considering.
Few-shot is the workhorse of practical LLM usage. It is cheaper than fine-tuning, more reliable than zero-shot, and easy to iterate on. Most production prompts converge on few-shot with carefully-curated examples.
The Recipes section includes paste-ready few-shot prompt templates for common API tasks.