Output control constrains an AI response’s format, length, content, style, and other properties so results become more predictable and usable. It works especially well alongside instruction refinement. section 9.5.5
Specify the rules that shape the response:
- Define a structure such as bullet points, numbered steps, JSON, SQL, or tagged sections. section 9.5.5
- Filter irrelevant information to keep the response focused. section 9.5.5
- Enforce coding and writing rules, such as PEP 8, snake_case, a particular tone, or a response length. section 9.5.5
- Use consistent constraints across multipart documentation, repeated code generation, or complex outputs. section 9.5.5
Constrained Python generation
Ask for a Python function that processes JSON data, follows PEP 8, uses snake_case, and avoids unnecessary imports. The resulting code can then be checked against those explicit requirements rather than accepted merely because it looks plausible. section 9.5.5
Figure 9.10 Output control is used when you need the response to fit into a particular format such as JSON, SQL, or many other standard formats.
Use the figure to compare output-control constraints across standard formats such as JSON and SQL. section 9.5.5
