Output Formatting
Output formatting tells the model exactly what structure to return, such as JSON, tables, markdown sections, or XML-like blocks.
Beginner Behavior control
When to use
Use it when downstream code must parse the result, when repeated calls need a stable structure, or when a document format matters.
Prompt example
Task: Apply Output Formatting to the user's request. Context: describe the input, constraints, target audience, and desired format. Instruction: be explicit, keep the output structured, and state any assumptions.
Output example
Structured answer based on the requested technique. Key result: the model follows the stated task and format. Notes: validate the output before using it in production.
Best practices
- Provide the full expected schema or example.
- State how to handle missing values.
- Ask for no extra text when returning JSON.
- Validate output on the application side.
Common pitfalls
- Deeply nested formats increase error risk.
- Models may add explanations around JSON.
- Schema drift can happen after small prompt edits.