passdrill
AI & LLM Engineering · Building with LLM APIs · Card 013/024 medium

A developer building a chat feature needs the model's reply to reliably parse as a JSON object matching a specific schema, with no missing required fields and no invalid enum values. According to OpenAI's documentation, how do its `json_object` response format and its `json_schema` Structured Outputs mode (with `strict` set to true) differ in what they actually guarantee?

  1. `response_format` `json_object` mode and `json_schema` mode with `strict` enabled provide the exact same guarantee: both ensure the output matches a developer-supplied schema exactly, including all required fields and valid enum values
  2. `json_object` mode guarantees the output matches the developer's schema exactly, while `json_schema` mode with `strict` enabled guarantees only that the output is syntactically valid JSON, with no schema enforcement
  3. `json_object` mode guarantees only that the output is syntactically valid JSON, with no guarantee it matches any particular structure, while `json_schema` mode with `strict` set to true constrains generation so the model reliably includes every required field and only valid enum values as defined in the developer's supplied schema
  4. both modes only take effect when `temperature` is also set to 0; without that, neither has any influence on whether the output is valid JSON or matches a schema
Next card → Shuffle