liveBook · Manning

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.

How 2 Manning books explain it

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

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.