Chapter 5 of 10All chapters
Chapter 5 of 10
Controlling format
Getting output you can use.
Be explicit
State the exact structure, field names and types, and give one filled-in example. For machine consumption, validate the response and retry on failure rather than assuming.
- Many providers support a strict schema mode; use it where available.
- Ask for nothing but the object when the output feeds a program.
Length and tone
Specify approximate length in words or sentences, and describe tone by example rather than adjective. Concise means different things to different models.