openai.internal.StructuredOutput
(internal) Structured output for one output type: the schema a request carries, and how the answer is read back.
Reference version
Signature
class openai.internal.StructuredOutput(internal) Structured output for one output type: the schema a request carries, and how the answer is read back.
Source:<builtin>/openai/ns_internal/structured.bamlbytes 794–2929
Fields
output_type
reflect.Typeschema
baml.json.jsonThe strict JSON Schema.
wrapped
boolStrict mode wants an object at the root. Any other output type is sent
as the one property value of an object, and read back out of it.
Instance methods
function
decode
(self,
provider: string,
text: string
) -> ai.ParsedOutput throws baml.json.SerializationError | ai.errors.ParseFailed
The answer text as a value of the output type, read strictly: the
JSON must have the shape the schema describes, under the names it uses.
Anything else is ai.errors.ParseFailed, never a lenient parse.
function
name
(self) -> string throws neverThe name the schema goes by on the wire.