Defined in: packages/ai/src/types.ts:683
Structured output format specification.
Constrains the model's output to match a specific JSON structure. Useful for extracting structured data, form filling, or ensuring consistent response formats.
https://platform.openai.com/docs/guides/structured-outputs
https://sdk.vercel.ai/docs/ai-sdk-core/structured-outputs
TData = any
TypeScript type of the expected data structure (for type safety)
optional __data: TData;Defined in: packages/ai/src/types.ts:761
Internal
Type-only property to carry the inferred data type.
This is never set at runtime - it only exists for TypeScript type inference. Allows the SDK to know what type to expect when parsing the response.
optional json_schema: object;Defined in: packages/ai/src/types.ts:700
JSON schema specification (required when type is "json_schema").
Defines the exact structure the model's output must conform to. OpenAI's structured outputs will guarantee the output matches this schema.
optional description: string;Optional description of what the schema represents.
Helps document the purpose of this structured output.
"User profile information including name, email, and preferences"name: string;Unique name for the schema.
Used to identify the schema in logs and debugging. Should be descriptive (e.g., "user_profile", "search_results").
schema: Record<string, any>;JSON Schema definition for the expected output structure.
Must be a valid JSON Schema (draft 2020-12 or compatible). The model's output will be validated against this schema.
https://json-schema.org/
{
* type: "object",
* properties: {
* name: { type: "string" },
* age: { type: "number" },
* email: { type: "string", format: "email" }
* },
* required: ["name", "email"],
* additionalProperties: false
* }optional strict: boolean;Whether to enforce strict schema validation.
When true (recommended), the model guarantees output will match the schema exactly. When false, the model will "best effort" match the schema.
Default: true (for providers that support it)
https://platform.openai.com/docs/guides/structured-outputs#strict-mode
type: "json_object" | "json_schema";Defined in: packages/ai/src/types.ts:692
Type of structured output.
"json_object": Forces the model to output valid JSON (any structure)
"json_schema": Validates output against a provided JSON Schema (strict structure)
https://platform.openai.com/docs/api-reference/chat/create#chat-create-response_format