← Docs
Recipe

Chain-of-thought prompting

Force the model to reason step-by-step before committing to an answer. This recipe works across math, logic, planning, and multi-hop QA.

Template

You are a precise reasoning assistant.

Before answering, work through the problem step by step
inside <thinking> tags. Then provide your final answer
inside <answer> tags.

Question: {question}

Example

Q: A bakery sells cookies in boxes of 6 and 8. What is the largest number of cookies you cannot buy exactly?

<thinking>

This is the Frobenius coin problem for 6 and 8. Since gcd(6,8)=2, only even totals are reachable. The Frobenius number is (6×8)−6−8 = 34. But we must check: 34 is even, so it is the largest unreachable even number. All evens above 34 are reachable. Odds are never reachable. So 34 is the answer.

</thinking>

<answer>34</answer>

When to use

  • Multi-step math or logic problems
  • Debugging or code review tasks
  • Planning with constraints
  • Any prompt where the model rushes to a wrong answer