Provider-neutral response format.
The union is closed. A request either leaves the format unspecified (nil)
or declares exactly one of:
:text— plain assistant text.{:json, :object}— schemaless JSON object mode.{:json_schema, %{name: name, schema: schema, strict: strict?}}— a named schema the provider must conform to.
Every adapter either maps the declared format onto a real provider option or
refuses it with Inference.Error.response_format_unsupported/2. Silently
dropping a declared format is a contract violation, not a fallback.
Summary
Functions
Returns true when the format asks the provider for JSON output.
Normalizes a caller-supplied response format into the closed union.
Types
@type t() :: :text | {:json, :object} | {:json_schema, json_schema()}
Functions
Returns true when the format asks the provider for JSON output.
@spec normalize(term()) :: {:ok, t() | nil} | {:error, Inference.Error.t()}
Normalizes a caller-supplied response format into the closed union.
nil stays nil and means "unspecified". Anything outside the union is an
:invalid error with reason :response_format.