promptdojo_

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

Checkpoint

One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.

Final drill. Build a decision helper that, given a task and a model, returns a prompt strategy summary: which techniques apply and which don't.

Write prompt_strategy(task_kind, model) that returns a dict:

  • model_class: "reasoning" if model is in REASONING_MODELS, else "standard".
  • use_few_shot: True if task_kind is in {"classify", "format"}, False otherwise (few-shot helps with format/labels, less so with pure reasoning).
  • use_cot: True ONLY if task_kind == "math" AND model_class is "standard". Reasoning models skip explicit CoT.
  • notes: a one-sentence string explaining why CoT is or isn't applied.

Four cases run for you. Expected output:

classify+haiku    → model_class=standard use_few_shot=True  use_cot=False notes=Few-shot for label format; CoT not needed for classification.
classify+o3       → model_class=reasoning use_few_shot=True  use_cot=False notes=Few-shot for label format; CoT skipped on reasoning model.
math+haiku        → model_class=standard use_few_shot=False use_cot=True  notes=CoT helps standard model on math.
math+o3           → model_class=reasoning use_few_shot=False use_cot=False notes=Reasoning model handles math internally; skip CoT.

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