April 2026
Intermediate
395 pages
13h 22m
English
Imagine you have a task for which a model struggles to find the correct answer because it jumps to conclusions rather than thinking step by step.
Listing 4.12 shows provides first an example (few-shot prompting) before posing a question without an answer. The model will try to find the answer.
Q: Sofia has 7 apples in her basket. Her friend Emily gives her 3 more bags of apples. Each bag contains 4 apples. How many apples does Sofia have in total?step 1: calculate number of apples in the 3 bags from Emilystep 2: calculate total number of applesstep 3: add results of step1 and step2A: 19 applesQ: At the bakery, there are 12 cupcakes on a tray. Sarah takes 3 cupcakes for herself. Her friend Alex then takes half ...
Read now
Unlock full access