Class References
Function References
- text
- textOptions
- combineStrategies
- convertMessagesToModelMessages
- convertZodToJsonSchema
- createReplayStream
- embedding
- generateMessageId
- maxIterations
- messages
- modelMessageToUIMessage
- modelMessagesToUIMessages
- normalizeToUIMessage
- parsePartialJSON
- summarize
- toServerSentEventsStream
- toServerSentEventsResponse
- toolDefinition
- uiMessageToModelMessages
- realtimeToken
- untilFinishReason
Interface References
- AIAdapter
- AIAdapterConfig
- AgentLoopState
- ApprovalRequestedStreamChunk
- AudioPart
- AudioVisualization
- BaseStreamChunk
- TextCompletionChunk
- TextOptions
- ChunkRecording
- ChunkStrategy
- ClientTool
- ContentPartSource
- ContentStreamChunk
- DefaultMessageMetadataByModality
- DocumentPart
- DoneStreamChunk
- EmbeddingOptions
- EmbeddingResult
- ErrorStreamChunk
- ImagePart
- InternalToolCallState
- JSONParser
- ModelMessage
- ProcessorResult
- ProcessorState
- RealtimeAdapter
- RealtimeClientOptions
- RealtimeConnection
- RealtimeMessage
- RealtimeSessionConfig
- RealtimeToken
- RealtimeTokenAdapter
- RealtimeTokenOptions
- ResponseFormat
- ServerTool
- StreamProcessorEvents
- StreamProcessorHandlers
- StreamProcessorOptions
- SummarizationOptions
- SummarizationResult
- TextPart
- ThinkingPart
- ThinkingStreamChunk
- Tool
- ToolCall
- ToolCallPart
- ToolCallStreamChunk
- ToolConfig
- ToolDefinition
- ToolDefinitionConfig
- ToolDefinitionInstance
- ToolInputAvailableStreamChunk
- ToolResultPart
- ToolResultStreamChunk
- UIMessage
- VideoPart
Type Alias References
- AgentLoopStrategy
- AnyClientTool
- TextStreamOptionsForModel
- TextStreamOptionsUnion
- ConstrainedContent
- ConstrainedModelMessage
- ContentPart
- ContentPartForModalities
- ExtractModalitiesForModel
- ExtractModelsFromAdapter
- InferToolInput
- InferToolName
- InferToolOutput
- MessagePart
- RealtimeEvent
- RealtimeMessagePart
- RealtimeMode
- RealtimeStatus
- ModalitiesArrayToUnion
- Modality
- StreamChunk
- StreamChunkType
- ToolCallState
- ToolResultState
Variable References
ResponseFormat
Defined in: packages/ai/src/types.ts:1115
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.
See#
- https://platform.openai.com/docs/guides/structured-outputs
- https://sdk.vercel.ai/docs/ai-sdk-core/structured-outputs
Type Parameters#
TData#
TData = any
TypeScript type of the expected data structure (for type safety)
Properties#
__data?#
optional __data?: TData;Defined in: packages/ai/src/types.ts:1193
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.
json_schema?#
optional json_schema?: object;Defined in: packages/ai/src/types.ts:1132
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.
description?#
optional description?: string;Optional description of what the schema represents.
Helps document the purpose of this structured output.
Example#
"User profile information including name, email, and preferences"name#
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#
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.
See#
https://json-schema.org/
Example#
{
* type: "object",
* properties: {
* name: { type: "string" },
* age: { type: "number" },
* email: { type: "string", format: "email" }
* },
* required: ["name", "email"],
* additionalProperties: false
* }strict?#
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)
See#
https://platform.openai.com/docs/guides/structured-outputs#strict-mode
type#
type: "json_object" | "json_schema";Defined in: packages/ai/src/types.ts:1124
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)
See#
https://platform.openai.com/docs/api-reference/chat/create#chat-create-response_format