Practice structured output prompting vocabulary: JSON mode, output schemas, strict instructions, validating structured outputs, and handling extra model text.
0 / 5 completed
1 / 5
'Respond only in _____' is a prompt instruction for getting machine-parseable output.
'Respond only in JSON' is the most common instruction for structured output, telling the model to return data in a format that can be parsed programmatically.
2 / 5
'Use this _____ : {name: string, category: string}' — what is provided to guide the model's output format?
A schema defines the expected structure and data types of the output. Providing a schema in the prompt guides the model to produce consistently structured responses.
3 / 5
'The model sometimes adds extra text — we need _____ instructions.' What kind of instructions prevent this?
'Stricter instructions' (e.g., 'Output ONLY the JSON object with no additional text, explanation, or markdown') reduce the model's tendency to add preamble or commentary.
4 / 5
What is 'JSON mode' in the OpenAI API?
JSON mode is an API-level parameter (response_format: {type: 'json_object'}) that constrains the model to produce valid JSON, reducing parse failures.
5 / 5
'Validating structured output' means:
Validating structured output means programmatically parsing the model response and checking it against the schema (e.g., with Zod or Pydantic) to catch malformed outputs before they cause bugs.