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.
Build an Advanced RAG Application (From Scratch)
Few-shot chain-of-thought prompting provides example problems with reasoning steps to guide a model in solving a new problem step by step.
- How it is used
- Improves language-model reasoning and turns raw semantic-search results into structured recommendations.
- How deep it goes
- Demonstrates prompt structure, reasoning-versus-answer extraction, and an API-oriented hotel-analysis workflow.
- Examples
- Uses mathematical word problems, hotel examples, FAISS results, review quotes, and a step-by-step recommendation prompt.
- What you can do after
- Apply it via an OpenAI chat-completion call to analyze retrieved results and produce a recommendation.
Read how Build an Advanced RAG Application (From Scratch) explains few-shot chain of thought →
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 →
What to know first
- language modelA language model is a computational model of linguistic sequences that estimates their probabilities or predicts tokens from context, enabling it to generate or evaluate language.
- chain-of-thoughtA chain-of-thought is an ordered sequence of intermediate reasoning steps presented or used to connect information to a conclusion.
Related concepts
- chain-of-thought promptingkind of · Chain-of-thought prompting is a technique that elicits or supplies intermediate reasoning steps to guide a model toward a final answer.
- demonstrationuses · A demonstration is an example, often pairing an input with an output, that illustrates a task or desired behavior for training or guiding a model.
- chain-of-thoughtkind of · A chain-of-thought is an ordered sequence of intermediate reasoning steps presented or used to connect information to a conclusion.
- architecture decision recorduses · An architecture decision record is a durable document capturing a significant architectural decision, its context, rationale, and consequences.
- few-shot learninguses · Few-shot learning is an approach in which a model is guided to perform or adapt to a task from only a small number of examples.
Questions about few-shot chain of thought
What is 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.
Which Manning books explain few-shot chain of thought?
Build an Advanced RAG Application (From Scratch), Prompt Engineering in Practice and Generative AI in Action.
What should I know before learning few-shot chain of thought?
Manning books that teach few-shot chain of thought usually introduce language model and chain-of-thought first.
What is few-shot chain of thought a kind of?
Few-shot chain of thought is a kind of chain-of-thought prompting. Chain-of-thought prompting is a technique that elicits or supplies intermediate reasoning steps to guide a model toward a final answer.
What is few-shot chain of thought also called?
Few-shot chain of thought is also called few-shot CoT.
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.


