Cheat sheet · Module 2

Cheat sheet: Prompting and structured output

Generative AI · Cheat sheet · Prompting and structured output

Open the moduleModule quiz

Prompting types:

TypeWhen
Zero-shotSimple, well-known task
Few-shotNeed a specific output format or style
Chain-of-thoughtMulti-step reasoning on a model that does not already reason
Self-consistencyHigh-stakes reasoning with a short answer; cost is about N times

Structured output options:

OptionGuarantees
Prompt for JSON, then parseNothing
JSON modeValid JSON, not your schema
Schema-constrained outputsConforms to your schema; not truth, completeness or refusals
Tool callingSchema-checked arguments in strict mode; for actions, not a “stronger” option

Quick answers

  • Reasoning models: spend inference-time compute; reasoning tokens are billed as output; use for hard multi-step tasks; cost latency and tokens; visible reasoning is not an audit trail.
  • Structured output: constrain, then validate (form and meaning), bounded retry with the error, fallback. Valid does not mean correct.
  • Prompts: delimit untrusted text; judge changes on a labelled set and pass rate.
  • Check the docs: effort and thinking settings and supported schema features differ by model and change often.