Fairy Lake, BC Canada | Follow me on Instagram for more. Tha… | Flickr
Tuesday, September 17, 2024
OpenAI API: Structured Outputs (JSON "schema")
Structured Outputs - OpenAI API
Structured Outputs is available in two forms in the OpenAI API:
- When using function calling
- When using a
json_schema
response format
Structured Outputs via
response_format
are more suitable when you want to indicate a structured schema for use when the model responds to the user, rather than when the model calls a tool.Structured Outputs with
response_format: {type: "json_schema", ...}
is only supported with the gpt-4o-mini
, gpt-4o-mini-2024-07-18
, and gpt-4o-2024-08-06
model snapshots and later.The name "Pydantic" is a portmanteau of "Py" and "pedantic."
Structured Outputs supports a subset of the JSON Schema language.
The following types are supported for Structured Outputs:
- String
- Number
- Boolean
- Integer
- Object
- Array
- Enum
- anyOf
Subscribe to:
Posts (Atom)