Tanstack 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.

lukasa1993 5bda07c 3 files · 30.3 KB Updated

File contents

lukasa1993/tanstack-skills-extracted/tree/main/skills/tanstack-ai-core-structured-outputs commit 5bda07c350

Frequently asked questions

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