Skip to content
47% off: the complete course for $79 (reg. $149)Order now →
Agent Builder

AI agent glossary

Few-shot prompting

Including a handful of worked examples of the input and desired output in a prompt so the model copies their format, tone, and judgment.

Describing exactly what you want in words is hard. Showing it is often easier. In few-shot prompting you include a few examples, each pairing an input with the output you want, before the real task. Zero-shot prompting is the opposite: instructions only, no examples.

Examples are especially effective for output format, tone, classification boundaries, and edge cases that are tedious to describe. Models are strong imitators, so a few good examples can do more than a paragraph of rules.

That strength is also the risk. Models copy examples closely, including quirks you did not intend, such as always using the same length or phrasing. Use varied examples that cover different cases, label them clearly, and check with evals that they help rather than narrow the output.

Example

To classify support tickets, you include five sample tickets with their correct labels, including one tricky ticket that mentions billing but is really a login problem.

Learn more in the course

Related terms

Go from definitions to doing

Learn to use and build AI agents in 65 practical lessons.