Few-shot chain of thought
Few-shot chain-of-thought is a prompting technique that provides a small number of examples with reasoning steps to guide a model's response to a new task.
Prompt Engineering in Practice
A prompting technique that provides worked examples demonstrating intermediate reasoning steps.
- How it is used
- Guides deployment-risk decisions by demonstrating how to assess canary signals and explicitly identify the deciding signal.
- How deep it goes
- Works through a structured prompt and reference assessment, then compares direct, zero-shot, and few-shot prompting rather than model internals.
- Examples
- Uses a canary-rollout reference with API errors, memory utilization, cache misses, and a NO-GO recommendation.
- What you can do after
- Build it from scratch as a structured prompt that demonstrates threshold checks, path weighting, and an explicitly justified GO or NO-GO decision.
Read how Prompt Engineering in Practice explains few-shot chain of thought →
Generative AI in Action
Few-shot chain of thought is a prompting technique that provides a small number of examples containing reasoning chains before asking the model to solve a new instance.
- How it is used
- Uses worked reasoning examples to guide models through new question-answering, translation, arithmetic, or code-generation tasks.
- How deep it goes
- Defines the prompt pattern and shows worked arithmetic, but omits implementation code for the completion API call.
- Examples
- Demonstrates computer counts, golf-ball subtraction, and bagel-cost arithmetic through question-and-answer reasoning chains.
- What you can do after
- Apply it via few-shot prompts to elicit step-by-step reasoning and support more accurate or debuggable model outputs.
Read how Generative AI in Action explains few-shot chain of thought →
Related concepts
- chain-of-thought promptingkind of · Chain-of-thought prompting is a technique that elicits or guides a model to produce or follow intermediate reasoning steps before a final answer.
- demonstrationuses · A demonstration is an example pairing an input, request, or prompt with a corresponding output, answer, or label to illustrate a task or expected behavior.
- few-shot learninguses · Few-shot learning is the adaptation or performance of a model on a task using only a small number of task-specific examples.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

