promptdojo_

Few-shot and reasoning — examples that work, and the CoT trap on reasoning models — step 6 of 9

This build_prompt function unconditionally appends "Think step by step." to every prompt — even when the model is a reasoning model (o3, Claude with thinking, etc.). On reasoning models, this is at best wasted tokens and at worst hurts answer quality.

Fix the function to ONLY append the CoT prefix when the model is NOT in REASONING_MODELS.

Expected output:

o3            cot? False
claude-haiku  cot? True
The break is on line 5 — but read the whole snippet first.

full-screen editor opens — close anytime to keep reading.