AI Core/structured Outputs

Type-safe JSON schema responses from LLMs using outputSchema on chat() and useChat(). Supports Zod, ArkType, and Valibot schemas. The adapter handles provider-specific strategies transparently — never configure structured output at the provider level. Pass stream:true alongside outputSchema for incremental JSON deltas + a completed typed object via the `structured-output.complete` event. Each successfully completed structured-output run adds a typed `StructuredOutputPart` to message history. partial/final derive from the most recent structured-output part after the latest user message. convertSchemaToJsonSchema() for manual schema conversion.

TanStack 3bea8cb 28.3 KB Updated

File contents

tanstack/ai/tree/main/packages/ai/skills/ai-core/structured-outputs commit 3bea8cbaea

Frequently asked questions

npx skillmds@latest add tanstack/ai-core-structured-outputs