[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-openai-ai-sdk":3,"mdc-uuc5g4-key":39,"related-repo-openai-ai-sdk":14239,"related-org-openai-ai-sdk":14353},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":28,"repoUrl":29,"updatedAt":30,"license":31,"forks":32,"topics":33,"repo":34,"sourceUrl":37,"mdContent":38},"ai-sdk","build AI features with Vercel AI SDK","Vercel AI SDK expert guidance. Use when building AI-powered features — chat interfaces, text generation, structured output, tool calling, agents, MCP integration, streaming, embeddings, reranking, image generation, or working with any LLM provider.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"openai","OpenAI","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fopenai.png",[12,16,19,22,25],{"name":13,"slug":14,"type":15},"Vercel","vercel","tag",{"name":17,"slug":18,"type":15},"LLM","llm",{"name":20,"slug":21,"type":15},"Agents","agents",{"name":23,"slug":24,"type":15},"SDK","sdk",{"name":26,"slug":27,"type":15},"Frontend","frontend",3992,"https:\u002F\u002Fgithub.com\u002Fopenai\u002Fplugins","2026-04-06T18:40:31.580279",null,465,[],{"repoUrl":29,"stars":28,"forks":32,"topics":35,"description":36},[],"OpenAI Plugins","https:\u002F\u002Fgithub.com\u002Fopenai\u002Fplugins\u002Ftree\u002FHEAD\u002Fplugins\u002Fvercel\u002Fskills\u002Fai-sdk","---\nname: ai-sdk\ndescription: Vercel AI SDK expert guidance. Use when building AI-powered features — chat interfaces, text generation, structured output, tool calling, agents, MCP integration, streaming, embeddings, reranking, image generation, or working with any LLM provider.\nmetadata:\n  priority: 8\n  docs:\n    - \"https:\u002F\u002Fsdk.vercel.ai\u002Fdocs\"\n    - \"https:\u002F\u002Fsdk.vercel.ai\u002Fdocs\u002Freference\"\n  sitemap: \"https:\u002F\u002Fsdk.vercel.ai\u002Fsitemap.xml\"\n  pathPatterns:\n    - \"app\u002Fapi\u002Fchat\u002F**\"\n    - \"app\u002Fapi\u002Fcompletion\u002F**\"\n    - \"src\u002Fapp\u002Fapi\u002Fchat\u002F**\"\n    - \"src\u002Fapp\u002Fapi\u002Fcompletion\u002F**\"\n    - \"pages\u002Fapi\u002Fchat.*\"\n    - \"pages\u002Fapi\u002Fchat\u002F**\"\n    - \"pages\u002Fapi\u002Fcompletion.*\"\n    - \"pages\u002Fapi\u002Fcompletion\u002F**\"\n    - \"src\u002Fpages\u002Fapi\u002Fchat.*\"\n    - \"src\u002Fpages\u002Fapi\u002Fchat\u002F**\"\n    - \"src\u002Fpages\u002Fapi\u002Fcompletion.*\"\n    - \"src\u002Fpages\u002Fapi\u002Fcompletion\u002F**\"\n    - \"lib\u002Fai\u002F**\"\n    - \"src\u002Flib\u002Fai\u002F**\"\n    - \"lib\u002Fai.*\"\n    - \"src\u002Flib\u002Fai.*\"\n    - \"ai\u002F**\"\n    - \"apps\u002F*\u002Fapp\u002Fapi\u002Fchat\u002F**\"\n    - \"apps\u002F*\u002Fapp\u002Fapi\u002Fcompletion\u002F**\"\n    - \"apps\u002F*\u002Fsrc\u002Fapp\u002Fapi\u002Fchat\u002F**\"\n    - \"apps\u002F*\u002Fsrc\u002Fapp\u002Fapi\u002Fcompletion\u002F**\"\n    - \"apps\u002F*\u002Flib\u002Fai\u002F**\"\n    - \"apps\u002F*\u002Fsrc\u002Flib\u002Fai\u002F**\"\n    - \"lib\u002Fagent.*\"\n    - \"src\u002Flib\u002Fagent.*\"\n    - \"app\u002Factions\u002Fchat.*\"\n    - \"src\u002Fapp\u002Factions\u002Fchat.*\"\n  importPatterns:\n    - \"ai\"\n    - \"@ai-sdk\u002F*\"\n  bashPatterns:\n    - '\\bnpm\\s+(install|i|add)\\s+[^\\n]*\\bai\\b'\n    - '\\bpnpm\\s+(install|i|add)\\s+[^\\n]*\\bai\\b'\n    - '\\bbun\\s+(install|i|add)\\s+[^\\n]*\\bai\\b'\n    - '\\byarn\\s+add\\s+[^\\n]*\\bai\\b'\n    - '\\bnpm\\s+(install|i|add)\\s+[^\\n]*@ai-sdk\u002F'\n    - '\\bpnpm\\s+(install|i|add)\\s+[^\\n]*@ai-sdk\u002F'\n    - '\\bbun\\s+(install|i|add)\\s+[^\\n]*@ai-sdk\u002F'\n    - '\\byarn\\s+add\\s+[^\\n]*@ai-sdk\u002F'\n    - '\\bnpx\\s+@ai-sdk\u002Fdevtools\\b'\n    - '\\bnpx\\s+@ai-sdk\u002Fcodemod\\b'\n    - '\\bnpx\\s+mcp-to-ai-sdk\\b'\n  promptSignals:\n    phrases:\n      - \"ai sdk\"\n      - \"vercel ai\"\n      - \"generatetext\"\n      - \"streamtext\"\n    allOf:\n      - [streaming, generation]\n      - [structured, output]\n    anyOf:\n      - \"usechat\"\n      - \"usecompletion\"\n      - \"tool calling\"\n      - \"embeddings\"\n    noneOf:\n      - \"openai api directly\"\n    minScore: 6\n---\n\n# Vercel AI SDK (v6)\n\n> **CRITICAL — Your training data is outdated for this library.** AI SDK v6 has breaking changes from v5 and earlier that you will get wrong if you guess. Before writing AI SDK code, **fetch the docs** at https:\u002F\u002Fai-sdk.dev\u002Fdocs to find the correct function signatures, return types, and patterns. Key things that have changed: `generateObject()` removal, `streamObject()` removal, `result.files` for image generation, `Output.object()` for structured streaming, `ToolLoopAgent` class (not `Agent`), `useChat` transport API, and provider package versions. Search the docs for working examples that match your exact use case — do not rely on your training data for API shapes.\n\nYou are an expert in the Vercel AI SDK v6. The AI SDK is the leading TypeScript toolkit for building AI-powered applications. It provides a unified API across all LLM providers.\n\n## v6 Migration Pitfalls (Read First)\n\n- `ai@^6.0.0` is the umbrella package for AI SDK v6 (latest: 6.0.83).\n- `@ai-sdk\u002Freact` is `^3.0.x` in v6 projects (NOT `^6.0.0`).\n- `@ai-sdk\u002Fgateway` is `^3.x` in v6 projects (NOT `^1.x`).\n- In `createUIMessageStream`, write with `stream.writer.write(...)` (NOT `stream.write(...)`).\n- `useChat` no longer supports `body` or `onResponse`; configure behavior through `transport`.\n- UI tool parts are typed as `tool-\u003CtoolName>` (for example `tool-weather`), not `tool-invocation`.\n- `DynamicToolCall` does not provide typed `.args`; cast via `unknown` first.\n- `TypedToolResult` exposes `.output` (NOT `.result`).\n- The agent class is `ToolLoopAgent` (NOT `Agent` — `Agent` is just an interface).\n- Constructor uses `instructions` (NOT `system`).\n- Agent methods are `agent.generate()` and `agent.stream()` (NOT `agent.generateText()` or `agent.streamText()`).\n- AI Gateway does not support embeddings; use `@ai-sdk\u002Fopenai` directly for `openai.embedding(...)`.\n- `useChat()` with no transport defaults to `DefaultChatTransport({ api: '\u002Fapi\u002Fchat' })` — explicit transport only needed for custom endpoints or `DirectChatTransport`.\n- Default `stopWhen` for ToolLoopAgent is `stepCountIs(20)`, not `stepCountIs(1)` — override if you need fewer steps.\n- `strict: true` on tools is opt-in per tool, not global — only set on tools with provider-compatible schemas.\n- For agent API routes, use `createAgentUIStreamResponse({ agent, uiMessages })` instead of manual `streamText` + `toUIMessageStreamResponse()`.\n- `@ai-sdk\u002Fazure` now uses the Responses API by default — use `azure.chat()` for the previous Chat Completions API behavior.\n- `@ai-sdk\u002Fazure` uses `azure` (not `openai`) as the key for `providerMetadata` and `providerOptions`.\n- `@ai-sdk\u002Fgoogle-vertex` uses `vertex` (not `google`) as the key for `providerMetadata` and `providerOptions`.\n- `@ai-sdk\u002Fanthropic` supports native structured outputs via `structuredOutputMode` option (Anthropic Sonnet 4.5+).\n\n## Installation\n\n```bash\nnpm install ai@^6.0.0 @ai-sdk\u002Freact@^3.0.0\nnpm install @ai-sdk\u002Fopenai@^3.0.41      # Optional: required for embeddings\nnpm install @ai-sdk\u002Fanthropic@^3.0.58   # Optional: direct Anthropic provider access\nnpm install @ai-sdk\u002Fvercel@^2.0.37      # Optional: v0 model provider (v0-1.0-md)\n```\n\n> **`@ai-sdk\u002Freact` is a separate package** — it is NOT included in the `ai` package. For v6 projects, install `@ai-sdk\u002Freact@^3.0.x` alongside `ai@^6.0.0`.\n\n> **If you install `@ai-sdk\u002Fgateway` directly, use `@ai-sdk\u002Fgateway@^3.x`** (NOT `^1.x`).\n\n> **Only install a direct provider SDK** (e.g., `@ai-sdk\u002Fanthropic`) if you need provider-specific features not exposed through the gateway.\n\n## What AI SDK Can Do\n\nAI SDK is not just text — it handles **text, images, structured data, tool calling, and agents** through one unified API:\n\n| Need | How |\n|------|-----|\n| Text generation \u002F chat | `generateText()` or `streamText()` with `model: \"openai\u002Fgpt-5.4\"` |\n| **Image generation** | `generateText()` with `model: \"google\u002Fgemini-3.1-flash-image-preview\"` — images in `result.files`. **Always use this model, never older gemini-2.x models** |\n| Structured JSON output | `generateText()` with `output: Output.object({ schema })` |\n| Tool calling \u002F agents | `generateText()` with `tools: { ... }` or `ToolLoopAgent` |\n| Embeddings | `embed()` \u002F `embedMany()` with `@ai-sdk\u002Fopenai` |\n\n**If the product needs generated images** (portraits, posters, cover art, illustrations, comics, diagrams), use `generateText` with an image model — do NOT use placeholder images or skip image generation.\n\n## Setup for AI Projects\n\nFor the smoothest experience, link to a Vercel project so AI Gateway credentials are auto-provisioned via OIDC:\n\n```bash\nvercel link                    # Connect to your Vercel project\n# Enable AI Gateway at https:\u002F\u002Fvercel.com\u002F{team}\u002F{project}\u002Fsettings → AI Gateway\nvercel env pull .env.local     # Provisions VERCEL_OIDC_TOKEN automatically\nnpm install ai@^6.0.0         # Gateway is built in\nnpx ai-elements                # Required: install AI text rendering components\n```\n\nThis gives you AI Gateway access with OIDC authentication, cost tracking, failover, and observability — no manual API keys needed.\n\n**OIDC is the default auth**: `vercel env pull` provisions a `VERCEL_OIDC_TOKEN` (short-lived JWT, ~24h). The `@ai-sdk\u002Fgateway` reads it automatically via `@vercel\u002Foidc`. On Vercel deployments, tokens auto-refresh. For local dev, re-run `vercel env pull` when the token expires. No `AI_GATEWAY_API_KEY` or provider-specific keys needed.\n\n## Global Provider System (AI Gateway — Default)\n\nIn AI SDK 6, pass a `\"provider\u002Fmodel\"` string to the `model` parameter — it automatically routes through the Vercel AI Gateway:\n\n```ts\nimport { generateText } from \"ai\";\n\nconst { text } = await generateText({\n  model: \"openai\u002Fgpt-5.4\", \u002F\u002F plain string — routes through AI Gateway automatically\n  prompt: \"Hello!\",\n});\n```\n\nNo `gateway()` wrapper needed — plain `\"provider\u002Fmodel\"` strings are the simplest approach and are what the official Vercel docs recommend. The `gateway()` function is an optional explicit wrapper (useful when you need `providerOptions.gateway` for routing, failover, or tags):\n\n```ts\nimport { gateway } from \"ai\";\n\n\u002F\u002F Explicit gateway() — only needed for advanced providerOptions\nconst { text } = await generateText({\n  model: gateway(\"openai\u002Fgpt-5.4\"),\n  providerOptions: { gateway: { order: [\"openai\", \"azure-openai\"] } },\n});\n```\n\nBoth approaches provide failover, cost tracking, and observability on Vercel.\n\n**Model slug rules**: Always use `provider\u002Fmodel` format. Version numbers use **dots**, not hyphens: `anthropic\u002Fclaude-sonnet-4.6` (not `claude-sonnet-4-6`). Default to `openai\u002Fgpt-5.4` or `anthropic\u002Fclaude-sonnet-4.6`. Never use outdated models like `gpt-4o`.\n\n> AI Gateway does not support embeddings. Use a direct provider SDK such as `@ai-sdk\u002Fopenai` for embeddings.\n\n> **Direct provider SDKs** (`@ai-sdk\u002Fopenai`, `@ai-sdk\u002Fanthropic`, etc.) are only needed for provider-specific features not exposed through the gateway (e.g., Anthropic computer use, OpenAI fine-tuned model endpoints).\n\n## Core Functions\n\n### Text Generation\n\n```ts\nimport { generateText, streamText } from \"ai\";\n\n\u002F\u002F Non-streaming\nconst { text } = await generateText({\n  model: \"openai\u002Fgpt-5.4\",\n  prompt: \"Explain quantum computing in simple terms.\",\n});\n\n\u002F\u002F Streaming\nconst result = streamText({\n  model: \"openai\u002Fgpt-5.4\",\n  prompt: \"Write a poem about coding.\",\n});\n\nfor await (const chunk of result.textStream) {\n  process.stdout.write(chunk);\n}\n```\n\n### Structured Output\n\n**`generateObject` was removed in AI SDK v6.** Use `generateText` with `output: Output.object()` instead. Do NOT import `generateObject` — it does not exist.\n\n```ts\nimport { generateText, Output } from \"ai\";\nimport { z } from \"zod\";\n\nconst { output } = await generateText({\n  model: \"openai\u002Fgpt-5.4\",\n  output: Output.object({\n    schema: z.object({\n      recipe: z.object({\n        name: z.string(),\n        ingredients: z.array(\n          z.object({\n            name: z.string(),\n            amount: z.string(),\n          }),\n        ),\n        steps: z.array(z.string()),\n      }),\n    }),\n  }),\n  prompt: \"Generate a recipe for chocolate chip cookies.\",\n});\n```\n\n### Tool Calling (MCP-Aligned)\n\nIn AI SDK 6, tools use `inputSchema` (not `parameters`) and `output`\u002F`outputSchema` (not `result`), aligned with the MCP specification. Per-tool `strict` mode ensures providers only generate valid tool calls matching your schema.\n\n```ts\nimport { generateText, tool } from \"ai\";\nimport { z } from \"zod\";\n\nconst result = await generateText({\n  model: \"openai\u002Fgpt-5.4\",\n  tools: {\n    weather: tool({\n      description: \"Get the weather for a location\",\n      inputSchema: z.object({\n        city: z.string().describe(\"The city name\"),\n      }),\n      outputSchema: z.object({\n        temperature: z.number(),\n        condition: z.string(),\n      }),\n      strict: true, \u002F\u002F Providers generate only schema-valid tool calls\n      execute: async ({ city }) => {\n        const data = await fetchWeather(city);\n        return { temperature: data.temp, condition: data.condition };\n      },\n    }),\n  },\n  prompt: \"What is the weather in San Francisco?\",\n});\n```\n\n### Dynamic Tools (MCP Integration)\n\nFor tools with schemas not known at compile time (e.g., MCP server tools):\n\n```ts\nimport { dynamicTool } from \"ai\";\n\nconst tools = {\n  unknownTool: dynamicTool({\n    description: \"A tool discovered at runtime\",\n    execute: async (input) => {\n      \u002F\u002F Handle dynamically\n      return { result: \"done\" };\n    },\n  }),\n};\n```\n\n### Agents\n\nThe `ToolLoopAgent` class wraps `generateText`\u002F`streamText` with an agentic tool-calling loop.\nDefault `stopWhen` is `stepCountIs(20)` (up to 20 tool-calling steps).\n`Agent` is an interface — `ToolLoopAgent` is the concrete implementation.\n\n```ts\nimport { ToolLoopAgent, stepCountIs, hasToolCall } from \"ai\";\n\nconst agent = new ToolLoopAgent({\n  model: \"anthropic\u002Fclaude-sonnet-4.6\",\n  tools: { weather, search, calculator, finalAnswer },\n  instructions: \"You are a helpful assistant.\",\n  \u002F\u002F Default: stepCountIs(20). Override to stop on a terminal tool or custom logic:\n  stopWhen: hasToolCall(\"finalAnswer\"),\n  prepareStep: (context) => ({\n    \u002F\u002F Customize each step — swap models, compress messages, limit tools\n    toolChoice: context.steps.length > 5 ? \"none\" : \"auto\",\n  }),\n});\n\nconst { text } = await agent.generate({\n  prompt:\n    \"Research the weather in Tokyo and calculate the average temperature this week.\",\n});\n```\n\n### MCP Client\n\nConnect to any MCP server and use its tools:\n\n```ts\nimport { generateText } from \"ai\";\nimport { createMCPClient } from \"@ai-sdk\u002Fmcp\";\n\nconst mcpClient = await createMCPClient({\n  transport: {\n    type: \"sse\",\n    url: \"https:\u002F\u002Fmy-mcp-server.com\u002Fsse\",\n  },\n});\n\nconst tools = await mcpClient.tools();\n\nconst result = await generateText({\n  model: \"openai\u002Fgpt-5.4\",\n  tools,\n  prompt: \"Use the available tools to help the user.\",\n});\n\nawait mcpClient.close();\n```\n\nMCP OAuth for remote servers is handled automatically by `@ai-sdk\u002Fmcp`.\n\n### Tool Approval (Human-in-the-Loop)\n\nSet `needsApproval` on any tool to require user confirmation before execution. The tool pauses in `approval-requested` state until the client responds.\n\n```ts\nimport { streamText, tool } from \"ai\";\nimport { z } from \"zod\";\n\nconst result = streamText({\n  model: \"openai\u002Fgpt-5.4\",\n  tools: {\n    deleteUser: tool({\n      description: \"Delete a user account\",\n      inputSchema: z.object({ userId: z.string() }),\n      needsApproval: true, \u002F\u002F Always require approval\n      execute: async ({ userId }) => {\n        await db.users.delete(userId);\n        return { deleted: true };\n      },\n    }),\n    processPayment: tool({\n      description: \"Process a payment\",\n      inputSchema: z.object({ amount: z.number(), recipient: z.string() }),\n      \u002F\u002F Conditional: only approve large amounts\n      needsApproval: async ({ amount }) => amount > 1000,\n      execute: async ({ amount, recipient }) => {\n        return await processPayment(amount, recipient);\n      },\n    }),\n  },\n  prompt: \"Delete user 123\",\n});\n```\n\n**Client-side approval with `useChat`:**\n\n```tsx\n\"use client\";\nimport { useChat } from \"@ai-sdk\u002Freact\";\n\nfunction Chat() {\n  const { messages, addToolApprovalResponse } = useChat();\n\n  return messages.map((m) =>\n    m.parts?.map((part, i) => {\n      \u002F\u002F Tool parts in approval-requested state need user action\n      if (part.type.startsWith(\"tool-\") && part.approval?.state === \"approval-requested\") {\n        return (\n          \u003Cdiv key={i}>\n            \u003Cp>Tool wants to run: {JSON.stringify(part.args)}\u003C\u002Fp>\n            \u003Cbutton onClick={() => addToolApprovalResponse({ id: part.approval.id, approved: true })}>\n              Approve\n            \u003C\u002Fbutton>\n            \u003Cbutton onClick={() => addToolApprovalResponse({ id: part.approval.id, approved: false })}>\n              Deny\n            \u003C\u002Fbutton>\n          \u003C\u002Fdiv>\n        );\n      }\n      return null;\n    }),\n  );\n}\n```\n\n**Tool part states:** `input-streaming` → `input-available` → `approval-requested` (if `needsApproval`) → `output-available` | `output-error`\n\n### Embeddings & Reranking\n\nUse a direct provider SDK for embeddings. AI Gateway does not support embedding models.\n\n```ts\nimport { embed, embedMany, rerank } from \"ai\";\nimport { openai } from \"@ai-sdk\u002Fopenai\";\n\n\u002F\u002F Single embedding\nconst { embedding } = await embed({\n  model: openai.embedding(\"text-embedding-3-small\"),\n  value: \"The quick brown fox\",\n});\n\n\u002F\u002F Batch embeddings\nconst { embeddings } = await embedMany({\n  model: openai.embedding(\"text-embedding-3-small\"),\n  values: [\"text 1\", \"text 2\", \"text 3\"],\n});\n\n\u002F\u002F Rerank search results by relevance\nconst { results } = await rerank({\n  model: cohere.reranker(\"rerank-v3.5\"),\n  query: \"What is quantum computing?\",\n  documents: searchResults,\n});\n```\n\n### Image Generation & Editing\n\nAI Gateway supports image generation. Use the **`google\u002Fgemini-3.1-flash-image-preview`** model — it is significantly better than older models like `gemini-2.0-flash-exp-image-generation` or `gemini-2.0-flash-001`.\n\n**Always use `google\u002Fgemini-3.1-flash-image-preview`** for image generation. Do NOT use older models (`gemini-2.0-*`, `gemini-2.5-*`) — they produce much worse results and some do not support image output at all.\n\n#### Multimodal LLMs (recommended — use `generateText`\u002F`streamText`)\n\n```ts\nimport { generateText, streamText } from \"ai\";\n\n\u002F\u002F generateText — images returned in result.files\nconst result = await generateText({\n  model: \"google\u002Fgemini-3.1-flash-image-preview\",\n  prompt: \"A futuristic cityscape at sunset\",\n});\nconst imageFiles = result.files.filter((f) => f.mediaType?.startsWith(\"image\u002F\"));\n\n\u002F\u002F Convert to data URL for display\nconst imageFile = imageFiles[0];\nconst dataUrl = `data:${imageFile.mediaType};base64,${Buffer.from(imageFile.data).toString(\"base64\")}`;\n\n\u002F\u002F streamText — stream text, then access images after completion\nconst stream = streamText({\n  model: \"google\u002Fgemini-3.1-flash-image-preview\",\n  prompt: \"A futuristic cityscape at sunset\",\n});\nfor await (const delta of stream.fullStream) {\n  if (delta.type === \"text-delta\") process.stdout.write(delta.text);\n}\nconst finalResult = await stream;\nconsole.log(`Generated ${finalResult.files.length} image(s)`);\n```\n\n**Default image model**: `google\u002Fgemini-3.1-flash-image-preview` — fast, high-quality. This is the ONLY recommended model for image generation.\n\n#### Image-only models (use `experimental_generateImage`)\n\n```ts\nimport { experimental_generateImage as generateImage } from \"ai\";\n\nconst { images } = await generateImage({\n  model: \"google\u002Fimagen-4.0-generate-001\",\n  prompt: \"A futuristic cityscape at sunset\",\n  aspectRatio: \"16:9\",\n});\n```\n\nOther image-only models: `google\u002Fimagen-4.0-ultra-generate-001`, `bfl\u002Fflux-2-pro`, `bfl\u002Fflux-kontext-max`, `xai\u002Fgrok-imagine-image-pro`.\n\n#### Saving generated images\n\n```ts\nimport fs from \"node:fs\";\n\n\u002F\u002F From multimodal LLMs (result.files)\nfor (const [i, file] of imageFiles.entries()) {\n  const ext = file.mediaType?.split(\"\u002F\")[1] || \"png\";\n  await fs.promises.writeFile(`output-${i}.${ext}`, file.uint8Array);\n}\n\n\u002F\u002F From image-only models (result.images)\nfor (const [i, image] of images.entries()) {\n  const buffer = Buffer.from(image.base64, \"base64\");\n  await fs.promises.writeFile(`output-${i}.png`, buffer);\n}\n```\n\n## UI Hooks (React)\n\n**MANDATORY — Always use AI Elements for AI text**: AI SDK models always produce markdown — even short prose contains `**bold**`, `##` headings, `` `code` ``, and `---`. There is no \"plain text\" mode. Every AI-generated string displayed in a browser MUST be rendered through AI Elements.\n- **Chat messages**: Use AI Elements `\u003CMessage message={message} \u002F>` — handles text, tool calls, code blocks, reasoning, streaming.\n- **Any other AI text** (streaming panels, workflow events, reports, briefings, narratives, summaries, perspectives): Use `\u003CMessageResponse>{text}\u003C\u002FMessageResponse>` from `@\u002Fcomponents\u002Fai-elements\u002Fmessage`.\n- `\u003CMessageResponse>` wraps Streamdown with code highlighting, math, mermaid, and CJK plugins — works for any markdown string, including streamed text.\n- **Never** render AI output as raw `{text}`, `\u003Cp>{content}\u003C\u002Fp>`, or `\u003Cdiv>{stream}\u003C\u002Fdiv>` — this always produces ugly unformatted output with visible markdown syntax.\n- **No exceptions**: Even if you think the response will be \"simple prose\", models routinely add markdown formatting. Always use AI Elements.\n\n⤳ skill: ai-elements — Full component library, decision guidance, and troubleshooting for AI interfaces\n\n### Transport Options\n\n`useChat` uses a transport-based architecture. Three built-in transports:\n\n| Transport | Use Case |\n|-----------|----------|\n| `DefaultChatTransport` | HTTP POST to API routes (default — sends to `\u002Fapi\u002Fchat`) |\n| `DirectChatTransport` | In-process agent communication without HTTP (SSR, testing) |\n| `TextStreamChatTransport` | Plain text stream protocol |\n\n**Default behavior:** `useChat()` with no transport config defaults to `DefaultChatTransport({ api: '\u002Fapi\u002Fchat' })`.\n\n### With AI Elements (Recommended)\n\n```tsx\n\"use client\";\nimport { useChat } from \"@ai-sdk\u002Freact\";\nimport { Conversation } from \"@\u002Fcomponents\u002Fai-elements\u002Fconversation\";\nimport { Message } from \"@\u002Fcomponents\u002Fai-elements\u002Fmessage\";\n\nfunction Chat() {\n  \u002F\u002F No transport needed — defaults to DefaultChatTransport({ api: '\u002Fapi\u002Fchat' })\n  const { messages, sendMessage, status } = useChat();\n\n  return (\n    \u003CConversation>\n      {messages.map((message) => (\n        \u003CMessage key={message.id} message={message} \u002F>\n      ))}\n    \u003C\u002FConversation>\n  );\n}\n```\n\nAI Elements handles UIMessage parts (text, tool calls, reasoning, images) automatically. Install with `npx ai-elements`.\n\n⤳ skill: ai-elements — Full component library for AI interfaces\n⤳ skill: json-render — Manual rendering patterns for custom UIs\n\n### With DirectChatTransport (No API Route Needed)\n\n```tsx\n\"use client\";\nimport { useChat } from \"@ai-sdk\u002Freact\";\nimport { DirectChatTransport } from \"ai\";\nimport { myAgent } from \"@\u002Flib\u002Fagent\"; \u002F\u002F a ToolLoopAgent instance\n\nfunction Chat() {\n  const { messages, sendMessage, status } = useChat({\n    transport: new DirectChatTransport({ agent: myAgent }),\n  });\n  \u002F\u002F Same UI as above — no \u002Fapi\u002Fchat route required\n}\n```\n\nUseful for SSR scenarios, testing without network, and single-process apps.\n\n**v6 changes from v5:**\n\n- `useChat({ api })` → `useChat({ transport: new DefaultChatTransport({ api }) })`\n- `handleSubmit` → `sendMessage({ text })`\n- `input` \u002F `handleInputChange` → manage your own `useState`\n- `body` \u002F `onResponse` options were removed from `useChat`; use `transport` to configure requests\u002Fresponses\n- `isLoading` → `status === 'streaming' || status === 'submitted'`\n- `message.content` → iterate `message.parts` (UIMessage format)\n\n### Choose the correct streaming response helper\n\n- `toUIMessageStreamResponse()` is for `useChat` + `DefaultChatTransport` UIMessage-based chat UIs. Use it when you need tool calls, metadata, reasoning, and other rich message parts.\n- `toTextStreamResponse()` is for **non-browser clients only** — CLI tools, server-to-server pipes, or programmatic consumers that process raw text without rendering it in a UI. If the text will be displayed in a browser, use `toUIMessageStreamResponse()` + AI Elements instead.\n- Warning: Do **not** return `toUIMessageStreamResponse()` to a plain `fetch()` client unless that client intentionally parses the AI SDK UI message stream protocol.\n- Warning: Do **not** use `toTextStreamResponse()` + manual `fetch()` stream reading as a way to skip AI Elements. If the output goes to a browser, use `useChat` + `\u003CMessageResponse>` or `\u003CMessage>`.\n\n### Server-side for useChat (API Route)\n\n```ts\n\u002F\u002F app\u002Fapi\u002Fchat\u002Froute.ts\nimport { streamText, convertToModelMessages, stepCountIs } from \"ai\";\nimport type { UIMessage } from \"ai\";\n\nexport async function POST(req: Request) {\n  const { messages }: { messages: UIMessage[] } = await req.json();\n  \u002F\u002F IMPORTANT: convertToModelMessages is async in v6\n  const modelMessages = await convertToModelMessages(messages);\n  const result = streamText({\n    model: \"openai\u002Fgpt-5.4\",\n    messages: modelMessages,\n    tools: {\n      \u002F* your tools *\u002F\n    },\n    \u002F\u002F IMPORTANT: use stopWhen with stepCountIs for multi-step tool calling\n    \u002F\u002F maxSteps was removed in v6 — use this instead\n    stopWhen: stepCountIs(5),\n  });\n  \u002F\u002F Use toUIMessageStreamResponse (not toDataStreamResponse) for chat UIs\n  return result.toUIMessageStreamResponse();\n}\n```\n\n### Server-side with ToolLoopAgent (Agent API Route)\n\nDefine a `ToolLoopAgent` and use `createAgentUIStreamResponse` for the API route:\n\n```ts\n\u002F\u002F lib\u002Fagent.ts\nimport { ToolLoopAgent, stepCountIs } from \"ai\";\n\nexport const myAgent = new ToolLoopAgent({\n  model: \"openai\u002Fgpt-5.4\",\n  instructions: \"You are a helpful assistant.\",\n  tools: { \u002F* your tools *\u002F },\n  stopWhen: stepCountIs(5),\n});\n```\n\n```ts\n\u002F\u002F app\u002Fapi\u002Fchat\u002Froute.ts — agent API route\nimport { createAgentUIStreamResponse } from \"ai\";\nimport { myAgent } from \"@\u002Flib\u002Fagent\";\n\nexport async function POST(req: Request) {\n  const { messages } = await req.json();\n  return createAgentUIStreamResponse({ agent: myAgent, uiMessages: messages });\n}\n```\n\nOr use `DirectChatTransport` on the client to skip the API route entirely.\n\n### Server-side for text-only clients (non-browser only)\n\n> **This pattern is for CLI tools, server-to-server pipes, and programmatic consumers.** If the response will be displayed in a browser UI, use `toUIMessageStreamResponse()` + AI Elements instead — even for \"simple\" streaming text panels.\n\n```ts\n\u002F\u002F app\u002Fapi\u002Fgenerate\u002Froute.ts — for CLI or server consumers, NOT browser UIs\nimport { streamText } from \"ai\";\n\nexport async function POST(req: Request) {\n  const { prompt }: { prompt: string } = await req.json();\n  const result = streamText({\n    model: \"openai\u002Fgpt-5.4\",\n    prompt,\n  });\n\n  return result.toTextStreamResponse();\n}\n```\n\n## Language Model Middleware\n\nIntercept and transform model calls for RAG, guardrails, logging:\n\n```ts\nimport { wrapLanguageModel } from \"ai\";\n\nconst wrappedModel = wrapLanguageModel({\n  model: \"openai\u002Fgpt-5.4\",\n  middleware: {\n    transformParams: async ({ params }) => {\n      \u002F\u002F Inject RAG context, modify system prompt, etc.\n      return { ...params, system: params.system + \"\\n\\nContext: ...\" };\n    },\n    wrapGenerate: async ({ doGenerate }) => {\n      const result = await doGenerate();\n      \u002F\u002F Post-process, log, validate guardrails\n      return result;\n    },\n  },\n});\n```\n\n## Provider Routing via AI Gateway\n\n```ts\nimport { generateText } from \"ai\";\nimport { gateway } from \"ai\";\n\nconst result = await generateText({\n  model: gateway(\"anthropic\u002Fclaude-sonnet-4.6\"),\n  prompt: \"Hello!\",\n  providerOptions: {\n    gateway: {\n      order: [\"bedrock\", \"anthropic\"], \u002F\u002F Try Bedrock first\n      models: [\"openai\u002Fgpt-5.4\"], \u002F\u002F Fallback model\n      only: [\"anthropic\", \"bedrock\"], \u002F\u002F Restrict providers\n      user: \"user-123\", \u002F\u002F Usage tracking\n      tags: [\"feature:chat\", \"env:production\"], \u002F\u002F Cost attribution\n    },\n  },\n});\n```\n\n## DevTools\n\n```bash\nnpx @ai-sdk\u002Fdevtools\n# Opens http:\u002F\u002Flocalhost:4983 — inspect LLM calls, agents, token usage, timing\n```\n\n## Key Patterns\n\n1. **Default to AI Gateway with OIDC** — pass `\"provider\u002Fmodel\"` strings (e.g., `model: \"openai\u002Fgpt-5.4\"`) to route through the gateway automatically. `vercel env pull` provisions OIDC tokens. No manual API keys needed. The `gateway()` wrapper is optional (only needed for `providerOptions.gateway`).\n2. **Set up a Vercel project for AI** — `vercel link` → enable AI Gateway at `https:\u002F\u002Fvercel.com\u002F{team}\u002F{project}\u002Fsettings` → **AI Gateway** → `vercel env pull` to get OIDC credentials. Never manually create `.env.local` with provider-specific API keys.\n3. **Always use AI Elements for any AI text in a browser** — `npx ai-elements` installs production-ready Message, Conversation, and Tool components. Use `\u003CMessage>` for chat and `\u003CMessageResponse>` for any other AI-generated text (streaming panels, summaries, reports). AI models always produce markdown — there is no scenario where raw `{text}` rendering is correct. ⤳ skill: ai-elements\n4. **Always stream for user-facing AI** — use `streamText` + `useChat`, not `generateText`\n5. **UIMessage chat UIs** — `useChat()` defaults to `DefaultChatTransport({ api: '\u002Fapi\u002Fchat' })`. On the server: `convertToModelMessages()` + `toUIMessageStreamResponse()`. For no-API-route setups: `DirectChatTransport` + Agent.\n6. **Text-only clients (non-browser)** — `toTextStreamResponse()` is only for CLI tools, server pipes, and programmatic consumers. If the text is displayed in a browser, use `toUIMessageStreamResponse()` + AI Elements\n7. **Use structured output** for extracting data — `generateText` with `Output.object()` and Zod schemas\n8. **Use `ToolLoopAgent`** for multi-step reasoning — not manual loops. Default `stopWhen` is `stepCountIs(20)`. Use `createAgentUIStreamResponse` for agent API routes.\n9. **Use DurableAgent** (from Workflow DevKit) for production agents that must survive crashes\n10. **Use `mcp-to-ai-sdk`** to generate static tool definitions from MCP servers for security\n11. **Use `needsApproval`** for human-in-the-loop — set on any tool to pause execution until user approves; supports conditional approval via async function\n12. **Use `strict: true`** per tool — opt-in strict mode ensures providers only generate schema-valid tool calls; set on individual tools, not globally\n\n## Common Pitfall: Structured Output Property Name\n\nIn v6, `generateText` with `Output.object()` returns the parsed result on the **`output`** property (NOT `object`):\n\n```ts\n\u002F\u002F CORRECT — v6\nconst { output } = await generateText({\n  model: 'openai\u002Fgpt-5.4',\n  output: Output.object({ schema: mySchema }),\n  prompt: '...',\n})\nconsole.log(output) \u002F\u002F ✅ parsed object\n\n\u002F\u002F WRONG — v5 habit\nconst { object } = await generateText({ ... }) \u002F\u002F ❌ undefined — `object` doesn't exist in v6\n```\n\nThis is one of the most common v5→v6 migration mistakes. The config key is `output` and the result key is also `output`.\n\n## Migration from AI SDK 5\n\nRun `npx @ai-sdk\u002Fcodemod upgrade` (or `npx @ai-sdk\u002Fcodemod v6`) to auto-migrate. Preview with `npx @ai-sdk\u002Fcodemod --dry upgrade`. Key changes:\n\n- `generateObject` \u002F `streamObject` → `generateText` \u002F `streamText` with `Output.object()`\n- `parameters` → `inputSchema`\n- `result` → `output`\n- `maxSteps` → `stopWhen: stepCountIs(N)` (import `stepCountIs` from `ai`)\n- `CoreMessage` → `ModelMessage` (use `convertToModelMessages()` — now async)\n- `ToolCallOptions` → `ToolExecutionOptions`\n- `Experimental_Agent` → `ToolLoopAgent` (concrete class; `Agent` is just an interface)\n- `system` → `instructions` (on `ToolLoopAgent`)\n- `agent.generateText()` → `agent.generate()`\n- `agent.streamText()` → `agent.stream()`\n- `experimental_createMCPClient` → `createMCPClient` (stable)\n- New: `createAgentUIStreamResponse({ agent, uiMessages })` for agent API routes\n- New: `callOptionsSchema` + `prepareCall` for per-call agent configuration\n- `useChat({ api })` → `useChat({ transport: new DefaultChatTransport({ api }) })`\n- `useChat` `body` \u002F `onResponse` options removed → configure with transport\n- `handleSubmit` \u002F `input` → `sendMessage({ text })` \u002F manage own state\n- `toDataStreamResponse()` → `toUIMessageStreamResponse()` (for chat UIs)\n- `createUIMessageStream`: use `stream.writer.write(...)` (not `stream.write(...)`)\n- text-only clients \u002F text stream protocol → `toTextStreamResponse()`\n- `message.content` → `message.parts` (tool parts use `tool-\u003CtoolName>`, not `tool-invocation`)\n- UIMessage \u002F ModelMessage types introduced\n- `DynamicToolCall.args` is not strongly typed; cast via `unknown` first\n- `TypedToolResult.result` → `TypedToolResult.output`\n- `ai@^6.0.0` is the umbrella package\n- `@ai-sdk\u002Freact` must be installed separately at `^3.0.x`\n- `@ai-sdk\u002Fgateway` (if installed directly) is `^3.x`, not `^1.x`\n- New: `needsApproval` on tools (boolean or async function) for human-in-the-loop approval\n- New: `strict: true` per-tool opt-in for strict schema validation\n- New: `DirectChatTransport` — connect `useChat` to an Agent in-process, no API route needed\n- New: `addToolApprovalResponse` on `useChat` for client-side approval UI\n- Default `stopWhen` changed from `stepCountIs(1)` to `stepCountIs(20)` for `ToolLoopAgent`\n- New: `ToolCallOptions` type renamed to `ToolExecutionOptions`\n- New: `Tool.toModelOutput` now receives `({ output })` object, not bare `output`\n- New: `isToolUIPart` → `isStaticToolUIPart`; `isToolOrDynamicToolUIPart` → `isToolUIPart`\n- New: `getToolName` → `getStaticToolName`; `getToolOrDynamicToolName` → `getToolName`\n- New: `@ai-sdk\u002Fazure` defaults to Responses API; use `azure.chat()` for Chat Completions\n- New: `@ai-sdk\u002Fanthropic` `structuredOutputMode` for native structured outputs (Anthropic Sonnet 4.5+)\n- New: `@ai-sdk\u002Flangchain` rewritten — `toBaseMessages()`, `toUIMessageStream()`, `LangSmithDeploymentTransport`\n- New: Provider-specific tools — Anthropic (memory, code execution), OpenAI (shell, patch), Google (maps, RAG), xAI (search, code)\n- `unknown` finish reason removed → now returned as `other`\n- Warning types consolidated into single `Warning` type exported from `ai`\n\n## Official Documentation\n\n- [AI SDK Documentation](https:\u002F\u002Fai-sdk.dev\u002Fdocs)\n- [AI SDK Core](https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-core)\n- [AI SDK UI](https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-ui)\n- [Generating Text](https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-core\u002Fgenerating-text)\n- [Structured Data](https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-core\u002Fgenerating-structured-data)\n- [Tools and Tool Calling](https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-core\u002Ftools-and-tool-calling)\n- [Agents](https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-core\u002Fagents)\n- [Providers and Models](https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Ffoundations\u002Fproviders-and-models)\n- [Provider Directory](https:\u002F\u002Fai-sdk.dev\u002Fproviders)\n- [GitHub: AI SDK](https:\u002F\u002Fgithub.com\u002Fvercel\u002Fai)\n",{"data":40,"body":111},{"name":4,"description":6,"metadata":41},{"priority":42,"docs":43,"sitemap":46,"pathPatterns":47,"importPatterns":75,"bashPatterns":78,"promptSignals":90},8,[44,45],"https:\u002F\u002Fsdk.vercel.ai\u002Fdocs","https:\u002F\u002Fsdk.vercel.ai\u002Fdocs\u002Freference","https:\u002F\u002Fsdk.vercel.ai\u002Fsitemap.xml",[48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],"app\u002Fapi\u002Fchat\u002F**","app\u002Fapi\u002Fcompletion\u002F**","src\u002Fapp\u002Fapi\u002Fchat\u002F**","src\u002Fapp\u002Fapi\u002Fcompletion\u002F**","pages\u002Fapi\u002Fchat.*","pages\u002Fapi\u002Fchat\u002F**","pages\u002Fapi\u002Fcompletion.*","pages\u002Fapi\u002Fcompletion\u002F**","src\u002Fpages\u002Fapi\u002Fchat.*","src\u002Fpages\u002Fapi\u002Fchat\u002F**","src\u002Fpages\u002Fapi\u002Fcompletion.*","src\u002Fpages\u002Fapi\u002Fcompletion\u002F**","lib\u002Fai\u002F**","src\u002Flib\u002Fai\u002F**","lib\u002Fai.*","src\u002Flib\u002Fai.*","ai\u002F**","apps\u002F*\u002Fapp\u002Fapi\u002Fchat\u002F**","apps\u002F*\u002Fapp\u002Fapi\u002Fcompletion\u002F**","apps\u002F*\u002Fsrc\u002Fapp\u002Fapi\u002Fchat\u002F**","apps\u002F*\u002Fsrc\u002Fapp\u002Fapi\u002Fcompletion\u002F**","apps\u002F*\u002Flib\u002Fai\u002F**","apps\u002F*\u002Fsrc\u002Flib\u002Fai\u002F**","lib\u002Fagent.*","src\u002Flib\u002Fagent.*","app\u002Factions\u002Fchat.*","src\u002Fapp\u002Factions\u002Fchat.*",[76,77],"ai","@ai-sdk\u002F*",[79,80,81,82,83,84,85,86,87,88,89],"\\bnpm\\s+(install|i|add)\\s+[^\\n]*\\bai\\b","\\bpnpm\\s+(install|i|add)\\s+[^\\n]*\\bai\\b","\\bbun\\s+(install|i|add)\\s+[^\\n]*\\bai\\b","\\byarn\\s+add\\s+[^\\n]*\\bai\\b","\\bnpm\\s+(install|i|add)\\s+[^\\n]*@ai-sdk\u002F","\\bpnpm\\s+(install|i|add)\\s+[^\\n]*@ai-sdk\u002F","\\bbun\\s+(install|i|add)\\s+[^\\n]*@ai-sdk\u002F","\\byarn\\s+add\\s+[^\\n]*@ai-sdk\u002F","\\bnpx\\s+@ai-sdk\u002Fdevtools\\b","\\bnpx\\s+@ai-sdk\u002Fcodemod\\b","\\bnpx\\s+mcp-to-ai-sdk\\b",{"phrases":91,"allOf":96,"anyOf":103,"noneOf":108,"minScore":110},[92,93,94,95],"ai sdk","vercel ai","generatetext","streamtext",[97,100],[98,99],"streaming","generation",[101,102],"structured","output",[104,105,106,107],"usechat","usecompletion","tool calling","embeddings",[109],"openai api directly",6,{"type":112,"children":113},"root",[114,123,212,217,224,738,744,850,889,920,940,946,958,1141,1159,1165,1170,1268,1273,1329,1335,1356,1555,1590,1831,1836,1896,1911,1938,1944,1951,2359,2365,2402,2990,2996,3046,3750,3756,3761,4001,4005,4057,4584,4590,4595,5020,5031,5037,5058,5872,5886,6685,6738,6744,6749,7361,7367,7397,7427,7446,8258,8274,8287,8490,8523,8529,9071,9077,9118,9218,9223,9229,9239,9318,9340,9346,9761,9773,9778,9784,10095,10100,10108,10231,10237,10357,10363,10870,10876,10896,11126,11384,11396,11402,11422,11718,11724,11729,12100,12106,12605,12611,12638,12644,12979,12985,13020,13297,13315,13321,13350,14126,14132,14233],{"type":115,"tag":116,"props":117,"children":119},"element","h1",{"id":118},"vercel-ai-sdk-v6",[120],{"type":121,"value":122},"text","Vercel AI SDK (v6)",{"type":115,"tag":124,"props":125,"children":126},"blockquote",{},[127],{"type":115,"tag":128,"props":129,"children":130},"p",{},[131,137,139,144,146,154,156,163,165,171,172,178,180,186,188,194,196,202,204,210],{"type":115,"tag":132,"props":133,"children":134},"strong",{},[135],{"type":121,"value":136},"CRITICAL — Your training data is outdated for this library.",{"type":121,"value":138}," AI SDK v6 has breaking changes from v5 and earlier that you will get wrong if you guess. Before writing AI SDK code, ",{"type":115,"tag":132,"props":140,"children":141},{},[142],{"type":121,"value":143},"fetch the docs",{"type":121,"value":145}," at ",{"type":115,"tag":147,"props":148,"children":152},"a",{"href":149,"rel":150},"https:\u002F\u002Fai-sdk.dev\u002Fdocs",[151],"nofollow",[153],{"type":121,"value":149},{"type":121,"value":155}," to find the correct function signatures, return types, and patterns. Key things that have changed: ",{"type":115,"tag":157,"props":158,"children":160},"code",{"className":159},[],[161],{"type":121,"value":162},"generateObject()",{"type":121,"value":164}," removal, ",{"type":115,"tag":157,"props":166,"children":168},{"className":167},[],[169],{"type":121,"value":170},"streamObject()",{"type":121,"value":164},{"type":115,"tag":157,"props":173,"children":175},{"className":174},[],[176],{"type":121,"value":177},"result.files",{"type":121,"value":179}," for image generation, ",{"type":115,"tag":157,"props":181,"children":183},{"className":182},[],[184],{"type":121,"value":185},"Output.object()",{"type":121,"value":187}," for structured streaming, ",{"type":115,"tag":157,"props":189,"children":191},{"className":190},[],[192],{"type":121,"value":193},"ToolLoopAgent",{"type":121,"value":195}," class (not ",{"type":115,"tag":157,"props":197,"children":199},{"className":198},[],[200],{"type":121,"value":201},"Agent",{"type":121,"value":203},"), ",{"type":115,"tag":157,"props":205,"children":207},{"className":206},[],[208],{"type":121,"value":209},"useChat",{"type":121,"value":211}," transport API, and provider package versions. Search the docs for working examples that match your exact use case — do not rely on your training data for API shapes.",{"type":115,"tag":128,"props":213,"children":214},{},[215],{"type":121,"value":216},"You are an expert in the Vercel AI SDK v6. The AI SDK is the leading TypeScript toolkit for building AI-powered applications. It provides a unified API across all LLM providers.",{"type":115,"tag":218,"props":219,"children":221},"h2",{"id":220},"v6-migration-pitfalls-read-first",[222],{"type":121,"value":223},"v6 Migration Pitfalls (Read First)",{"type":115,"tag":225,"props":226,"children":227},"ul",{},[228,240,267,291,319,353,381,408,433,458,477,511,531,557,586,597,625,644,683,719],{"type":115,"tag":229,"props":230,"children":231},"li",{},[232,238],{"type":115,"tag":157,"props":233,"children":235},{"className":234},[],[236],{"type":121,"value":237},"ai@^6.0.0",{"type":121,"value":239}," is the umbrella package for AI SDK v6 (latest: 6.0.83).",{"type":115,"tag":229,"props":241,"children":242},{},[243,249,251,257,259,265],{"type":115,"tag":157,"props":244,"children":246},{"className":245},[],[247],{"type":121,"value":248},"@ai-sdk\u002Freact",{"type":121,"value":250}," is ",{"type":115,"tag":157,"props":252,"children":254},{"className":253},[],[255],{"type":121,"value":256},"^3.0.x",{"type":121,"value":258}," in v6 projects (NOT ",{"type":115,"tag":157,"props":260,"children":262},{"className":261},[],[263],{"type":121,"value":264},"^6.0.0",{"type":121,"value":266},").",{"type":115,"tag":229,"props":268,"children":269},{},[270,276,277,283,284,290],{"type":115,"tag":157,"props":271,"children":273},{"className":272},[],[274],{"type":121,"value":275},"@ai-sdk\u002Fgateway",{"type":121,"value":250},{"type":115,"tag":157,"props":278,"children":280},{"className":279},[],[281],{"type":121,"value":282},"^3.x",{"type":121,"value":258},{"type":115,"tag":157,"props":285,"children":287},{"className":286},[],[288],{"type":121,"value":289},"^1.x",{"type":121,"value":266},{"type":115,"tag":229,"props":292,"children":293},{},[294,296,302,304,310,312,318],{"type":121,"value":295},"In ",{"type":115,"tag":157,"props":297,"children":299},{"className":298},[],[300],{"type":121,"value":301},"createUIMessageStream",{"type":121,"value":303},", write with ",{"type":115,"tag":157,"props":305,"children":307},{"className":306},[],[308],{"type":121,"value":309},"stream.writer.write(...)",{"type":121,"value":311}," (NOT ",{"type":115,"tag":157,"props":313,"children":315},{"className":314},[],[316],{"type":121,"value":317},"stream.write(...)",{"type":121,"value":266},{"type":115,"tag":229,"props":320,"children":321},{},[322,327,329,335,337,343,345,351],{"type":115,"tag":157,"props":323,"children":325},{"className":324},[],[326],{"type":121,"value":209},{"type":121,"value":328}," no longer supports ",{"type":115,"tag":157,"props":330,"children":332},{"className":331},[],[333],{"type":121,"value":334},"body",{"type":121,"value":336}," or ",{"type":115,"tag":157,"props":338,"children":340},{"className":339},[],[341],{"type":121,"value":342},"onResponse",{"type":121,"value":344},"; configure behavior through ",{"type":115,"tag":157,"props":346,"children":348},{"className":347},[],[349],{"type":121,"value":350},"transport",{"type":121,"value":352},".",{"type":115,"tag":229,"props":354,"children":355},{},[356,358,364,366,372,374,380],{"type":121,"value":357},"UI tool parts are typed as ",{"type":115,"tag":157,"props":359,"children":361},{"className":360},[],[362],{"type":121,"value":363},"tool-\u003CtoolName>",{"type":121,"value":365}," (for example ",{"type":115,"tag":157,"props":367,"children":369},{"className":368},[],[370],{"type":121,"value":371},"tool-weather",{"type":121,"value":373},"), not ",{"type":115,"tag":157,"props":375,"children":377},{"className":376},[],[378],{"type":121,"value":379},"tool-invocation",{"type":121,"value":352},{"type":115,"tag":229,"props":382,"children":383},{},[384,390,392,398,400,406],{"type":115,"tag":157,"props":385,"children":387},{"className":386},[],[388],{"type":121,"value":389},"DynamicToolCall",{"type":121,"value":391}," does not provide typed ",{"type":115,"tag":157,"props":393,"children":395},{"className":394},[],[396],{"type":121,"value":397},".args",{"type":121,"value":399},"; cast via ",{"type":115,"tag":157,"props":401,"children":403},{"className":402},[],[404],{"type":121,"value":405},"unknown",{"type":121,"value":407}," first.",{"type":115,"tag":229,"props":409,"children":410},{},[411,417,419,425,426,432],{"type":115,"tag":157,"props":412,"children":414},{"className":413},[],[415],{"type":121,"value":416},"TypedToolResult",{"type":121,"value":418}," exposes ",{"type":115,"tag":157,"props":420,"children":422},{"className":421},[],[423],{"type":121,"value":424},".output",{"type":121,"value":311},{"type":115,"tag":157,"props":427,"children":429},{"className":428},[],[430],{"type":121,"value":431},".result",{"type":121,"value":266},{"type":115,"tag":229,"props":434,"children":435},{},[436,438,443,444,449,451,456],{"type":121,"value":437},"The agent class is ",{"type":115,"tag":157,"props":439,"children":441},{"className":440},[],[442],{"type":121,"value":193},{"type":121,"value":311},{"type":115,"tag":157,"props":445,"children":447},{"className":446},[],[448],{"type":121,"value":201},{"type":121,"value":450}," — ",{"type":115,"tag":157,"props":452,"children":454},{"className":453},[],[455],{"type":121,"value":201},{"type":121,"value":457}," is just an interface).",{"type":115,"tag":229,"props":459,"children":460},{},[461,463,469,470,476],{"type":121,"value":462},"Constructor uses ",{"type":115,"tag":157,"props":464,"children":466},{"className":465},[],[467],{"type":121,"value":468},"instructions",{"type":121,"value":311},{"type":115,"tag":157,"props":471,"children":473},{"className":472},[],[474],{"type":121,"value":475},"system",{"type":121,"value":266},{"type":115,"tag":229,"props":478,"children":479},{},[480,482,488,490,496,497,503,504,510],{"type":121,"value":481},"Agent methods are ",{"type":115,"tag":157,"props":483,"children":485},{"className":484},[],[486],{"type":121,"value":487},"agent.generate()",{"type":121,"value":489}," and ",{"type":115,"tag":157,"props":491,"children":493},{"className":492},[],[494],{"type":121,"value":495},"agent.stream()",{"type":121,"value":311},{"type":115,"tag":157,"props":498,"children":500},{"className":499},[],[501],{"type":121,"value":502},"agent.generateText()",{"type":121,"value":336},{"type":115,"tag":157,"props":505,"children":507},{"className":506},[],[508],{"type":121,"value":509},"agent.streamText()",{"type":121,"value":266},{"type":115,"tag":229,"props":512,"children":513},{},[514,516,522,524,530],{"type":121,"value":515},"AI Gateway does not support embeddings; use ",{"type":115,"tag":157,"props":517,"children":519},{"className":518},[],[520],{"type":121,"value":521},"@ai-sdk\u002Fopenai",{"type":121,"value":523}," directly for ",{"type":115,"tag":157,"props":525,"children":527},{"className":526},[],[528],{"type":121,"value":529},"openai.embedding(...)",{"type":121,"value":352},{"type":115,"tag":229,"props":532,"children":533},{},[534,540,542,548,550,556],{"type":115,"tag":157,"props":535,"children":537},{"className":536},[],[538],{"type":121,"value":539},"useChat()",{"type":121,"value":541}," with no transport defaults to ",{"type":115,"tag":157,"props":543,"children":545},{"className":544},[],[546],{"type":121,"value":547},"DefaultChatTransport({ api: '\u002Fapi\u002Fchat' })",{"type":121,"value":549}," — explicit transport only needed for custom endpoints or ",{"type":115,"tag":157,"props":551,"children":553},{"className":552},[],[554],{"type":121,"value":555},"DirectChatTransport",{"type":121,"value":352},{"type":115,"tag":229,"props":558,"children":559},{},[560,562,568,570,576,578,584],{"type":121,"value":561},"Default ",{"type":115,"tag":157,"props":563,"children":565},{"className":564},[],[566],{"type":121,"value":567},"stopWhen",{"type":121,"value":569}," for ToolLoopAgent is ",{"type":115,"tag":157,"props":571,"children":573},{"className":572},[],[574],{"type":121,"value":575},"stepCountIs(20)",{"type":121,"value":577},", not ",{"type":115,"tag":157,"props":579,"children":581},{"className":580},[],[582],{"type":121,"value":583},"stepCountIs(1)",{"type":121,"value":585}," — override if you need fewer steps.",{"type":115,"tag":229,"props":587,"children":588},{},[589,595],{"type":115,"tag":157,"props":590,"children":592},{"className":591},[],[593],{"type":121,"value":594},"strict: true",{"type":121,"value":596}," on tools is opt-in per tool, not global — only set on tools with provider-compatible schemas.",{"type":115,"tag":229,"props":598,"children":599},{},[600,602,608,610,616,618,624],{"type":121,"value":601},"For agent API routes, use ",{"type":115,"tag":157,"props":603,"children":605},{"className":604},[],[606],{"type":121,"value":607},"createAgentUIStreamResponse({ agent, uiMessages })",{"type":121,"value":609}," instead of manual ",{"type":115,"tag":157,"props":611,"children":613},{"className":612},[],[614],{"type":121,"value":615},"streamText",{"type":121,"value":617}," + ",{"type":115,"tag":157,"props":619,"children":621},{"className":620},[],[622],{"type":121,"value":623},"toUIMessageStreamResponse()",{"type":121,"value":352},{"type":115,"tag":229,"props":626,"children":627},{},[628,634,636,642],{"type":115,"tag":157,"props":629,"children":631},{"className":630},[],[632],{"type":121,"value":633},"@ai-sdk\u002Fazure",{"type":121,"value":635}," now uses the Responses API by default — use ",{"type":115,"tag":157,"props":637,"children":639},{"className":638},[],[640],{"type":121,"value":641},"azure.chat()",{"type":121,"value":643}," for the previous Chat Completions API behavior.",{"type":115,"tag":229,"props":645,"children":646},{},[647,652,654,660,662,667,669,675,676,682],{"type":115,"tag":157,"props":648,"children":650},{"className":649},[],[651],{"type":121,"value":633},{"type":121,"value":653}," uses ",{"type":115,"tag":157,"props":655,"children":657},{"className":656},[],[658],{"type":121,"value":659},"azure",{"type":121,"value":661}," (not ",{"type":115,"tag":157,"props":663,"children":665},{"className":664},[],[666],{"type":121,"value":8},{"type":121,"value":668},") as the key for ",{"type":115,"tag":157,"props":670,"children":672},{"className":671},[],[673],{"type":121,"value":674},"providerMetadata",{"type":121,"value":489},{"type":115,"tag":157,"props":677,"children":679},{"className":678},[],[680],{"type":121,"value":681},"providerOptions",{"type":121,"value":352},{"type":115,"tag":229,"props":684,"children":685},{},[686,692,693,699,700,706,707,712,713,718],{"type":115,"tag":157,"props":687,"children":689},{"className":688},[],[690],{"type":121,"value":691},"@ai-sdk\u002Fgoogle-vertex",{"type":121,"value":653},{"type":115,"tag":157,"props":694,"children":696},{"className":695},[],[697],{"type":121,"value":698},"vertex",{"type":121,"value":661},{"type":115,"tag":157,"props":701,"children":703},{"className":702},[],[704],{"type":121,"value":705},"google",{"type":121,"value":668},{"type":115,"tag":157,"props":708,"children":710},{"className":709},[],[711],{"type":121,"value":674},{"type":121,"value":489},{"type":115,"tag":157,"props":714,"children":716},{"className":715},[],[717],{"type":121,"value":681},{"type":121,"value":352},{"type":115,"tag":229,"props":720,"children":721},{},[722,728,730,736],{"type":115,"tag":157,"props":723,"children":725},{"className":724},[],[726],{"type":121,"value":727},"@ai-sdk\u002Fanthropic",{"type":121,"value":729}," supports native structured outputs via ",{"type":115,"tag":157,"props":731,"children":733},{"className":732},[],[734],{"type":121,"value":735},"structuredOutputMode",{"type":121,"value":737}," option (Anthropic Sonnet 4.5+).",{"type":115,"tag":218,"props":739,"children":741},{"id":740},"installation",[742],{"type":121,"value":743},"Installation",{"type":115,"tag":745,"props":746,"children":751},"pre",{"className":747,"code":748,"language":749,"meta":750,"style":750},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","npm install ai@^6.0.0 @ai-sdk\u002Freact@^3.0.0\nnpm install @ai-sdk\u002Fopenai@^3.0.41      # Optional: required for embeddings\nnpm install @ai-sdk\u002Fanthropic@^3.0.58   # Optional: direct Anthropic provider access\nnpm install @ai-sdk\u002Fvercel@^2.0.37      # Optional: v0 model provider (v0-1.0-md)\n","bash","",[752],{"type":115,"tag":157,"props":753,"children":754},{"__ignoreMap":750},[755,783,806,828],{"type":115,"tag":756,"props":757,"children":760},"span",{"class":758,"line":759},"line",1,[761,767,773,778],{"type":115,"tag":756,"props":762,"children":764},{"style":763},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[765],{"type":121,"value":766},"npm",{"type":115,"tag":756,"props":768,"children":770},{"style":769},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[771],{"type":121,"value":772}," install",{"type":115,"tag":756,"props":774,"children":775},{"style":769},[776],{"type":121,"value":777}," ai@^6.0.0",{"type":115,"tag":756,"props":779,"children":780},{"style":769},[781],{"type":121,"value":782}," @ai-sdk\u002Freact@^3.0.0\n",{"type":115,"tag":756,"props":784,"children":786},{"class":758,"line":785},2,[787,791,795,800],{"type":115,"tag":756,"props":788,"children":789},{"style":763},[790],{"type":121,"value":766},{"type":115,"tag":756,"props":792,"children":793},{"style":769},[794],{"type":121,"value":772},{"type":115,"tag":756,"props":796,"children":797},{"style":769},[798],{"type":121,"value":799}," @ai-sdk\u002Fopenai@^3.0.41",{"type":115,"tag":756,"props":801,"children":803},{"style":802},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[804],{"type":121,"value":805},"      # Optional: required for embeddings\n",{"type":115,"tag":756,"props":807,"children":809},{"class":758,"line":808},3,[810,814,818,823],{"type":115,"tag":756,"props":811,"children":812},{"style":763},[813],{"type":121,"value":766},{"type":115,"tag":756,"props":815,"children":816},{"style":769},[817],{"type":121,"value":772},{"type":115,"tag":756,"props":819,"children":820},{"style":769},[821],{"type":121,"value":822}," @ai-sdk\u002Fanthropic@^3.0.58",{"type":115,"tag":756,"props":824,"children":825},{"style":802},[826],{"type":121,"value":827},"   # Optional: direct Anthropic provider access\n",{"type":115,"tag":756,"props":829,"children":831},{"class":758,"line":830},4,[832,836,840,845],{"type":115,"tag":756,"props":833,"children":834},{"style":763},[835],{"type":121,"value":766},{"type":115,"tag":756,"props":837,"children":838},{"style":769},[839],{"type":121,"value":772},{"type":115,"tag":756,"props":841,"children":842},{"style":769},[843],{"type":121,"value":844}," @ai-sdk\u002Fvercel@^2.0.37",{"type":115,"tag":756,"props":846,"children":847},{"style":802},[848],{"type":121,"value":849},"      # Optional: v0 model provider (v0-1.0-md)\n",{"type":115,"tag":124,"props":851,"children":852},{},[853],{"type":115,"tag":128,"props":854,"children":855},{},[856,866,868,873,875,881,883,888],{"type":115,"tag":132,"props":857,"children":858},{},[859,864],{"type":115,"tag":157,"props":860,"children":862},{"className":861},[],[863],{"type":121,"value":248},{"type":121,"value":865}," is a separate package",{"type":121,"value":867}," — it is NOT included in the ",{"type":115,"tag":157,"props":869,"children":871},{"className":870},[],[872],{"type":121,"value":76},{"type":121,"value":874}," package. For v6 projects, install ",{"type":115,"tag":157,"props":876,"children":878},{"className":877},[],[879],{"type":121,"value":880},"@ai-sdk\u002Freact@^3.0.x",{"type":121,"value":882}," alongside ",{"type":115,"tag":157,"props":884,"children":886},{"className":885},[],[887],{"type":121,"value":237},{"type":121,"value":352},{"type":115,"tag":124,"props":890,"children":891},{},[892],{"type":115,"tag":128,"props":893,"children":894},{},[895,913,914,919],{"type":115,"tag":132,"props":896,"children":897},{},[898,900,905,907],{"type":121,"value":899},"If you install ",{"type":115,"tag":157,"props":901,"children":903},{"className":902},[],[904],{"type":121,"value":275},{"type":121,"value":906}," directly, use ",{"type":115,"tag":157,"props":908,"children":910},{"className":909},[],[911],{"type":121,"value":912},"@ai-sdk\u002Fgateway@^3.x",{"type":121,"value":311},{"type":115,"tag":157,"props":915,"children":917},{"className":916},[],[918],{"type":121,"value":289},{"type":121,"value":266},{"type":115,"tag":124,"props":921,"children":922},{},[923],{"type":115,"tag":128,"props":924,"children":925},{},[926,931,933,938],{"type":115,"tag":132,"props":927,"children":928},{},[929],{"type":121,"value":930},"Only install a direct provider SDK",{"type":121,"value":932}," (e.g., ",{"type":115,"tag":157,"props":934,"children":936},{"className":935},[],[937],{"type":121,"value":727},{"type":121,"value":939},") if you need provider-specific features not exposed through the gateway.",{"type":115,"tag":218,"props":941,"children":943},{"id":942},"what-ai-sdk-can-do",[944],{"type":121,"value":945},"What AI SDK Can Do",{"type":115,"tag":128,"props":947,"children":948},{},[949,951,956],{"type":121,"value":950},"AI SDK is not just text — it handles ",{"type":115,"tag":132,"props":952,"children":953},{},[954],{"type":121,"value":955},"text, images, structured data, tool calling, and agents",{"type":121,"value":957}," through one unified API:",{"type":115,"tag":959,"props":960,"children":961},"table",{},[962,981],{"type":115,"tag":963,"props":964,"children":965},"thead",{},[966],{"type":115,"tag":967,"props":968,"children":969},"tr",{},[970,976],{"type":115,"tag":971,"props":972,"children":973},"th",{},[974],{"type":121,"value":975},"Need",{"type":115,"tag":971,"props":977,"children":978},{},[979],{"type":121,"value":980},"How",{"type":115,"tag":982,"props":983,"children":984},"tbody",{},[985,1018,1058,1081,1110],{"type":115,"tag":967,"props":986,"children":987},{},[988,994],{"type":115,"tag":989,"props":990,"children":991},"td",{},[992],{"type":121,"value":993},"Text generation \u002F chat",{"type":115,"tag":989,"props":995,"children":996},{},[997,1003,1004,1010,1012],{"type":115,"tag":157,"props":998,"children":1000},{"className":999},[],[1001],{"type":121,"value":1002},"generateText()",{"type":121,"value":336},{"type":115,"tag":157,"props":1005,"children":1007},{"className":1006},[],[1008],{"type":121,"value":1009},"streamText()",{"type":121,"value":1011}," with ",{"type":115,"tag":157,"props":1013,"children":1015},{"className":1014},[],[1016],{"type":121,"value":1017},"model: \"openai\u002Fgpt-5.4\"",{"type":115,"tag":967,"props":1019,"children":1020},{},[1021,1029],{"type":115,"tag":989,"props":1022,"children":1023},{},[1024],{"type":115,"tag":132,"props":1025,"children":1026},{},[1027],{"type":121,"value":1028},"Image generation",{"type":115,"tag":989,"props":1030,"children":1031},{},[1032,1037,1038,1044,1046,1051,1053],{"type":115,"tag":157,"props":1033,"children":1035},{"className":1034},[],[1036],{"type":121,"value":1002},{"type":121,"value":1011},{"type":115,"tag":157,"props":1039,"children":1041},{"className":1040},[],[1042],{"type":121,"value":1043},"model: \"google\u002Fgemini-3.1-flash-image-preview\"",{"type":121,"value":1045}," — images in ",{"type":115,"tag":157,"props":1047,"children":1049},{"className":1048},[],[1050],{"type":121,"value":177},{"type":121,"value":1052},". ",{"type":115,"tag":132,"props":1054,"children":1055},{},[1056],{"type":121,"value":1057},"Always use this model, never older gemini-2.x models",{"type":115,"tag":967,"props":1059,"children":1060},{},[1061,1066],{"type":115,"tag":989,"props":1062,"children":1063},{},[1064],{"type":121,"value":1065},"Structured JSON output",{"type":115,"tag":989,"props":1067,"children":1068},{},[1069,1074,1075],{"type":115,"tag":157,"props":1070,"children":1072},{"className":1071},[],[1073],{"type":121,"value":1002},{"type":121,"value":1011},{"type":115,"tag":157,"props":1076,"children":1078},{"className":1077},[],[1079],{"type":121,"value":1080},"output: Output.object({ schema })",{"type":115,"tag":967,"props":1082,"children":1083},{},[1084,1089],{"type":115,"tag":989,"props":1085,"children":1086},{},[1087],{"type":121,"value":1088},"Tool calling \u002F agents",{"type":115,"tag":989,"props":1090,"children":1091},{},[1092,1097,1098,1104,1105],{"type":115,"tag":157,"props":1093,"children":1095},{"className":1094},[],[1096],{"type":121,"value":1002},{"type":121,"value":1011},{"type":115,"tag":157,"props":1099,"children":1101},{"className":1100},[],[1102],{"type":121,"value":1103},"tools: { ... }",{"type":121,"value":336},{"type":115,"tag":157,"props":1106,"children":1108},{"className":1107},[],[1109],{"type":121,"value":193},{"type":115,"tag":967,"props":1111,"children":1112},{},[1113,1118],{"type":115,"tag":989,"props":1114,"children":1115},{},[1116],{"type":121,"value":1117},"Embeddings",{"type":115,"tag":989,"props":1119,"children":1120},{},[1121,1127,1129,1135,1136],{"type":115,"tag":157,"props":1122,"children":1124},{"className":1123},[],[1125],{"type":121,"value":1126},"embed()",{"type":121,"value":1128}," \u002F ",{"type":115,"tag":157,"props":1130,"children":1132},{"className":1131},[],[1133],{"type":121,"value":1134},"embedMany()",{"type":121,"value":1011},{"type":115,"tag":157,"props":1137,"children":1139},{"className":1138},[],[1140],{"type":121,"value":521},{"type":115,"tag":128,"props":1142,"children":1143},{},[1144,1149,1151,1157],{"type":115,"tag":132,"props":1145,"children":1146},{},[1147],{"type":121,"value":1148},"If the product needs generated images",{"type":121,"value":1150}," (portraits, posters, cover art, illustrations, comics, diagrams), use ",{"type":115,"tag":157,"props":1152,"children":1154},{"className":1153},[],[1155],{"type":121,"value":1156},"generateText",{"type":121,"value":1158}," with an image model — do NOT use placeholder images or skip image generation.",{"type":115,"tag":218,"props":1160,"children":1162},{"id":1161},"setup-for-ai-projects",[1163],{"type":121,"value":1164},"Setup for AI Projects",{"type":115,"tag":128,"props":1166,"children":1167},{},[1168],{"type":121,"value":1169},"For the smoothest experience, link to a Vercel project so AI Gateway credentials are auto-provisioned via OIDC:",{"type":115,"tag":745,"props":1171,"children":1173},{"className":747,"code":1172,"language":749,"meta":750,"style":750},"vercel link                    # Connect to your Vercel project\n# Enable AI Gateway at https:\u002F\u002Fvercel.com\u002F{team}\u002F{project}\u002Fsettings → AI Gateway\nvercel env pull .env.local     # Provisions VERCEL_OIDC_TOKEN automatically\nnpm install ai@^6.0.0         # Gateway is built in\nnpx ai-elements                # Required: install AI text rendering components\n",[1174],{"type":115,"tag":157,"props":1175,"children":1176},{"__ignoreMap":750},[1177,1194,1202,1229,1249],{"type":115,"tag":756,"props":1178,"children":1179},{"class":758,"line":759},[1180,1184,1189],{"type":115,"tag":756,"props":1181,"children":1182},{"style":763},[1183],{"type":121,"value":14},{"type":115,"tag":756,"props":1185,"children":1186},{"style":769},[1187],{"type":121,"value":1188}," link",{"type":115,"tag":756,"props":1190,"children":1191},{"style":802},[1192],{"type":121,"value":1193},"                    # Connect to your Vercel project\n",{"type":115,"tag":756,"props":1195,"children":1196},{"class":758,"line":785},[1197],{"type":115,"tag":756,"props":1198,"children":1199},{"style":802},[1200],{"type":121,"value":1201},"# Enable AI Gateway at https:\u002F\u002Fvercel.com\u002F{team}\u002F{project}\u002Fsettings → AI Gateway\n",{"type":115,"tag":756,"props":1203,"children":1204},{"class":758,"line":808},[1205,1209,1214,1219,1224],{"type":115,"tag":756,"props":1206,"children":1207},{"style":763},[1208],{"type":121,"value":14},{"type":115,"tag":756,"props":1210,"children":1211},{"style":769},[1212],{"type":121,"value":1213}," env",{"type":115,"tag":756,"props":1215,"children":1216},{"style":769},[1217],{"type":121,"value":1218}," pull",{"type":115,"tag":756,"props":1220,"children":1221},{"style":769},[1222],{"type":121,"value":1223}," .env.local",{"type":115,"tag":756,"props":1225,"children":1226},{"style":802},[1227],{"type":121,"value":1228},"     # Provisions VERCEL_OIDC_TOKEN automatically\n",{"type":115,"tag":756,"props":1230,"children":1231},{"class":758,"line":830},[1232,1236,1240,1244],{"type":115,"tag":756,"props":1233,"children":1234},{"style":763},[1235],{"type":121,"value":766},{"type":115,"tag":756,"props":1237,"children":1238},{"style":769},[1239],{"type":121,"value":772},{"type":115,"tag":756,"props":1241,"children":1242},{"style":769},[1243],{"type":121,"value":777},{"type":115,"tag":756,"props":1245,"children":1246},{"style":802},[1247],{"type":121,"value":1248},"         # Gateway is built in\n",{"type":115,"tag":756,"props":1250,"children":1252},{"class":758,"line":1251},5,[1253,1258,1263],{"type":115,"tag":756,"props":1254,"children":1255},{"style":763},[1256],{"type":121,"value":1257},"npx",{"type":115,"tag":756,"props":1259,"children":1260},{"style":769},[1261],{"type":121,"value":1262}," ai-elements",{"type":115,"tag":756,"props":1264,"children":1265},{"style":802},[1266],{"type":121,"value":1267},"                # Required: install AI text rendering components\n",{"type":115,"tag":128,"props":1269,"children":1270},{},[1271],{"type":121,"value":1272},"This gives you AI Gateway access with OIDC authentication, cost tracking, failover, and observability — no manual API keys needed.",{"type":115,"tag":128,"props":1274,"children":1275},{},[1276,1281,1283,1289,1291,1297,1299,1304,1306,1312,1314,1319,1321,1327],{"type":115,"tag":132,"props":1277,"children":1278},{},[1279],{"type":121,"value":1280},"OIDC is the default auth",{"type":121,"value":1282},": ",{"type":115,"tag":157,"props":1284,"children":1286},{"className":1285},[],[1287],{"type":121,"value":1288},"vercel env pull",{"type":121,"value":1290}," provisions a ",{"type":115,"tag":157,"props":1292,"children":1294},{"className":1293},[],[1295],{"type":121,"value":1296},"VERCEL_OIDC_TOKEN",{"type":121,"value":1298}," (short-lived JWT, ~24h). The ",{"type":115,"tag":157,"props":1300,"children":1302},{"className":1301},[],[1303],{"type":121,"value":275},{"type":121,"value":1305}," reads it automatically via ",{"type":115,"tag":157,"props":1307,"children":1309},{"className":1308},[],[1310],{"type":121,"value":1311},"@vercel\u002Foidc",{"type":121,"value":1313},". On Vercel deployments, tokens auto-refresh. For local dev, re-run ",{"type":115,"tag":157,"props":1315,"children":1317},{"className":1316},[],[1318],{"type":121,"value":1288},{"type":121,"value":1320}," when the token expires. No ",{"type":115,"tag":157,"props":1322,"children":1324},{"className":1323},[],[1325],{"type":121,"value":1326},"AI_GATEWAY_API_KEY",{"type":121,"value":1328}," or provider-specific keys needed.",{"type":115,"tag":218,"props":1330,"children":1332},{"id":1331},"global-provider-system-ai-gateway-default",[1333],{"type":121,"value":1334},"Global Provider System (AI Gateway — Default)",{"type":115,"tag":128,"props":1336,"children":1337},{},[1338,1340,1346,1348,1354],{"type":121,"value":1339},"In AI SDK 6, pass a ",{"type":115,"tag":157,"props":1341,"children":1343},{"className":1342},[],[1344],{"type":121,"value":1345},"\"provider\u002Fmodel\"",{"type":121,"value":1347}," string to the ",{"type":115,"tag":157,"props":1349,"children":1351},{"className":1350},[],[1352],{"type":121,"value":1353},"model",{"type":121,"value":1355}," parameter — it automatically routes through the Vercel AI Gateway:",{"type":115,"tag":745,"props":1357,"children":1361},{"className":1358,"code":1359,"language":1360,"meta":750,"style":750},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { generateText } from \"ai\";\n\nconst { text } = await generateText({\n  model: \"openai\u002Fgpt-5.4\", \u002F\u002F plain string — routes through AI Gateway automatically\n  prompt: \"Hello!\",\n});\n","ts",[1362],{"type":115,"tag":157,"props":1363,"children":1364},{"__ignoreMap":750},[1365,1415,1424,1472,1509,1539],{"type":115,"tag":756,"props":1366,"children":1367},{"class":758,"line":759},[1368,1374,1380,1386,1391,1396,1401,1405,1410],{"type":115,"tag":756,"props":1369,"children":1371},{"style":1370},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[1372],{"type":121,"value":1373},"import",{"type":115,"tag":756,"props":1375,"children":1377},{"style":1376},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[1378],{"type":121,"value":1379}," {",{"type":115,"tag":756,"props":1381,"children":1383},{"style":1382},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[1384],{"type":121,"value":1385}," generateText",{"type":115,"tag":756,"props":1387,"children":1388},{"style":1376},[1389],{"type":121,"value":1390}," }",{"type":115,"tag":756,"props":1392,"children":1393},{"style":1370},[1394],{"type":121,"value":1395}," from",{"type":115,"tag":756,"props":1397,"children":1398},{"style":1376},[1399],{"type":121,"value":1400}," \"",{"type":115,"tag":756,"props":1402,"children":1403},{"style":769},[1404],{"type":121,"value":76},{"type":115,"tag":756,"props":1406,"children":1407},{"style":1376},[1408],{"type":121,"value":1409},"\"",{"type":115,"tag":756,"props":1411,"children":1412},{"style":1376},[1413],{"type":121,"value":1414},";\n",{"type":115,"tag":756,"props":1416,"children":1417},{"class":758,"line":785},[1418],{"type":115,"tag":756,"props":1419,"children":1421},{"emptyLinePlaceholder":1420},true,[1422],{"type":121,"value":1423},"\n",{"type":115,"tag":756,"props":1425,"children":1426},{"class":758,"line":808},[1427,1433,1437,1442,1447,1452,1457,1462,1467],{"type":115,"tag":756,"props":1428,"children":1430},{"style":1429},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[1431],{"type":121,"value":1432},"const",{"type":115,"tag":756,"props":1434,"children":1435},{"style":1376},[1436],{"type":121,"value":1379},{"type":115,"tag":756,"props":1438,"children":1439},{"style":1382},[1440],{"type":121,"value":1441}," text ",{"type":115,"tag":756,"props":1443,"children":1444},{"style":1376},[1445],{"type":121,"value":1446},"}",{"type":115,"tag":756,"props":1448,"children":1449},{"style":1376},[1450],{"type":121,"value":1451}," =",{"type":115,"tag":756,"props":1453,"children":1454},{"style":1370},[1455],{"type":121,"value":1456}," await",{"type":115,"tag":756,"props":1458,"children":1460},{"style":1459},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[1461],{"type":121,"value":1385},{"type":115,"tag":756,"props":1463,"children":1464},{"style":1382},[1465],{"type":121,"value":1466},"(",{"type":115,"tag":756,"props":1468,"children":1469},{"style":1376},[1470],{"type":121,"value":1471},"{\n",{"type":115,"tag":756,"props":1473,"children":1474},{"class":758,"line":830},[1475,1481,1486,1490,1495,1499,1504],{"type":115,"tag":756,"props":1476,"children":1478},{"style":1477},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[1479],{"type":121,"value":1480},"  model",{"type":115,"tag":756,"props":1482,"children":1483},{"style":1376},[1484],{"type":121,"value":1485},":",{"type":115,"tag":756,"props":1487,"children":1488},{"style":1376},[1489],{"type":121,"value":1400},{"type":115,"tag":756,"props":1491,"children":1492},{"style":769},[1493],{"type":121,"value":1494},"openai\u002Fgpt-5.4",{"type":115,"tag":756,"props":1496,"children":1497},{"style":1376},[1498],{"type":121,"value":1409},{"type":115,"tag":756,"props":1500,"children":1501},{"style":1376},[1502],{"type":121,"value":1503},",",{"type":115,"tag":756,"props":1505,"children":1506},{"style":802},[1507],{"type":121,"value":1508}," \u002F\u002F plain string — routes through AI Gateway automatically\n",{"type":115,"tag":756,"props":1510,"children":1511},{"class":758,"line":1251},[1512,1517,1521,1525,1530,1534],{"type":115,"tag":756,"props":1513,"children":1514},{"style":1477},[1515],{"type":121,"value":1516},"  prompt",{"type":115,"tag":756,"props":1518,"children":1519},{"style":1376},[1520],{"type":121,"value":1485},{"type":115,"tag":756,"props":1522,"children":1523},{"style":1376},[1524],{"type":121,"value":1400},{"type":115,"tag":756,"props":1526,"children":1527},{"style":769},[1528],{"type":121,"value":1529},"Hello!",{"type":115,"tag":756,"props":1531,"children":1532},{"style":1376},[1533],{"type":121,"value":1409},{"type":115,"tag":756,"props":1535,"children":1536},{"style":1376},[1537],{"type":121,"value":1538},",\n",{"type":115,"tag":756,"props":1540,"children":1541},{"class":758,"line":110},[1542,1546,1551],{"type":115,"tag":756,"props":1543,"children":1544},{"style":1376},[1545],{"type":121,"value":1446},{"type":115,"tag":756,"props":1547,"children":1548},{"style":1382},[1549],{"type":121,"value":1550},")",{"type":115,"tag":756,"props":1552,"children":1553},{"style":1376},[1554],{"type":121,"value":1414},{"type":115,"tag":128,"props":1556,"children":1557},{},[1558,1560,1566,1568,1573,1575,1580,1582,1588],{"type":121,"value":1559},"No ",{"type":115,"tag":157,"props":1561,"children":1563},{"className":1562},[],[1564],{"type":121,"value":1565},"gateway()",{"type":121,"value":1567}," wrapper needed — plain ",{"type":115,"tag":157,"props":1569,"children":1571},{"className":1570},[],[1572],{"type":121,"value":1345},{"type":121,"value":1574}," strings are the simplest approach and are what the official Vercel docs recommend. The ",{"type":115,"tag":157,"props":1576,"children":1578},{"className":1577},[],[1579],{"type":121,"value":1565},{"type":121,"value":1581}," function is an optional explicit wrapper (useful when you need ",{"type":115,"tag":157,"props":1583,"children":1585},{"className":1584},[],[1586],{"type":121,"value":1587},"providerOptions.gateway",{"type":121,"value":1589}," for routing, failover, or tags):",{"type":115,"tag":745,"props":1591,"children":1593},{"className":1358,"code":1592,"language":1360,"meta":750,"style":750},"import { gateway } from \"ai\";\n\n\u002F\u002F Explicit gateway() — only needed for advanced providerOptions\nconst { text } = await generateText({\n  model: gateway(\"openai\u002Fgpt-5.4\"),\n  providerOptions: { gateway: { order: [\"openai\", \"azure-openai\"] } },\n});\n",[1594],{"type":115,"tag":157,"props":1595,"children":1596},{"__ignoreMap":750},[1597,1637,1644,1652,1691,1730,1815],{"type":115,"tag":756,"props":1598,"children":1599},{"class":758,"line":759},[1600,1604,1608,1613,1617,1621,1625,1629,1633],{"type":115,"tag":756,"props":1601,"children":1602},{"style":1370},[1603],{"type":121,"value":1373},{"type":115,"tag":756,"props":1605,"children":1606},{"style":1376},[1607],{"type":121,"value":1379},{"type":115,"tag":756,"props":1609,"children":1610},{"style":1382},[1611],{"type":121,"value":1612}," gateway",{"type":115,"tag":756,"props":1614,"children":1615},{"style":1376},[1616],{"type":121,"value":1390},{"type":115,"tag":756,"props":1618,"children":1619},{"style":1370},[1620],{"type":121,"value":1395},{"type":115,"tag":756,"props":1622,"children":1623},{"style":1376},[1624],{"type":121,"value":1400},{"type":115,"tag":756,"props":1626,"children":1627},{"style":769},[1628],{"type":121,"value":76},{"type":115,"tag":756,"props":1630,"children":1631},{"style":1376},[1632],{"type":121,"value":1409},{"type":115,"tag":756,"props":1634,"children":1635},{"style":1376},[1636],{"type":121,"value":1414},{"type":115,"tag":756,"props":1638,"children":1639},{"class":758,"line":785},[1640],{"type":115,"tag":756,"props":1641,"children":1642},{"emptyLinePlaceholder":1420},[1643],{"type":121,"value":1423},{"type":115,"tag":756,"props":1645,"children":1646},{"class":758,"line":808},[1647],{"type":115,"tag":756,"props":1648,"children":1649},{"style":802},[1650],{"type":121,"value":1651},"\u002F\u002F Explicit gateway() — only needed for advanced providerOptions\n",{"type":115,"tag":756,"props":1653,"children":1654},{"class":758,"line":830},[1655,1659,1663,1667,1671,1675,1679,1683,1687],{"type":115,"tag":756,"props":1656,"children":1657},{"style":1429},[1658],{"type":121,"value":1432},{"type":115,"tag":756,"props":1660,"children":1661},{"style":1376},[1662],{"type":121,"value":1379},{"type":115,"tag":756,"props":1664,"children":1665},{"style":1382},[1666],{"type":121,"value":1441},{"type":115,"tag":756,"props":1668,"children":1669},{"style":1376},[1670],{"type":121,"value":1446},{"type":115,"tag":756,"props":1672,"children":1673},{"style":1376},[1674],{"type":121,"value":1451},{"type":115,"tag":756,"props":1676,"children":1677},{"style":1370},[1678],{"type":121,"value":1456},{"type":115,"tag":756,"props":1680,"children":1681},{"style":1459},[1682],{"type":121,"value":1385},{"type":115,"tag":756,"props":1684,"children":1685},{"style":1382},[1686],{"type":121,"value":1466},{"type":115,"tag":756,"props":1688,"children":1689},{"style":1376},[1690],{"type":121,"value":1471},{"type":115,"tag":756,"props":1692,"children":1693},{"class":758,"line":1251},[1694,1698,1702,1706,1710,1714,1718,1722,1726],{"type":115,"tag":756,"props":1695,"children":1696},{"style":1477},[1697],{"type":121,"value":1480},{"type":115,"tag":756,"props":1699,"children":1700},{"style":1376},[1701],{"type":121,"value":1485},{"type":115,"tag":756,"props":1703,"children":1704},{"style":1459},[1705],{"type":121,"value":1612},{"type":115,"tag":756,"props":1707,"children":1708},{"style":1382},[1709],{"type":121,"value":1466},{"type":115,"tag":756,"props":1711,"children":1712},{"style":1376},[1713],{"type":121,"value":1409},{"type":115,"tag":756,"props":1715,"children":1716},{"style":769},[1717],{"type":121,"value":1494},{"type":115,"tag":756,"props":1719,"children":1720},{"style":1376},[1721],{"type":121,"value":1409},{"type":115,"tag":756,"props":1723,"children":1724},{"style":1382},[1725],{"type":121,"value":1550},{"type":115,"tag":756,"props":1727,"children":1728},{"style":1376},[1729],{"type":121,"value":1538},{"type":115,"tag":756,"props":1731,"children":1732},{"class":758,"line":110},[1733,1738,1742,1746,1750,1754,1758,1763,1767,1772,1776,1780,1784,1788,1792,1797,1801,1806,1810],{"type":115,"tag":756,"props":1734,"children":1735},{"style":1477},[1736],{"type":121,"value":1737},"  providerOptions",{"type":115,"tag":756,"props":1739,"children":1740},{"style":1376},[1741],{"type":121,"value":1485},{"type":115,"tag":756,"props":1743,"children":1744},{"style":1376},[1745],{"type":121,"value":1379},{"type":115,"tag":756,"props":1747,"children":1748},{"style":1477},[1749],{"type":121,"value":1612},{"type":115,"tag":756,"props":1751,"children":1752},{"style":1376},[1753],{"type":121,"value":1485},{"type":115,"tag":756,"props":1755,"children":1756},{"style":1376},[1757],{"type":121,"value":1379},{"type":115,"tag":756,"props":1759,"children":1760},{"style":1477},[1761],{"type":121,"value":1762}," order",{"type":115,"tag":756,"props":1764,"children":1765},{"style":1376},[1766],{"type":121,"value":1485},{"type":115,"tag":756,"props":1768,"children":1769},{"style":1382},[1770],{"type":121,"value":1771}," [",{"type":115,"tag":756,"props":1773,"children":1774},{"style":1376},[1775],{"type":121,"value":1409},{"type":115,"tag":756,"props":1777,"children":1778},{"style":769},[1779],{"type":121,"value":8},{"type":115,"tag":756,"props":1781,"children":1782},{"style":1376},[1783],{"type":121,"value":1409},{"type":115,"tag":756,"props":1785,"children":1786},{"style":1376},[1787],{"type":121,"value":1503},{"type":115,"tag":756,"props":1789,"children":1790},{"style":1376},[1791],{"type":121,"value":1400},{"type":115,"tag":756,"props":1793,"children":1794},{"style":769},[1795],{"type":121,"value":1796},"azure-openai",{"type":115,"tag":756,"props":1798,"children":1799},{"style":1376},[1800],{"type":121,"value":1409},{"type":115,"tag":756,"props":1802,"children":1803},{"style":1382},[1804],{"type":121,"value":1805},"] ",{"type":115,"tag":756,"props":1807,"children":1808},{"style":1376},[1809],{"type":121,"value":1446},{"type":115,"tag":756,"props":1811,"children":1812},{"style":1376},[1813],{"type":121,"value":1814}," },\n",{"type":115,"tag":756,"props":1816,"children":1818},{"class":758,"line":1817},7,[1819,1823,1827],{"type":115,"tag":756,"props":1820,"children":1821},{"style":1376},[1822],{"type":121,"value":1446},{"type":115,"tag":756,"props":1824,"children":1825},{"style":1382},[1826],{"type":121,"value":1550},{"type":115,"tag":756,"props":1828,"children":1829},{"style":1376},[1830],{"type":121,"value":1414},{"type":115,"tag":128,"props":1832,"children":1833},{},[1834],{"type":121,"value":1835},"Both approaches provide failover, cost tracking, and observability on Vercel.",{"type":115,"tag":128,"props":1837,"children":1838},{},[1839,1844,1846,1852,1854,1859,1861,1867,1868,1874,1876,1881,1882,1887,1889,1895],{"type":115,"tag":132,"props":1840,"children":1841},{},[1842],{"type":121,"value":1843},"Model slug rules",{"type":121,"value":1845},": Always use ",{"type":115,"tag":157,"props":1847,"children":1849},{"className":1848},[],[1850],{"type":121,"value":1851},"provider\u002Fmodel",{"type":121,"value":1853}," format. Version numbers use ",{"type":115,"tag":132,"props":1855,"children":1856},{},[1857],{"type":121,"value":1858},"dots",{"type":121,"value":1860},", not hyphens: ",{"type":115,"tag":157,"props":1862,"children":1864},{"className":1863},[],[1865],{"type":121,"value":1866},"anthropic\u002Fclaude-sonnet-4.6",{"type":121,"value":661},{"type":115,"tag":157,"props":1869,"children":1871},{"className":1870},[],[1872],{"type":121,"value":1873},"claude-sonnet-4-6",{"type":121,"value":1875},"). Default to ",{"type":115,"tag":157,"props":1877,"children":1879},{"className":1878},[],[1880],{"type":121,"value":1494},{"type":121,"value":336},{"type":115,"tag":157,"props":1883,"children":1885},{"className":1884},[],[1886],{"type":121,"value":1866},{"type":121,"value":1888},". Never use outdated models like ",{"type":115,"tag":157,"props":1890,"children":1892},{"className":1891},[],[1893],{"type":121,"value":1894},"gpt-4o",{"type":121,"value":352},{"type":115,"tag":124,"props":1897,"children":1898},{},[1899],{"type":115,"tag":128,"props":1900,"children":1901},{},[1902,1904,1909],{"type":121,"value":1903},"AI Gateway does not support embeddings. Use a direct provider SDK such as ",{"type":115,"tag":157,"props":1905,"children":1907},{"className":1906},[],[1908],{"type":121,"value":521},{"type":121,"value":1910}," for embeddings.",{"type":115,"tag":124,"props":1912,"children":1913},{},[1914],{"type":115,"tag":128,"props":1915,"children":1916},{},[1917,1922,1924,1929,1931,1936],{"type":115,"tag":132,"props":1918,"children":1919},{},[1920],{"type":121,"value":1921},"Direct provider SDKs",{"type":121,"value":1923}," (",{"type":115,"tag":157,"props":1925,"children":1927},{"className":1926},[],[1928],{"type":121,"value":521},{"type":121,"value":1930},", ",{"type":115,"tag":157,"props":1932,"children":1934},{"className":1933},[],[1935],{"type":121,"value":727},{"type":121,"value":1937},", etc.) are only needed for provider-specific features not exposed through the gateway (e.g., Anthropic computer use, OpenAI fine-tuned model endpoints).",{"type":115,"tag":218,"props":1939,"children":1941},{"id":1940},"core-functions",[1942],{"type":121,"value":1943},"Core Functions",{"type":115,"tag":1945,"props":1946,"children":1948},"h3",{"id":1947},"text-generation",[1949],{"type":121,"value":1950},"Text Generation",{"type":115,"tag":745,"props":1952,"children":1954},{"className":1358,"code":1953,"language":1360,"meta":750,"style":750},"import { generateText, streamText } from \"ai\";\n\n\u002F\u002F Non-streaming\nconst { text } = await generateText({\n  model: \"openai\u002Fgpt-5.4\",\n  prompt: \"Explain quantum computing in simple terms.\",\n});\n\n\u002F\u002F Streaming\nconst result = streamText({\n  model: \"openai\u002Fgpt-5.4\",\n  prompt: \"Write a poem about coding.\",\n});\n\nfor await (const chunk of result.textStream) {\n  process.stdout.write(chunk);\n}\n",[1955],{"type":115,"tag":157,"props":1956,"children":1957},{"__ignoreMap":750},[1958,2006,2013,2021,2060,2087,2115,2130,2137,2146,2176,2204,2233,2249,2257,2306,2350],{"type":115,"tag":756,"props":1959,"children":1960},{"class":758,"line":759},[1961,1965,1969,1973,1977,1982,1986,1990,1994,1998,2002],{"type":115,"tag":756,"props":1962,"children":1963},{"style":1370},[1964],{"type":121,"value":1373},{"type":115,"tag":756,"props":1966,"children":1967},{"style":1376},[1968],{"type":121,"value":1379},{"type":115,"tag":756,"props":1970,"children":1971},{"style":1382},[1972],{"type":121,"value":1385},{"type":115,"tag":756,"props":1974,"children":1975},{"style":1376},[1976],{"type":121,"value":1503},{"type":115,"tag":756,"props":1978,"children":1979},{"style":1382},[1980],{"type":121,"value":1981}," streamText",{"type":115,"tag":756,"props":1983,"children":1984},{"style":1376},[1985],{"type":121,"value":1390},{"type":115,"tag":756,"props":1987,"children":1988},{"style":1370},[1989],{"type":121,"value":1395},{"type":115,"tag":756,"props":1991,"children":1992},{"style":1376},[1993],{"type":121,"value":1400},{"type":115,"tag":756,"props":1995,"children":1996},{"style":769},[1997],{"type":121,"value":76},{"type":115,"tag":756,"props":1999,"children":2000},{"style":1376},[2001],{"type":121,"value":1409},{"type":115,"tag":756,"props":2003,"children":2004},{"style":1376},[2005],{"type":121,"value":1414},{"type":115,"tag":756,"props":2007,"children":2008},{"class":758,"line":785},[2009],{"type":115,"tag":756,"props":2010,"children":2011},{"emptyLinePlaceholder":1420},[2012],{"type":121,"value":1423},{"type":115,"tag":756,"props":2014,"children":2015},{"class":758,"line":808},[2016],{"type":115,"tag":756,"props":2017,"children":2018},{"style":802},[2019],{"type":121,"value":2020},"\u002F\u002F Non-streaming\n",{"type":115,"tag":756,"props":2022,"children":2023},{"class":758,"line":830},[2024,2028,2032,2036,2040,2044,2048,2052,2056],{"type":115,"tag":756,"props":2025,"children":2026},{"style":1429},[2027],{"type":121,"value":1432},{"type":115,"tag":756,"props":2029,"children":2030},{"style":1376},[2031],{"type":121,"value":1379},{"type":115,"tag":756,"props":2033,"children":2034},{"style":1382},[2035],{"type":121,"value":1441},{"type":115,"tag":756,"props":2037,"children":2038},{"style":1376},[2039],{"type":121,"value":1446},{"type":115,"tag":756,"props":2041,"children":2042},{"style":1376},[2043],{"type":121,"value":1451},{"type":115,"tag":756,"props":2045,"children":2046},{"style":1370},[2047],{"type":121,"value":1456},{"type":115,"tag":756,"props":2049,"children":2050},{"style":1459},[2051],{"type":121,"value":1385},{"type":115,"tag":756,"props":2053,"children":2054},{"style":1382},[2055],{"type":121,"value":1466},{"type":115,"tag":756,"props":2057,"children":2058},{"style":1376},[2059],{"type":121,"value":1471},{"type":115,"tag":756,"props":2061,"children":2062},{"class":758,"line":1251},[2063,2067,2071,2075,2079,2083],{"type":115,"tag":756,"props":2064,"children":2065},{"style":1477},[2066],{"type":121,"value":1480},{"type":115,"tag":756,"props":2068,"children":2069},{"style":1376},[2070],{"type":121,"value":1485},{"type":115,"tag":756,"props":2072,"children":2073},{"style":1376},[2074],{"type":121,"value":1400},{"type":115,"tag":756,"props":2076,"children":2077},{"style":769},[2078],{"type":121,"value":1494},{"type":115,"tag":756,"props":2080,"children":2081},{"style":1376},[2082],{"type":121,"value":1409},{"type":115,"tag":756,"props":2084,"children":2085},{"style":1376},[2086],{"type":121,"value":1538},{"type":115,"tag":756,"props":2088,"children":2089},{"class":758,"line":110},[2090,2094,2098,2102,2107,2111],{"type":115,"tag":756,"props":2091,"children":2092},{"style":1477},[2093],{"type":121,"value":1516},{"type":115,"tag":756,"props":2095,"children":2096},{"style":1376},[2097],{"type":121,"value":1485},{"type":115,"tag":756,"props":2099,"children":2100},{"style":1376},[2101],{"type":121,"value":1400},{"type":115,"tag":756,"props":2103,"children":2104},{"style":769},[2105],{"type":121,"value":2106},"Explain quantum computing in simple terms.",{"type":115,"tag":756,"props":2108,"children":2109},{"style":1376},[2110],{"type":121,"value":1409},{"type":115,"tag":756,"props":2112,"children":2113},{"style":1376},[2114],{"type":121,"value":1538},{"type":115,"tag":756,"props":2116,"children":2117},{"class":758,"line":1817},[2118,2122,2126],{"type":115,"tag":756,"props":2119,"children":2120},{"style":1376},[2121],{"type":121,"value":1446},{"type":115,"tag":756,"props":2123,"children":2124},{"style":1382},[2125],{"type":121,"value":1550},{"type":115,"tag":756,"props":2127,"children":2128},{"style":1376},[2129],{"type":121,"value":1414},{"type":115,"tag":756,"props":2131,"children":2132},{"class":758,"line":42},[2133],{"type":115,"tag":756,"props":2134,"children":2135},{"emptyLinePlaceholder":1420},[2136],{"type":121,"value":1423},{"type":115,"tag":756,"props":2138,"children":2140},{"class":758,"line":2139},9,[2141],{"type":115,"tag":756,"props":2142,"children":2143},{"style":802},[2144],{"type":121,"value":2145},"\u002F\u002F Streaming\n",{"type":115,"tag":756,"props":2147,"children":2149},{"class":758,"line":2148},10,[2150,2154,2159,2164,2168,2172],{"type":115,"tag":756,"props":2151,"children":2152},{"style":1429},[2153],{"type":121,"value":1432},{"type":115,"tag":756,"props":2155,"children":2156},{"style":1382},[2157],{"type":121,"value":2158}," result ",{"type":115,"tag":756,"props":2160,"children":2161},{"style":1376},[2162],{"type":121,"value":2163},"=",{"type":115,"tag":756,"props":2165,"children":2166},{"style":1459},[2167],{"type":121,"value":1981},{"type":115,"tag":756,"props":2169,"children":2170},{"style":1382},[2171],{"type":121,"value":1466},{"type":115,"tag":756,"props":2173,"children":2174},{"style":1376},[2175],{"type":121,"value":1471},{"type":115,"tag":756,"props":2177,"children":2179},{"class":758,"line":2178},11,[2180,2184,2188,2192,2196,2200],{"type":115,"tag":756,"props":2181,"children":2182},{"style":1477},[2183],{"type":121,"value":1480},{"type":115,"tag":756,"props":2185,"children":2186},{"style":1376},[2187],{"type":121,"value":1485},{"type":115,"tag":756,"props":2189,"children":2190},{"style":1376},[2191],{"type":121,"value":1400},{"type":115,"tag":756,"props":2193,"children":2194},{"style":769},[2195],{"type":121,"value":1494},{"type":115,"tag":756,"props":2197,"children":2198},{"style":1376},[2199],{"type":121,"value":1409},{"type":115,"tag":756,"props":2201,"children":2202},{"style":1376},[2203],{"type":121,"value":1538},{"type":115,"tag":756,"props":2205,"children":2207},{"class":758,"line":2206},12,[2208,2212,2216,2220,2225,2229],{"type":115,"tag":756,"props":2209,"children":2210},{"style":1477},[2211],{"type":121,"value":1516},{"type":115,"tag":756,"props":2213,"children":2214},{"style":1376},[2215],{"type":121,"value":1485},{"type":115,"tag":756,"props":2217,"children":2218},{"style":1376},[2219],{"type":121,"value":1400},{"type":115,"tag":756,"props":2221,"children":2222},{"style":769},[2223],{"type":121,"value":2224},"Write a poem about coding.",{"type":115,"tag":756,"props":2226,"children":2227},{"style":1376},[2228],{"type":121,"value":1409},{"type":115,"tag":756,"props":2230,"children":2231},{"style":1376},[2232],{"type":121,"value":1538},{"type":115,"tag":756,"props":2234,"children":2236},{"class":758,"line":2235},13,[2237,2241,2245],{"type":115,"tag":756,"props":2238,"children":2239},{"style":1376},[2240],{"type":121,"value":1446},{"type":115,"tag":756,"props":2242,"children":2243},{"style":1382},[2244],{"type":121,"value":1550},{"type":115,"tag":756,"props":2246,"children":2247},{"style":1376},[2248],{"type":121,"value":1414},{"type":115,"tag":756,"props":2250,"children":2252},{"class":758,"line":2251},14,[2253],{"type":115,"tag":756,"props":2254,"children":2255},{"emptyLinePlaceholder":1420},[2256],{"type":121,"value":1423},{"type":115,"tag":756,"props":2258,"children":2260},{"class":758,"line":2259},15,[2261,2266,2270,2274,2278,2283,2288,2293,2297,2302],{"type":115,"tag":756,"props":2262,"children":2263},{"style":1370},[2264],{"type":121,"value":2265},"for",{"type":115,"tag":756,"props":2267,"children":2268},{"style":1370},[2269],{"type":121,"value":1456},{"type":115,"tag":756,"props":2271,"children":2272},{"style":1382},[2273],{"type":121,"value":1923},{"type":115,"tag":756,"props":2275,"children":2276},{"style":1429},[2277],{"type":121,"value":1432},{"type":115,"tag":756,"props":2279,"children":2280},{"style":1382},[2281],{"type":121,"value":2282}," chunk ",{"type":115,"tag":756,"props":2284,"children":2285},{"style":1376},[2286],{"type":121,"value":2287},"of",{"type":115,"tag":756,"props":2289,"children":2290},{"style":1382},[2291],{"type":121,"value":2292}," result",{"type":115,"tag":756,"props":2294,"children":2295},{"style":1376},[2296],{"type":121,"value":352},{"type":115,"tag":756,"props":2298,"children":2299},{"style":1382},[2300],{"type":121,"value":2301},"textStream) ",{"type":115,"tag":756,"props":2303,"children":2304},{"style":1376},[2305],{"type":121,"value":1471},{"type":115,"tag":756,"props":2307,"children":2309},{"class":758,"line":2308},16,[2310,2315,2319,2324,2328,2333,2337,2342,2346],{"type":115,"tag":756,"props":2311,"children":2312},{"style":1382},[2313],{"type":121,"value":2314},"  process",{"type":115,"tag":756,"props":2316,"children":2317},{"style":1376},[2318],{"type":121,"value":352},{"type":115,"tag":756,"props":2320,"children":2321},{"style":1382},[2322],{"type":121,"value":2323},"stdout",{"type":115,"tag":756,"props":2325,"children":2326},{"style":1376},[2327],{"type":121,"value":352},{"type":115,"tag":756,"props":2329,"children":2330},{"style":1459},[2331],{"type":121,"value":2332},"write",{"type":115,"tag":756,"props":2334,"children":2335},{"style":1477},[2336],{"type":121,"value":1466},{"type":115,"tag":756,"props":2338,"children":2339},{"style":1382},[2340],{"type":121,"value":2341},"chunk",{"type":115,"tag":756,"props":2343,"children":2344},{"style":1477},[2345],{"type":121,"value":1550},{"type":115,"tag":756,"props":2347,"children":2348},{"style":1376},[2349],{"type":121,"value":1414},{"type":115,"tag":756,"props":2351,"children":2353},{"class":758,"line":2352},17,[2354],{"type":115,"tag":756,"props":2355,"children":2356},{"style":1376},[2357],{"type":121,"value":2358},"}\n",{"type":115,"tag":1945,"props":2360,"children":2362},{"id":2361},"structured-output",[2363],{"type":121,"value":2364},"Structured Output",{"type":115,"tag":128,"props":2366,"children":2367},{},[2368,2379,2381,2386,2387,2393,2395,2400],{"type":115,"tag":132,"props":2369,"children":2370},{},[2371,2377],{"type":115,"tag":157,"props":2372,"children":2374},{"className":2373},[],[2375],{"type":121,"value":2376},"generateObject",{"type":121,"value":2378}," was removed in AI SDK v6.",{"type":121,"value":2380}," Use ",{"type":115,"tag":157,"props":2382,"children":2384},{"className":2383},[],[2385],{"type":121,"value":1156},{"type":121,"value":1011},{"type":115,"tag":157,"props":2388,"children":2390},{"className":2389},[],[2391],{"type":121,"value":2392},"output: Output.object()",{"type":121,"value":2394}," instead. Do NOT import ",{"type":115,"tag":157,"props":2396,"children":2398},{"className":2397},[],[2399],{"type":121,"value":2376},{"type":121,"value":2401}," — it does not exist.",{"type":115,"tag":745,"props":2403,"children":2405},{"className":1358,"code":2404,"language":1360,"meta":750,"style":750},"import { generateText, Output } from \"ai\";\nimport { z } from \"zod\";\n\nconst { output } = await generateText({\n  model: \"openai\u002Fgpt-5.4\",\n  output: Output.object({\n    schema: z.object({\n      recipe: z.object({\n        name: z.string(),\n        ingredients: z.array(\n          z.object({\n            name: z.string(),\n            amount: z.string(),\n          }),\n        ),\n        steps: z.array(z.string()),\n      }),\n    }),\n  }),\n  prompt: \"Generate a recipe for chocolate chip cookies.\",\n});\n",[2406],{"type":115,"tag":157,"props":2407,"children":2408},{"__ignoreMap":750},[2409,2457,2498,2505,2545,2572,2605,2637,2669,2703,2733,2757,2789,2821,2837,2849,2895,2911,2928,2945,2974],{"type":115,"tag":756,"props":2410,"children":2411},{"class":758,"line":759},[2412,2416,2420,2424,2428,2433,2437,2441,2445,2449,2453],{"type":115,"tag":756,"props":2413,"children":2414},{"style":1370},[2415],{"type":121,"value":1373},{"type":115,"tag":756,"props":2417,"children":2418},{"style":1376},[2419],{"type":121,"value":1379},{"type":115,"tag":756,"props":2421,"children":2422},{"style":1382},[2423],{"type":121,"value":1385},{"type":115,"tag":756,"props":2425,"children":2426},{"style":1376},[2427],{"type":121,"value":1503},{"type":115,"tag":756,"props":2429,"children":2430},{"style":1382},[2431],{"type":121,"value":2432}," Output",{"type":115,"tag":756,"props":2434,"children":2435},{"style":1376},[2436],{"type":121,"value":1390},{"type":115,"tag":756,"props":2438,"children":2439},{"style":1370},[2440],{"type":121,"value":1395},{"type":115,"tag":756,"props":2442,"children":2443},{"style":1376},[2444],{"type":121,"value":1400},{"type":115,"tag":756,"props":2446,"children":2447},{"style":769},[2448],{"type":121,"value":76},{"type":115,"tag":756,"props":2450,"children":2451},{"style":1376},[2452],{"type":121,"value":1409},{"type":115,"tag":756,"props":2454,"children":2455},{"style":1376},[2456],{"type":121,"value":1414},{"type":115,"tag":756,"props":2458,"children":2459},{"class":758,"line":785},[2460,2464,2468,2473,2477,2481,2485,2490,2494],{"type":115,"tag":756,"props":2461,"children":2462},{"style":1370},[2463],{"type":121,"value":1373},{"type":115,"tag":756,"props":2465,"children":2466},{"style":1376},[2467],{"type":121,"value":1379},{"type":115,"tag":756,"props":2469,"children":2470},{"style":1382},[2471],{"type":121,"value":2472}," z",{"type":115,"tag":756,"props":2474,"children":2475},{"style":1376},[2476],{"type":121,"value":1390},{"type":115,"tag":756,"props":2478,"children":2479},{"style":1370},[2480],{"type":121,"value":1395},{"type":115,"tag":756,"props":2482,"children":2483},{"style":1376},[2484],{"type":121,"value":1400},{"type":115,"tag":756,"props":2486,"children":2487},{"style":769},[2488],{"type":121,"value":2489},"zod",{"type":115,"tag":756,"props":2491,"children":2492},{"style":1376},[2493],{"type":121,"value":1409},{"type":115,"tag":756,"props":2495,"children":2496},{"style":1376},[2497],{"type":121,"value":1414},{"type":115,"tag":756,"props":2499,"children":2500},{"class":758,"line":808},[2501],{"type":115,"tag":756,"props":2502,"children":2503},{"emptyLinePlaceholder":1420},[2504],{"type":121,"value":1423},{"type":115,"tag":756,"props":2506,"children":2507},{"class":758,"line":830},[2508,2512,2516,2521,2525,2529,2533,2537,2541],{"type":115,"tag":756,"props":2509,"children":2510},{"style":1429},[2511],{"type":121,"value":1432},{"type":115,"tag":756,"props":2513,"children":2514},{"style":1376},[2515],{"type":121,"value":1379},{"type":115,"tag":756,"props":2517,"children":2518},{"style":1382},[2519],{"type":121,"value":2520}," output ",{"type":115,"tag":756,"props":2522,"children":2523},{"style":1376},[2524],{"type":121,"value":1446},{"type":115,"tag":756,"props":2526,"children":2527},{"style":1376},[2528],{"type":121,"value":1451},{"type":115,"tag":756,"props":2530,"children":2531},{"style":1370},[2532],{"type":121,"value":1456},{"type":115,"tag":756,"props":2534,"children":2535},{"style":1459},[2536],{"type":121,"value":1385},{"type":115,"tag":756,"props":2538,"children":2539},{"style":1382},[2540],{"type":121,"value":1466},{"type":115,"tag":756,"props":2542,"children":2543},{"style":1376},[2544],{"type":121,"value":1471},{"type":115,"tag":756,"props":2546,"children":2547},{"class":758,"line":1251},[2548,2552,2556,2560,2564,2568],{"type":115,"tag":756,"props":2549,"children":2550},{"style":1477},[2551],{"type":121,"value":1480},{"type":115,"tag":756,"props":2553,"children":2554},{"style":1376},[2555],{"type":121,"value":1485},{"type":115,"tag":756,"props":2557,"children":2558},{"style":1376},[2559],{"type":121,"value":1400},{"type":115,"tag":756,"props":2561,"children":2562},{"style":769},[2563],{"type":121,"value":1494},{"type":115,"tag":756,"props":2565,"children":2566},{"style":1376},[2567],{"type":121,"value":1409},{"type":115,"tag":756,"props":2569,"children":2570},{"style":1376},[2571],{"type":121,"value":1538},{"type":115,"tag":756,"props":2573,"children":2574},{"class":758,"line":110},[2575,2580,2584,2588,2592,2597,2601],{"type":115,"tag":756,"props":2576,"children":2577},{"style":1477},[2578],{"type":121,"value":2579},"  output",{"type":115,"tag":756,"props":2581,"children":2582},{"style":1376},[2583],{"type":121,"value":1485},{"type":115,"tag":756,"props":2585,"children":2586},{"style":1382},[2587],{"type":121,"value":2432},{"type":115,"tag":756,"props":2589,"children":2590},{"style":1376},[2591],{"type":121,"value":352},{"type":115,"tag":756,"props":2593,"children":2594},{"style":1459},[2595],{"type":121,"value":2596},"object",{"type":115,"tag":756,"props":2598,"children":2599},{"style":1382},[2600],{"type":121,"value":1466},{"type":115,"tag":756,"props":2602,"children":2603},{"style":1376},[2604],{"type":121,"value":1471},{"type":115,"tag":756,"props":2606,"children":2607},{"class":758,"line":1817},[2608,2613,2617,2621,2625,2629,2633],{"type":115,"tag":756,"props":2609,"children":2610},{"style":1477},[2611],{"type":121,"value":2612},"    schema",{"type":115,"tag":756,"props":2614,"children":2615},{"style":1376},[2616],{"type":121,"value":1485},{"type":115,"tag":756,"props":2618,"children":2619},{"style":1382},[2620],{"type":121,"value":2472},{"type":115,"tag":756,"props":2622,"children":2623},{"style":1376},[2624],{"type":121,"value":352},{"type":115,"tag":756,"props":2626,"children":2627},{"style":1459},[2628],{"type":121,"value":2596},{"type":115,"tag":756,"props":2630,"children":2631},{"style":1382},[2632],{"type":121,"value":1466},{"type":115,"tag":756,"props":2634,"children":2635},{"style":1376},[2636],{"type":121,"value":1471},{"type":115,"tag":756,"props":2638,"children":2639},{"class":758,"line":42},[2640,2645,2649,2653,2657,2661,2665],{"type":115,"tag":756,"props":2641,"children":2642},{"style":1477},[2643],{"type":121,"value":2644},"      recipe",{"type":115,"tag":756,"props":2646,"children":2647},{"style":1376},[2648],{"type":121,"value":1485},{"type":115,"tag":756,"props":2650,"children":2651},{"style":1382},[2652],{"type":121,"value":2472},{"type":115,"tag":756,"props":2654,"children":2655},{"style":1376},[2656],{"type":121,"value":352},{"type":115,"tag":756,"props":2658,"children":2659},{"style":1459},[2660],{"type":121,"value":2596},{"type":115,"tag":756,"props":2662,"children":2663},{"style":1382},[2664],{"type":121,"value":1466},{"type":115,"tag":756,"props":2666,"children":2667},{"style":1376},[2668],{"type":121,"value":1471},{"type":115,"tag":756,"props":2670,"children":2671},{"class":758,"line":2139},[2672,2677,2681,2685,2689,2694,2699],{"type":115,"tag":756,"props":2673,"children":2674},{"style":1477},[2675],{"type":121,"value":2676},"        name",{"type":115,"tag":756,"props":2678,"children":2679},{"style":1376},[2680],{"type":121,"value":1485},{"type":115,"tag":756,"props":2682,"children":2683},{"style":1382},[2684],{"type":121,"value":2472},{"type":115,"tag":756,"props":2686,"children":2687},{"style":1376},[2688],{"type":121,"value":352},{"type":115,"tag":756,"props":2690,"children":2691},{"style":1459},[2692],{"type":121,"value":2693},"string",{"type":115,"tag":756,"props":2695,"children":2696},{"style":1382},[2697],{"type":121,"value":2698},"()",{"type":115,"tag":756,"props":2700,"children":2701},{"style":1376},[2702],{"type":121,"value":1538},{"type":115,"tag":756,"props":2704,"children":2705},{"class":758,"line":2148},[2706,2711,2715,2719,2723,2728],{"type":115,"tag":756,"props":2707,"children":2708},{"style":1477},[2709],{"type":121,"value":2710},"        ingredients",{"type":115,"tag":756,"props":2712,"children":2713},{"style":1376},[2714],{"type":121,"value":1485},{"type":115,"tag":756,"props":2716,"children":2717},{"style":1382},[2718],{"type":121,"value":2472},{"type":115,"tag":756,"props":2720,"children":2721},{"style":1376},[2722],{"type":121,"value":352},{"type":115,"tag":756,"props":2724,"children":2725},{"style":1459},[2726],{"type":121,"value":2727},"array",{"type":115,"tag":756,"props":2729,"children":2730},{"style":1382},[2731],{"type":121,"value":2732},"(\n",{"type":115,"tag":756,"props":2734,"children":2735},{"class":758,"line":2178},[2736,2741,2745,2749,2753],{"type":115,"tag":756,"props":2737,"children":2738},{"style":1382},[2739],{"type":121,"value":2740},"          z",{"type":115,"tag":756,"props":2742,"children":2743},{"style":1376},[2744],{"type":121,"value":352},{"type":115,"tag":756,"props":2746,"children":2747},{"style":1459},[2748],{"type":121,"value":2596},{"type":115,"tag":756,"props":2750,"children":2751},{"style":1382},[2752],{"type":121,"value":1466},{"type":115,"tag":756,"props":2754,"children":2755},{"style":1376},[2756],{"type":121,"value":1471},{"type":115,"tag":756,"props":2758,"children":2759},{"class":758,"line":2206},[2760,2765,2769,2773,2777,2781,2785],{"type":115,"tag":756,"props":2761,"children":2762},{"style":1477},[2763],{"type":121,"value":2764},"            name",{"type":115,"tag":756,"props":2766,"children":2767},{"style":1376},[2768],{"type":121,"value":1485},{"type":115,"tag":756,"props":2770,"children":2771},{"style":1382},[2772],{"type":121,"value":2472},{"type":115,"tag":756,"props":2774,"children":2775},{"style":1376},[2776],{"type":121,"value":352},{"type":115,"tag":756,"props":2778,"children":2779},{"style":1459},[2780],{"type":121,"value":2693},{"type":115,"tag":756,"props":2782,"children":2783},{"style":1382},[2784],{"type":121,"value":2698},{"type":115,"tag":756,"props":2786,"children":2787},{"style":1376},[2788],{"type":121,"value":1538},{"type":115,"tag":756,"props":2790,"children":2791},{"class":758,"line":2235},[2792,2797,2801,2805,2809,2813,2817],{"type":115,"tag":756,"props":2793,"children":2794},{"style":1477},[2795],{"type":121,"value":2796},"            amount",{"type":115,"tag":756,"props":2798,"children":2799},{"style":1376},[2800],{"type":121,"value":1485},{"type":115,"tag":756,"props":2802,"children":2803},{"style":1382},[2804],{"type":121,"value":2472},{"type":115,"tag":756,"props":2806,"children":2807},{"style":1376},[2808],{"type":121,"value":352},{"type":115,"tag":756,"props":2810,"children":2811},{"style":1459},[2812],{"type":121,"value":2693},{"type":115,"tag":756,"props":2814,"children":2815},{"style":1382},[2816],{"type":121,"value":2698},{"type":115,"tag":756,"props":2818,"children":2819},{"style":1376},[2820],{"type":121,"value":1538},{"type":115,"tag":756,"props":2822,"children":2823},{"class":758,"line":2251},[2824,2829,2833],{"type":115,"tag":756,"props":2825,"children":2826},{"style":1376},[2827],{"type":121,"value":2828},"          }",{"type":115,"tag":756,"props":2830,"children":2831},{"style":1382},[2832],{"type":121,"value":1550},{"type":115,"tag":756,"props":2834,"children":2835},{"style":1376},[2836],{"type":121,"value":1538},{"type":115,"tag":756,"props":2838,"children":2839},{"class":758,"line":2259},[2840,2845],{"type":115,"tag":756,"props":2841,"children":2842},{"style":1382},[2843],{"type":121,"value":2844},"        )",{"type":115,"tag":756,"props":2846,"children":2847},{"style":1376},[2848],{"type":121,"value":1538},{"type":115,"tag":756,"props":2850,"children":2851},{"class":758,"line":2308},[2852,2857,2861,2865,2869,2873,2878,2882,2886,2891],{"type":115,"tag":756,"props":2853,"children":2854},{"style":1477},[2855],{"type":121,"value":2856},"        steps",{"type":115,"tag":756,"props":2858,"children":2859},{"style":1376},[2860],{"type":121,"value":1485},{"type":115,"tag":756,"props":2862,"children":2863},{"style":1382},[2864],{"type":121,"value":2472},{"type":115,"tag":756,"props":2866,"children":2867},{"style":1376},[2868],{"type":121,"value":352},{"type":115,"tag":756,"props":2870,"children":2871},{"style":1459},[2872],{"type":121,"value":2727},{"type":115,"tag":756,"props":2874,"children":2875},{"style":1382},[2876],{"type":121,"value":2877},"(z",{"type":115,"tag":756,"props":2879,"children":2880},{"style":1376},[2881],{"type":121,"value":352},{"type":115,"tag":756,"props":2883,"children":2884},{"style":1459},[2885],{"type":121,"value":2693},{"type":115,"tag":756,"props":2887,"children":2888},{"style":1382},[2889],{"type":121,"value":2890},"())",{"type":115,"tag":756,"props":2892,"children":2893},{"style":1376},[2894],{"type":121,"value":1538},{"type":115,"tag":756,"props":2896,"children":2897},{"class":758,"line":2352},[2898,2903,2907],{"type":115,"tag":756,"props":2899,"children":2900},{"style":1376},[2901],{"type":121,"value":2902},"      }",{"type":115,"tag":756,"props":2904,"children":2905},{"style":1382},[2906],{"type":121,"value":1550},{"type":115,"tag":756,"props":2908,"children":2909},{"style":1376},[2910],{"type":121,"value":1538},{"type":115,"tag":756,"props":2912,"children":2914},{"class":758,"line":2913},18,[2915,2920,2924],{"type":115,"tag":756,"props":2916,"children":2917},{"style":1376},[2918],{"type":121,"value":2919},"    }",{"type":115,"tag":756,"props":2921,"children":2922},{"style":1382},[2923],{"type":121,"value":1550},{"type":115,"tag":756,"props":2925,"children":2926},{"style":1376},[2927],{"type":121,"value":1538},{"type":115,"tag":756,"props":2929,"children":2931},{"class":758,"line":2930},19,[2932,2937,2941],{"type":115,"tag":756,"props":2933,"children":2934},{"style":1376},[2935],{"type":121,"value":2936},"  }",{"type":115,"tag":756,"props":2938,"children":2939},{"style":1382},[2940],{"type":121,"value":1550},{"type":115,"tag":756,"props":2942,"children":2943},{"style":1376},[2944],{"type":121,"value":1538},{"type":115,"tag":756,"props":2946,"children":2948},{"class":758,"line":2947},20,[2949,2953,2957,2961,2966,2970],{"type":115,"tag":756,"props":2950,"children":2951},{"style":1477},[2952],{"type":121,"value":1516},{"type":115,"tag":756,"props":2954,"children":2955},{"style":1376},[2956],{"type":121,"value":1485},{"type":115,"tag":756,"props":2958,"children":2959},{"style":1376},[2960],{"type":121,"value":1400},{"type":115,"tag":756,"props":2962,"children":2963},{"style":769},[2964],{"type":121,"value":2965},"Generate a recipe for chocolate chip cookies.",{"type":115,"tag":756,"props":2967,"children":2968},{"style":1376},[2969],{"type":121,"value":1409},{"type":115,"tag":756,"props":2971,"children":2972},{"style":1376},[2973],{"type":121,"value":1538},{"type":115,"tag":756,"props":2975,"children":2977},{"class":758,"line":2976},21,[2978,2982,2986],{"type":115,"tag":756,"props":2979,"children":2980},{"style":1376},[2981],{"type":121,"value":1446},{"type":115,"tag":756,"props":2983,"children":2984},{"style":1382},[2985],{"type":121,"value":1550},{"type":115,"tag":756,"props":2987,"children":2988},{"style":1376},[2989],{"type":121,"value":1414},{"type":115,"tag":1945,"props":2991,"children":2993},{"id":2992},"tool-calling-mcp-aligned",[2994],{"type":121,"value":2995},"Tool Calling (MCP-Aligned)",{"type":115,"tag":128,"props":2997,"children":2998},{},[2999,3001,3007,3008,3014,3016,3021,3023,3029,3030,3036,3038,3044],{"type":121,"value":3000},"In AI SDK 6, tools use ",{"type":115,"tag":157,"props":3002,"children":3004},{"className":3003},[],[3005],{"type":121,"value":3006},"inputSchema",{"type":121,"value":661},{"type":115,"tag":157,"props":3009,"children":3011},{"className":3010},[],[3012],{"type":121,"value":3013},"parameters",{"type":121,"value":3015},") and ",{"type":115,"tag":157,"props":3017,"children":3019},{"className":3018},[],[3020],{"type":121,"value":102},{"type":121,"value":3022},"\u002F",{"type":115,"tag":157,"props":3024,"children":3026},{"className":3025},[],[3027],{"type":121,"value":3028},"outputSchema",{"type":121,"value":661},{"type":115,"tag":157,"props":3031,"children":3033},{"className":3032},[],[3034],{"type":121,"value":3035},"result",{"type":121,"value":3037},"), aligned with the MCP specification. Per-tool ",{"type":115,"tag":157,"props":3039,"children":3041},{"className":3040},[],[3042],{"type":121,"value":3043},"strict",{"type":121,"value":3045}," mode ensures providers only generate valid tool calls matching your schema.",{"type":115,"tag":745,"props":3047,"children":3049},{"className":1358,"code":3048,"language":1360,"meta":750,"style":750},"import { generateText, tool } from \"ai\";\nimport { z } from \"zod\";\n\nconst result = await generateText({\n  model: \"openai\u002Fgpt-5.4\",\n  tools: {\n    weather: tool({\n      description: \"Get the weather for a location\",\n      inputSchema: z.object({\n        city: z.string().describe(\"The city name\"),\n      }),\n      outputSchema: z.object({\n        temperature: z.number(),\n        condition: z.string(),\n      }),\n      strict: true, \u002F\u002F Providers generate only schema-valid tool calls\n      execute: async ({ city }) => {\n        const data = await fetchWeather(city);\n        return { temperature: data.temp, condition: data.condition };\n      },\n    }),\n  },\n  prompt: \"What is the weather in San Francisco?\",\n});\n",[3050],{"type":115,"tag":157,"props":3051,"children":3052},{"__ignoreMap":750},[3053,3101,3140,3147,3178,3205,3222,3246,3275,3307,3369,3384,3416,3449,3481,3496,3523,3565,3608,3673,3681,3696,3705,3734],{"type":115,"tag":756,"props":3054,"children":3055},{"class":758,"line":759},[3056,3060,3064,3068,3072,3077,3081,3085,3089,3093,3097],{"type":115,"tag":756,"props":3057,"children":3058},{"style":1370},[3059],{"type":121,"value":1373},{"type":115,"tag":756,"props":3061,"children":3062},{"style":1376},[3063],{"type":121,"value":1379},{"type":115,"tag":756,"props":3065,"children":3066},{"style":1382},[3067],{"type":121,"value":1385},{"type":115,"tag":756,"props":3069,"children":3070},{"style":1376},[3071],{"type":121,"value":1503},{"type":115,"tag":756,"props":3073,"children":3074},{"style":1382},[3075],{"type":121,"value":3076}," tool",{"type":115,"tag":756,"props":3078,"children":3079},{"style":1376},[3080],{"type":121,"value":1390},{"type":115,"tag":756,"props":3082,"children":3083},{"style":1370},[3084],{"type":121,"value":1395},{"type":115,"tag":756,"props":3086,"children":3087},{"style":1376},[3088],{"type":121,"value":1400},{"type":115,"tag":756,"props":3090,"children":3091},{"style":769},[3092],{"type":121,"value":76},{"type":115,"tag":756,"props":3094,"children":3095},{"style":1376},[3096],{"type":121,"value":1409},{"type":115,"tag":756,"props":3098,"children":3099},{"style":1376},[3100],{"type":121,"value":1414},{"type":115,"tag":756,"props":3102,"children":3103},{"class":758,"line":785},[3104,3108,3112,3116,3120,3124,3128,3132,3136],{"type":115,"tag":756,"props":3105,"children":3106},{"style":1370},[3107],{"type":121,"value":1373},{"type":115,"tag":756,"props":3109,"children":3110},{"style":1376},[3111],{"type":121,"value":1379},{"type":115,"tag":756,"props":3113,"children":3114},{"style":1382},[3115],{"type":121,"value":2472},{"type":115,"tag":756,"props":3117,"children":3118},{"style":1376},[3119],{"type":121,"value":1390},{"type":115,"tag":756,"props":3121,"children":3122},{"style":1370},[3123],{"type":121,"value":1395},{"type":115,"tag":756,"props":3125,"children":3126},{"style":1376},[3127],{"type":121,"value":1400},{"type":115,"tag":756,"props":3129,"children":3130},{"style":769},[3131],{"type":121,"value":2489},{"type":115,"tag":756,"props":3133,"children":3134},{"style":1376},[3135],{"type":121,"value":1409},{"type":115,"tag":756,"props":3137,"children":3138},{"style":1376},[3139],{"type":121,"value":1414},{"type":115,"tag":756,"props":3141,"children":3142},{"class":758,"line":808},[3143],{"type":115,"tag":756,"props":3144,"children":3145},{"emptyLinePlaceholder":1420},[3146],{"type":121,"value":1423},{"type":115,"tag":756,"props":3148,"children":3149},{"class":758,"line":830},[3150,3154,3158,3162,3166,3170,3174],{"type":115,"tag":756,"props":3151,"children":3152},{"style":1429},[3153],{"type":121,"value":1432},{"type":115,"tag":756,"props":3155,"children":3156},{"style":1382},[3157],{"type":121,"value":2158},{"type":115,"tag":756,"props":3159,"children":3160},{"style":1376},[3161],{"type":121,"value":2163},{"type":115,"tag":756,"props":3163,"children":3164},{"style":1370},[3165],{"type":121,"value":1456},{"type":115,"tag":756,"props":3167,"children":3168},{"style":1459},[3169],{"type":121,"value":1385},{"type":115,"tag":756,"props":3171,"children":3172},{"style":1382},[3173],{"type":121,"value":1466},{"type":115,"tag":756,"props":3175,"children":3176},{"style":1376},[3177],{"type":121,"value":1471},{"type":115,"tag":756,"props":3179,"children":3180},{"class":758,"line":1251},[3181,3185,3189,3193,3197,3201],{"type":115,"tag":756,"props":3182,"children":3183},{"style":1477},[3184],{"type":121,"value":1480},{"type":115,"tag":756,"props":3186,"children":3187},{"style":1376},[3188],{"type":121,"value":1485},{"type":115,"tag":756,"props":3190,"children":3191},{"style":1376},[3192],{"type":121,"value":1400},{"type":115,"tag":756,"props":3194,"children":3195},{"style":769},[3196],{"type":121,"value":1494},{"type":115,"tag":756,"props":3198,"children":3199},{"style":1376},[3200],{"type":121,"value":1409},{"type":115,"tag":756,"props":3202,"children":3203},{"style":1376},[3204],{"type":121,"value":1538},{"type":115,"tag":756,"props":3206,"children":3207},{"class":758,"line":110},[3208,3213,3217],{"type":115,"tag":756,"props":3209,"children":3210},{"style":1477},[3211],{"type":121,"value":3212},"  tools",{"type":115,"tag":756,"props":3214,"children":3215},{"style":1376},[3216],{"type":121,"value":1485},{"type":115,"tag":756,"props":3218,"children":3219},{"style":1376},[3220],{"type":121,"value":3221}," {\n",{"type":115,"tag":756,"props":3223,"children":3224},{"class":758,"line":1817},[3225,3230,3234,3238,3242],{"type":115,"tag":756,"props":3226,"children":3227},{"style":1477},[3228],{"type":121,"value":3229},"    weather",{"type":115,"tag":756,"props":3231,"children":3232},{"style":1376},[3233],{"type":121,"value":1485},{"type":115,"tag":756,"props":3235,"children":3236},{"style":1459},[3237],{"type":121,"value":3076},{"type":115,"tag":756,"props":3239,"children":3240},{"style":1382},[3241],{"type":121,"value":1466},{"type":115,"tag":756,"props":3243,"children":3244},{"style":1376},[3245],{"type":121,"value":1471},{"type":115,"tag":756,"props":3247,"children":3248},{"class":758,"line":42},[3249,3254,3258,3262,3267,3271],{"type":115,"tag":756,"props":3250,"children":3251},{"style":1477},[3252],{"type":121,"value":3253},"      description",{"type":115,"tag":756,"props":3255,"children":3256},{"style":1376},[3257],{"type":121,"value":1485},{"type":115,"tag":756,"props":3259,"children":3260},{"style":1376},[3261],{"type":121,"value":1400},{"type":115,"tag":756,"props":3263,"children":3264},{"style":769},[3265],{"type":121,"value":3266},"Get the weather for a location",{"type":115,"tag":756,"props":3268,"children":3269},{"style":1376},[3270],{"type":121,"value":1409},{"type":115,"tag":756,"props":3272,"children":3273},{"style":1376},[3274],{"type":121,"value":1538},{"type":115,"tag":756,"props":3276,"children":3277},{"class":758,"line":2139},[3278,3283,3287,3291,3295,3299,3303],{"type":115,"tag":756,"props":3279,"children":3280},{"style":1477},[3281],{"type":121,"value":3282},"      inputSchema",{"type":115,"tag":756,"props":3284,"children":3285},{"style":1376},[3286],{"type":121,"value":1485},{"type":115,"tag":756,"props":3288,"children":3289},{"style":1382},[3290],{"type":121,"value":2472},{"type":115,"tag":756,"props":3292,"children":3293},{"style":1376},[3294],{"type":121,"value":352},{"type":115,"tag":756,"props":3296,"children":3297},{"style":1459},[3298],{"type":121,"value":2596},{"type":115,"tag":756,"props":3300,"children":3301},{"style":1382},[3302],{"type":121,"value":1466},{"type":115,"tag":756,"props":3304,"children":3305},{"style":1376},[3306],{"type":121,"value":1471},{"type":115,"tag":756,"props":3308,"children":3309},{"class":758,"line":2148},[3310,3315,3319,3323,3327,3331,3335,3339,3344,3348,3352,3357,3361,3365],{"type":115,"tag":756,"props":3311,"children":3312},{"style":1477},[3313],{"type":121,"value":3314},"        city",{"type":115,"tag":756,"props":3316,"children":3317},{"style":1376},[3318],{"type":121,"value":1485},{"type":115,"tag":756,"props":3320,"children":3321},{"style":1382},[3322],{"type":121,"value":2472},{"type":115,"tag":756,"props":3324,"children":3325},{"style":1376},[3326],{"type":121,"value":352},{"type":115,"tag":756,"props":3328,"children":3329},{"style":1459},[3330],{"type":121,"value":2693},{"type":115,"tag":756,"props":3332,"children":3333},{"style":1382},[3334],{"type":121,"value":2698},{"type":115,"tag":756,"props":3336,"children":3337},{"style":1376},[3338],{"type":121,"value":352},{"type":115,"tag":756,"props":3340,"children":3341},{"style":1459},[3342],{"type":121,"value":3343},"describe",{"type":115,"tag":756,"props":3345,"children":3346},{"style":1382},[3347],{"type":121,"value":1466},{"type":115,"tag":756,"props":3349,"children":3350},{"style":1376},[3351],{"type":121,"value":1409},{"type":115,"tag":756,"props":3353,"children":3354},{"style":769},[3355],{"type":121,"value":3356},"The city name",{"type":115,"tag":756,"props":3358,"children":3359},{"style":1376},[3360],{"type":121,"value":1409},{"type":115,"tag":756,"props":3362,"children":3363},{"style":1382},[3364],{"type":121,"value":1550},{"type":115,"tag":756,"props":3366,"children":3367},{"style":1376},[3368],{"type":121,"value":1538},{"type":115,"tag":756,"props":3370,"children":3371},{"class":758,"line":2178},[3372,3376,3380],{"type":115,"tag":756,"props":3373,"children":3374},{"style":1376},[3375],{"type":121,"value":2902},{"type":115,"tag":756,"props":3377,"children":3378},{"style":1382},[3379],{"type":121,"value":1550},{"type":115,"tag":756,"props":3381,"children":3382},{"style":1376},[3383],{"type":121,"value":1538},{"type":115,"tag":756,"props":3385,"children":3386},{"class":758,"line":2206},[3387,3392,3396,3400,3404,3408,3412],{"type":115,"tag":756,"props":3388,"children":3389},{"style":1477},[3390],{"type":121,"value":3391},"      outputSchema",{"type":115,"tag":756,"props":3393,"children":3394},{"style":1376},[3395],{"type":121,"value":1485},{"type":115,"tag":756,"props":3397,"children":3398},{"style":1382},[3399],{"type":121,"value":2472},{"type":115,"tag":756,"props":3401,"children":3402},{"style":1376},[3403],{"type":121,"value":352},{"type":115,"tag":756,"props":3405,"children":3406},{"style":1459},[3407],{"type":121,"value":2596},{"type":115,"tag":756,"props":3409,"children":3410},{"style":1382},[3411],{"type":121,"value":1466},{"type":115,"tag":756,"props":3413,"children":3414},{"style":1376},[3415],{"type":121,"value":1471},{"type":115,"tag":756,"props":3417,"children":3418},{"class":758,"line":2235},[3419,3424,3428,3432,3436,3441,3445],{"type":115,"tag":756,"props":3420,"children":3421},{"style":1477},[3422],{"type":121,"value":3423},"        temperature",{"type":115,"tag":756,"props":3425,"children":3426},{"style":1376},[3427],{"type":121,"value":1485},{"type":115,"tag":756,"props":3429,"children":3430},{"style":1382},[3431],{"type":121,"value":2472},{"type":115,"tag":756,"props":3433,"children":3434},{"style":1376},[3435],{"type":121,"value":352},{"type":115,"tag":756,"props":3437,"children":3438},{"style":1459},[3439],{"type":121,"value":3440},"number",{"type":115,"tag":756,"props":3442,"children":3443},{"style":1382},[3444],{"type":121,"value":2698},{"type":115,"tag":756,"props":3446,"children":3447},{"style":1376},[3448],{"type":121,"value":1538},{"type":115,"tag":756,"props":3450,"children":3451},{"class":758,"line":2251},[3452,3457,3461,3465,3469,3473,3477],{"type":115,"tag":756,"props":3453,"children":3454},{"style":1477},[3455],{"type":121,"value":3456},"        condition",{"type":115,"tag":756,"props":3458,"children":3459},{"style":1376},[3460],{"type":121,"value":1485},{"type":115,"tag":756,"props":3462,"children":3463},{"style":1382},[3464],{"type":121,"value":2472},{"type":115,"tag":756,"props":3466,"children":3467},{"style":1376},[3468],{"type":121,"value":352},{"type":115,"tag":756,"props":3470,"children":3471},{"style":1459},[3472],{"type":121,"value":2693},{"type":115,"tag":756,"props":3474,"children":3475},{"style":1382},[3476],{"type":121,"value":2698},{"type":115,"tag":756,"props":3478,"children":3479},{"style":1376},[3480],{"type":121,"value":1538},{"type":115,"tag":756,"props":3482,"children":3483},{"class":758,"line":2259},[3484,3488,3492],{"type":115,"tag":756,"props":3485,"children":3486},{"style":1376},[3487],{"type":121,"value":2902},{"type":115,"tag":756,"props":3489,"children":3490},{"style":1382},[3491],{"type":121,"value":1550},{"type":115,"tag":756,"props":3493,"children":3494},{"style":1376},[3495],{"type":121,"value":1538},{"type":115,"tag":756,"props":3497,"children":3498},{"class":758,"line":2308},[3499,3504,3508,3514,3518],{"type":115,"tag":756,"props":3500,"children":3501},{"style":1477},[3502],{"type":121,"value":3503},"      strict",{"type":115,"tag":756,"props":3505,"children":3506},{"style":1376},[3507],{"type":121,"value":1485},{"type":115,"tag":756,"props":3509,"children":3511},{"style":3510},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[3512],{"type":121,"value":3513}," true",{"type":115,"tag":756,"props":3515,"children":3516},{"style":1376},[3517],{"type":121,"value":1503},{"type":115,"tag":756,"props":3519,"children":3520},{"style":802},[3521],{"type":121,"value":3522}," \u002F\u002F Providers generate only schema-valid tool calls\n",{"type":115,"tag":756,"props":3524,"children":3525},{"class":758,"line":2352},[3526,3531,3535,3540,3545,3551,3556,3561],{"type":115,"tag":756,"props":3527,"children":3528},{"style":1459},[3529],{"type":121,"value":3530},"      execute",{"type":115,"tag":756,"props":3532,"children":3533},{"style":1376},[3534],{"type":121,"value":1485},{"type":115,"tag":756,"props":3536,"children":3537},{"style":1429},[3538],{"type":121,"value":3539}," async",{"type":115,"tag":756,"props":3541,"children":3542},{"style":1376},[3543],{"type":121,"value":3544}," ({",{"type":115,"tag":756,"props":3546,"children":3548},{"style":3547},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[3549],{"type":121,"value":3550}," city",{"type":115,"tag":756,"props":3552,"children":3553},{"style":1376},[3554],{"type":121,"value":3555}," })",{"type":115,"tag":756,"props":3557,"children":3558},{"style":1429},[3559],{"type":121,"value":3560}," =>",{"type":115,"tag":756,"props":3562,"children":3563},{"style":1376},[3564],{"type":121,"value":3221},{"type":115,"tag":756,"props":3566,"children":3567},{"class":758,"line":2913},[3568,3573,3578,3582,3586,3591,3595,3600,3604],{"type":115,"tag":756,"props":3569,"children":3570},{"style":1429},[3571],{"type":121,"value":3572},"        const",{"type":115,"tag":756,"props":3574,"children":3575},{"style":1382},[3576],{"type":121,"value":3577}," data",{"type":115,"tag":756,"props":3579,"children":3580},{"style":1376},[3581],{"type":121,"value":1451},{"type":115,"tag":756,"props":3583,"children":3584},{"style":1370},[3585],{"type":121,"value":1456},{"type":115,"tag":756,"props":3587,"children":3588},{"style":1459},[3589],{"type":121,"value":3590}," fetchWeather",{"type":115,"tag":756,"props":3592,"children":3593},{"style":1477},[3594],{"type":121,"value":1466},{"type":115,"tag":756,"props":3596,"children":3597},{"style":1382},[3598],{"type":121,"value":3599},"city",{"type":115,"tag":756,"props":3601,"children":3602},{"style":1477},[3603],{"type":121,"value":1550},{"type":115,"tag":756,"props":3605,"children":3606},{"style":1376},[3607],{"type":121,"value":1414},{"type":115,"tag":756,"props":3609,"children":3610},{"class":758,"line":2930},[3611,3616,3620,3625,3629,3633,3637,3642,3646,3651,3655,3659,3663,3668],{"type":115,"tag":756,"props":3612,"children":3613},{"style":1370},[3614],{"type":121,"value":3615},"        return",{"type":115,"tag":756,"props":3617,"children":3618},{"style":1376},[3619],{"type":121,"value":1379},{"type":115,"tag":756,"props":3621,"children":3622},{"style":1477},[3623],{"type":121,"value":3624}," temperature",{"type":115,"tag":756,"props":3626,"children":3627},{"style":1376},[3628],{"type":121,"value":1485},{"type":115,"tag":756,"props":3630,"children":3631},{"style":1382},[3632],{"type":121,"value":3577},{"type":115,"tag":756,"props":3634,"children":3635},{"style":1376},[3636],{"type":121,"value":352},{"type":115,"tag":756,"props":3638,"children":3639},{"style":1382},[3640],{"type":121,"value":3641},"temp",{"type":115,"tag":756,"props":3643,"children":3644},{"style":1376},[3645],{"type":121,"value":1503},{"type":115,"tag":756,"props":3647,"children":3648},{"style":1477},[3649],{"type":121,"value":3650}," condition",{"type":115,"tag":756,"props":3652,"children":3653},{"style":1376},[3654],{"type":121,"value":1485},{"type":115,"tag":756,"props":3656,"children":3657},{"style":1382},[3658],{"type":121,"value":3577},{"type":115,"tag":756,"props":3660,"children":3661},{"style":1376},[3662],{"type":121,"value":352},{"type":115,"tag":756,"props":3664,"children":3665},{"style":1382},[3666],{"type":121,"value":3667},"condition",{"type":115,"tag":756,"props":3669,"children":3670},{"style":1376},[3671],{"type":121,"value":3672}," };\n",{"type":115,"tag":756,"props":3674,"children":3675},{"class":758,"line":2947},[3676],{"type":115,"tag":756,"props":3677,"children":3678},{"style":1376},[3679],{"type":121,"value":3680},"      },\n",{"type":115,"tag":756,"props":3682,"children":3683},{"class":758,"line":2976},[3684,3688,3692],{"type":115,"tag":756,"props":3685,"children":3686},{"style":1376},[3687],{"type":121,"value":2919},{"type":115,"tag":756,"props":3689,"children":3690},{"style":1382},[3691],{"type":121,"value":1550},{"type":115,"tag":756,"props":3693,"children":3694},{"style":1376},[3695],{"type":121,"value":1538},{"type":115,"tag":756,"props":3697,"children":3699},{"class":758,"line":3698},22,[3700],{"type":115,"tag":756,"props":3701,"children":3702},{"style":1376},[3703],{"type":121,"value":3704},"  },\n",{"type":115,"tag":756,"props":3706,"children":3708},{"class":758,"line":3707},23,[3709,3713,3717,3721,3726,3730],{"type":115,"tag":756,"props":3710,"children":3711},{"style":1477},[3712],{"type":121,"value":1516},{"type":115,"tag":756,"props":3714,"children":3715},{"style":1376},[3716],{"type":121,"value":1485},{"type":115,"tag":756,"props":3718,"children":3719},{"style":1376},[3720],{"type":121,"value":1400},{"type":115,"tag":756,"props":3722,"children":3723},{"style":769},[3724],{"type":121,"value":3725},"What is the weather in San Francisco?",{"type":115,"tag":756,"props":3727,"children":3728},{"style":1376},[3729],{"type":121,"value":1409},{"type":115,"tag":756,"props":3731,"children":3732},{"style":1376},[3733],{"type":121,"value":1538},{"type":115,"tag":756,"props":3735,"children":3737},{"class":758,"line":3736},24,[3738,3742,3746],{"type":115,"tag":756,"props":3739,"children":3740},{"style":1376},[3741],{"type":121,"value":1446},{"type":115,"tag":756,"props":3743,"children":3744},{"style":1382},[3745],{"type":121,"value":1550},{"type":115,"tag":756,"props":3747,"children":3748},{"style":1376},[3749],{"type":121,"value":1414},{"type":115,"tag":1945,"props":3751,"children":3753},{"id":3752},"dynamic-tools-mcp-integration",[3754],{"type":121,"value":3755},"Dynamic Tools (MCP Integration)",{"type":115,"tag":128,"props":3757,"children":3758},{},[3759],{"type":121,"value":3760},"For tools with schemas not known at compile time (e.g., MCP server tools):",{"type":115,"tag":745,"props":3762,"children":3764},{"className":1358,"code":3763,"language":1360,"meta":750,"style":750},"import { dynamicTool } from \"ai\";\n\nconst tools = {\n  unknownTool: dynamicTool({\n    description: \"A tool discovered at runtime\",\n    execute: async (input) => {\n      \u002F\u002F Handle dynamically\n      return { result: \"done\" };\n    },\n  }),\n};\n",[3765],{"type":115,"tag":157,"props":3766,"children":3767},{"__ignoreMap":750},[3768,3808,3815,3835,3859,3888,3925,3933,3970,3978,3993],{"type":115,"tag":756,"props":3769,"children":3770},{"class":758,"line":759},[3771,3775,3779,3784,3788,3792,3796,3800,3804],{"type":115,"tag":756,"props":3772,"children":3773},{"style":1370},[3774],{"type":121,"value":1373},{"type":115,"tag":756,"props":3776,"children":3777},{"style":1376},[3778],{"type":121,"value":1379},{"type":115,"tag":756,"props":3780,"children":3781},{"style":1382},[3782],{"type":121,"value":3783}," dynamicTool",{"type":115,"tag":756,"props":3785,"children":3786},{"style":1376},[3787],{"type":121,"value":1390},{"type":115,"tag":756,"props":3789,"children":3790},{"style":1370},[3791],{"type":121,"value":1395},{"type":115,"tag":756,"props":3793,"children":3794},{"style":1376},[3795],{"type":121,"value":1400},{"type":115,"tag":756,"props":3797,"children":3798},{"style":769},[3799],{"type":121,"value":76},{"type":115,"tag":756,"props":3801,"children":3802},{"style":1376},[3803],{"type":121,"value":1409},{"type":115,"tag":756,"props":3805,"children":3806},{"style":1376},[3807],{"type":121,"value":1414},{"type":115,"tag":756,"props":3809,"children":3810},{"class":758,"line":785},[3811],{"type":115,"tag":756,"props":3812,"children":3813},{"emptyLinePlaceholder":1420},[3814],{"type":121,"value":1423},{"type":115,"tag":756,"props":3816,"children":3817},{"class":758,"line":808},[3818,3822,3827,3831],{"type":115,"tag":756,"props":3819,"children":3820},{"style":1429},[3821],{"type":121,"value":1432},{"type":115,"tag":756,"props":3823,"children":3824},{"style":1382},[3825],{"type":121,"value":3826}," tools ",{"type":115,"tag":756,"props":3828,"children":3829},{"style":1376},[3830],{"type":121,"value":2163},{"type":115,"tag":756,"props":3832,"children":3833},{"style":1376},[3834],{"type":121,"value":3221},{"type":115,"tag":756,"props":3836,"children":3837},{"class":758,"line":830},[3838,3843,3847,3851,3855],{"type":115,"tag":756,"props":3839,"children":3840},{"style":1477},[3841],{"type":121,"value":3842},"  unknownTool",{"type":115,"tag":756,"props":3844,"children":3845},{"style":1376},[3846],{"type":121,"value":1485},{"type":115,"tag":756,"props":3848,"children":3849},{"style":1459},[3850],{"type":121,"value":3783},{"type":115,"tag":756,"props":3852,"children":3853},{"style":1382},[3854],{"type":121,"value":1466},{"type":115,"tag":756,"props":3856,"children":3857},{"style":1376},[3858],{"type":121,"value":1471},{"type":115,"tag":756,"props":3860,"children":3861},{"class":758,"line":1251},[3862,3867,3871,3875,3880,3884],{"type":115,"tag":756,"props":3863,"children":3864},{"style":1477},[3865],{"type":121,"value":3866},"    description",{"type":115,"tag":756,"props":3868,"children":3869},{"style":1376},[3870],{"type":121,"value":1485},{"type":115,"tag":756,"props":3872,"children":3873},{"style":1376},[3874],{"type":121,"value":1400},{"type":115,"tag":756,"props":3876,"children":3877},{"style":769},[3878],{"type":121,"value":3879},"A tool discovered at runtime",{"type":115,"tag":756,"props":3881,"children":3882},{"style":1376},[3883],{"type":121,"value":1409},{"type":115,"tag":756,"props":3885,"children":3886},{"style":1376},[3887],{"type":121,"value":1538},{"type":115,"tag":756,"props":3889,"children":3890},{"class":758,"line":110},[3891,3896,3900,3904,3908,3913,3917,3921],{"type":115,"tag":756,"props":3892,"children":3893},{"style":1459},[3894],{"type":121,"value":3895},"    execute",{"type":115,"tag":756,"props":3897,"children":3898},{"style":1376},[3899],{"type":121,"value":1485},{"type":115,"tag":756,"props":3901,"children":3902},{"style":1429},[3903],{"type":121,"value":3539},{"type":115,"tag":756,"props":3905,"children":3906},{"style":1376},[3907],{"type":121,"value":1923},{"type":115,"tag":756,"props":3909,"children":3910},{"style":3547},[3911],{"type":121,"value":3912},"input",{"type":115,"tag":756,"props":3914,"children":3915},{"style":1376},[3916],{"type":121,"value":1550},{"type":115,"tag":756,"props":3918,"children":3919},{"style":1429},[3920],{"type":121,"value":3560},{"type":115,"tag":756,"props":3922,"children":3923},{"style":1376},[3924],{"type":121,"value":3221},{"type":115,"tag":756,"props":3926,"children":3927},{"class":758,"line":1817},[3928],{"type":115,"tag":756,"props":3929,"children":3930},{"style":802},[3931],{"type":121,"value":3932},"      \u002F\u002F Handle dynamically\n",{"type":115,"tag":756,"props":3934,"children":3935},{"class":758,"line":42},[3936,3941,3945,3949,3953,3957,3962,3966],{"type":115,"tag":756,"props":3937,"children":3938},{"style":1370},[3939],{"type":121,"value":3940},"      return",{"type":115,"tag":756,"props":3942,"children":3943},{"style":1376},[3944],{"type":121,"value":1379},{"type":115,"tag":756,"props":3946,"children":3947},{"style":1477},[3948],{"type":121,"value":2292},{"type":115,"tag":756,"props":3950,"children":3951},{"style":1376},[3952],{"type":121,"value":1485},{"type":115,"tag":756,"props":3954,"children":3955},{"style":1376},[3956],{"type":121,"value":1400},{"type":115,"tag":756,"props":3958,"children":3959},{"style":769},[3960],{"type":121,"value":3961},"done",{"type":115,"tag":756,"props":3963,"children":3964},{"style":1376},[3965],{"type":121,"value":1409},{"type":115,"tag":756,"props":3967,"children":3968},{"style":1376},[3969],{"type":121,"value":3672},{"type":115,"tag":756,"props":3971,"children":3972},{"class":758,"line":2139},[3973],{"type":115,"tag":756,"props":3974,"children":3975},{"style":1376},[3976],{"type":121,"value":3977},"    },\n",{"type":115,"tag":756,"props":3979,"children":3980},{"class":758,"line":2148},[3981,3985,3989],{"type":115,"tag":756,"props":3982,"children":3983},{"style":1376},[3984],{"type":121,"value":2936},{"type":115,"tag":756,"props":3986,"children":3987},{"style":1382},[3988],{"type":121,"value":1550},{"type":115,"tag":756,"props":3990,"children":3991},{"style":1376},[3992],{"type":121,"value":1538},{"type":115,"tag":756,"props":3994,"children":3995},{"class":758,"line":2178},[3996],{"type":115,"tag":756,"props":3997,"children":3998},{"style":1376},[3999],{"type":121,"value":4000},"};\n",{"type":115,"tag":1945,"props":4002,"children":4003},{"id":21},[4004],{"type":121,"value":20},{"type":115,"tag":128,"props":4006,"children":4007},{},[4008,4010,4015,4017,4022,4023,4028,4030,4035,4036,4041,4043,4048,4050,4055],{"type":121,"value":4009},"The ",{"type":115,"tag":157,"props":4011,"children":4013},{"className":4012},[],[4014],{"type":121,"value":193},{"type":121,"value":4016}," class wraps ",{"type":115,"tag":157,"props":4018,"children":4020},{"className":4019},[],[4021],{"type":121,"value":1156},{"type":121,"value":3022},{"type":115,"tag":157,"props":4024,"children":4026},{"className":4025},[],[4027],{"type":121,"value":615},{"type":121,"value":4029}," with an agentic tool-calling loop.\nDefault ",{"type":115,"tag":157,"props":4031,"children":4033},{"className":4032},[],[4034],{"type":121,"value":567},{"type":121,"value":250},{"type":115,"tag":157,"props":4037,"children":4039},{"className":4038},[],[4040],{"type":121,"value":575},{"type":121,"value":4042}," (up to 20 tool-calling steps).\n",{"type":115,"tag":157,"props":4044,"children":4046},{"className":4045},[],[4047],{"type":121,"value":201},{"type":121,"value":4049}," is an interface — ",{"type":115,"tag":157,"props":4051,"children":4053},{"className":4052},[],[4054],{"type":121,"value":193},{"type":121,"value":4056}," is the concrete implementation.",{"type":115,"tag":745,"props":4058,"children":4060},{"className":1358,"code":4059,"language":1360,"meta":750,"style":750},"import { ToolLoopAgent, stepCountIs, hasToolCall } from \"ai\";\n\nconst agent = new ToolLoopAgent({\n  model: \"anthropic\u002Fclaude-sonnet-4.6\",\n  tools: { weather, search, calculator, finalAnswer },\n  instructions: \"You are a helpful assistant.\",\n  \u002F\u002F Default: stepCountIs(20). Override to stop on a terminal tool or custom logic:\n  stopWhen: hasToolCall(\"finalAnswer\"),\n  prepareStep: (context) => ({\n    \u002F\u002F Customize each step — swap models, compress messages, limit tools\n    toolChoice: context.steps.length > 5 ? \"none\" : \"auto\",\n  }),\n});\n\nconst { text } = await agent.generate({\n  prompt:\n    \"Research the weather in Tokyo and calculate the average temperature this week.\",\n});\n",[4061],{"type":115,"tag":157,"props":4062,"children":4063},{"__ignoreMap":750},[4064,4122,4129,4162,4189,4241,4270,4278,4319,4356,4364,4450,4465,4480,4487,4536,4548,4569],{"type":115,"tag":756,"props":4065,"children":4066},{"class":758,"line":759},[4067,4071,4075,4080,4084,4089,4093,4098,4102,4106,4110,4114,4118],{"type":115,"tag":756,"props":4068,"children":4069},{"style":1370},[4070],{"type":121,"value":1373},{"type":115,"tag":756,"props":4072,"children":4073},{"style":1376},[4074],{"type":121,"value":1379},{"type":115,"tag":756,"props":4076,"children":4077},{"style":1382},[4078],{"type":121,"value":4079}," ToolLoopAgent",{"type":115,"tag":756,"props":4081,"children":4082},{"style":1376},[4083],{"type":121,"value":1503},{"type":115,"tag":756,"props":4085,"children":4086},{"style":1382},[4087],{"type":121,"value":4088}," stepCountIs",{"type":115,"tag":756,"props":4090,"children":4091},{"style":1376},[4092],{"type":121,"value":1503},{"type":115,"tag":756,"props":4094,"children":4095},{"style":1382},[4096],{"type":121,"value":4097}," hasToolCall",{"type":115,"tag":756,"props":4099,"children":4100},{"style":1376},[4101],{"type":121,"value":1390},{"type":115,"tag":756,"props":4103,"children":4104},{"style":1370},[4105],{"type":121,"value":1395},{"type":115,"tag":756,"props":4107,"children":4108},{"style":1376},[4109],{"type":121,"value":1400},{"type":115,"tag":756,"props":4111,"children":4112},{"style":769},[4113],{"type":121,"value":76},{"type":115,"tag":756,"props":4115,"children":4116},{"style":1376},[4117],{"type":121,"value":1409},{"type":115,"tag":756,"props":4119,"children":4120},{"style":1376},[4121],{"type":121,"value":1414},{"type":115,"tag":756,"props":4123,"children":4124},{"class":758,"line":785},[4125],{"type":115,"tag":756,"props":4126,"children":4127},{"emptyLinePlaceholder":1420},[4128],{"type":121,"value":1423},{"type":115,"tag":756,"props":4130,"children":4131},{"class":758,"line":808},[4132,4136,4141,4145,4150,4154,4158],{"type":115,"tag":756,"props":4133,"children":4134},{"style":1429},[4135],{"type":121,"value":1432},{"type":115,"tag":756,"props":4137,"children":4138},{"style":1382},[4139],{"type":121,"value":4140}," agent ",{"type":115,"tag":756,"props":4142,"children":4143},{"style":1376},[4144],{"type":121,"value":2163},{"type":115,"tag":756,"props":4146,"children":4147},{"style":1376},[4148],{"type":121,"value":4149}," new",{"type":115,"tag":756,"props":4151,"children":4152},{"style":1459},[4153],{"type":121,"value":4079},{"type":115,"tag":756,"props":4155,"children":4156},{"style":1382},[4157],{"type":121,"value":1466},{"type":115,"tag":756,"props":4159,"children":4160},{"style":1376},[4161],{"type":121,"value":1471},{"type":115,"tag":756,"props":4163,"children":4164},{"class":758,"line":830},[4165,4169,4173,4177,4181,4185],{"type":115,"tag":756,"props":4166,"children":4167},{"style":1477},[4168],{"type":121,"value":1480},{"type":115,"tag":756,"props":4170,"children":4171},{"style":1376},[4172],{"type":121,"value":1485},{"type":115,"tag":756,"props":4174,"children":4175},{"style":1376},[4176],{"type":121,"value":1400},{"type":115,"tag":756,"props":4178,"children":4179},{"style":769},[4180],{"type":121,"value":1866},{"type":115,"tag":756,"props":4182,"children":4183},{"style":1376},[4184],{"type":121,"value":1409},{"type":115,"tag":756,"props":4186,"children":4187},{"style":1376},[4188],{"type":121,"value":1538},{"type":115,"tag":756,"props":4190,"children":4191},{"class":758,"line":1251},[4192,4196,4200,4204,4209,4213,4218,4222,4227,4231,4236],{"type":115,"tag":756,"props":4193,"children":4194},{"style":1477},[4195],{"type":121,"value":3212},{"type":115,"tag":756,"props":4197,"children":4198},{"style":1376},[4199],{"type":121,"value":1485},{"type":115,"tag":756,"props":4201,"children":4202},{"style":1376},[4203],{"type":121,"value":1379},{"type":115,"tag":756,"props":4205,"children":4206},{"style":1382},[4207],{"type":121,"value":4208}," weather",{"type":115,"tag":756,"props":4210,"children":4211},{"style":1376},[4212],{"type":121,"value":1503},{"type":115,"tag":756,"props":4214,"children":4215},{"style":1382},[4216],{"type":121,"value":4217}," search",{"type":115,"tag":756,"props":4219,"children":4220},{"style":1376},[4221],{"type":121,"value":1503},{"type":115,"tag":756,"props":4223,"children":4224},{"style":1382},[4225],{"type":121,"value":4226}," calculator",{"type":115,"tag":756,"props":4228,"children":4229},{"style":1376},[4230],{"type":121,"value":1503},{"type":115,"tag":756,"props":4232,"children":4233},{"style":1382},[4234],{"type":121,"value":4235}," finalAnswer ",{"type":115,"tag":756,"props":4237,"children":4238},{"style":1376},[4239],{"type":121,"value":4240},"},\n",{"type":115,"tag":756,"props":4242,"children":4243},{"class":758,"line":110},[4244,4249,4253,4257,4262,4266],{"type":115,"tag":756,"props":4245,"children":4246},{"style":1477},[4247],{"type":121,"value":4248},"  instructions",{"type":115,"tag":756,"props":4250,"children":4251},{"style":1376},[4252],{"type":121,"value":1485},{"type":115,"tag":756,"props":4254,"children":4255},{"style":1376},[4256],{"type":121,"value":1400},{"type":115,"tag":756,"props":4258,"children":4259},{"style":769},[4260],{"type":121,"value":4261},"You are a helpful assistant.",{"type":115,"tag":756,"props":4263,"children":4264},{"style":1376},[4265],{"type":121,"value":1409},{"type":115,"tag":756,"props":4267,"children":4268},{"style":1376},[4269],{"type":121,"value":1538},{"type":115,"tag":756,"props":4271,"children":4272},{"class":758,"line":1817},[4273],{"type":115,"tag":756,"props":4274,"children":4275},{"style":802},[4276],{"type":121,"value":4277},"  \u002F\u002F Default: stepCountIs(20). Override to stop on a terminal tool or custom logic:\n",{"type":115,"tag":756,"props":4279,"children":4280},{"class":758,"line":42},[4281,4286,4290,4294,4298,4302,4307,4311,4315],{"type":115,"tag":756,"props":4282,"children":4283},{"style":1477},[4284],{"type":121,"value":4285},"  stopWhen",{"type":115,"tag":756,"props":4287,"children":4288},{"style":1376},[4289],{"type":121,"value":1485},{"type":115,"tag":756,"props":4291,"children":4292},{"style":1459},[4293],{"type":121,"value":4097},{"type":115,"tag":756,"props":4295,"children":4296},{"style":1382},[4297],{"type":121,"value":1466},{"type":115,"tag":756,"props":4299,"children":4300},{"style":1376},[4301],{"type":121,"value":1409},{"type":115,"tag":756,"props":4303,"children":4304},{"style":769},[4305],{"type":121,"value":4306},"finalAnswer",{"type":115,"tag":756,"props":4308,"children":4309},{"style":1376},[4310],{"type":121,"value":1409},{"type":115,"tag":756,"props":4312,"children":4313},{"style":1382},[4314],{"type":121,"value":1550},{"type":115,"tag":756,"props":4316,"children":4317},{"style":1376},[4318],{"type":121,"value":1538},{"type":115,"tag":756,"props":4320,"children":4321},{"class":758,"line":2139},[4322,4327,4331,4335,4340,4344,4348,4352],{"type":115,"tag":756,"props":4323,"children":4324},{"style":1459},[4325],{"type":121,"value":4326},"  prepareStep",{"type":115,"tag":756,"props":4328,"children":4329},{"style":1376},[4330],{"type":121,"value":1485},{"type":115,"tag":756,"props":4332,"children":4333},{"style":1376},[4334],{"type":121,"value":1923},{"type":115,"tag":756,"props":4336,"children":4337},{"style":3547},[4338],{"type":121,"value":4339},"context",{"type":115,"tag":756,"props":4341,"children":4342},{"style":1376},[4343],{"type":121,"value":1550},{"type":115,"tag":756,"props":4345,"children":4346},{"style":1429},[4347],{"type":121,"value":3560},{"type":115,"tag":756,"props":4349,"children":4350},{"style":1382},[4351],{"type":121,"value":1923},{"type":115,"tag":756,"props":4353,"children":4354},{"style":1376},[4355],{"type":121,"value":1471},{"type":115,"tag":756,"props":4357,"children":4358},{"class":758,"line":2148},[4359],{"type":115,"tag":756,"props":4360,"children":4361},{"style":802},[4362],{"type":121,"value":4363},"    \u002F\u002F Customize each step — swap models, compress messages, limit tools\n",{"type":115,"tag":756,"props":4365,"children":4366},{"class":758,"line":2178},[4367,4372,4376,4381,4385,4390,4394,4399,4404,4410,4415,4419,4424,4428,4433,4437,4442,4446],{"type":115,"tag":756,"props":4368,"children":4369},{"style":1477},[4370],{"type":121,"value":4371},"    toolChoice",{"type":115,"tag":756,"props":4373,"children":4374},{"style":1376},[4375],{"type":121,"value":1485},{"type":115,"tag":756,"props":4377,"children":4378},{"style":1382},[4379],{"type":121,"value":4380}," context",{"type":115,"tag":756,"props":4382,"children":4383},{"style":1376},[4384],{"type":121,"value":352},{"type":115,"tag":756,"props":4386,"children":4387},{"style":1382},[4388],{"type":121,"value":4389},"steps",{"type":115,"tag":756,"props":4391,"children":4392},{"style":1376},[4393],{"type":121,"value":352},{"type":115,"tag":756,"props":4395,"children":4396},{"style":1382},[4397],{"type":121,"value":4398},"length ",{"type":115,"tag":756,"props":4400,"children":4401},{"style":1376},[4402],{"type":121,"value":4403},">",{"type":115,"tag":756,"props":4405,"children":4407},{"style":4406},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[4408],{"type":121,"value":4409}," 5",{"type":115,"tag":756,"props":4411,"children":4412},{"style":1376},[4413],{"type":121,"value":4414}," ?",{"type":115,"tag":756,"props":4416,"children":4417},{"style":1376},[4418],{"type":121,"value":1400},{"type":115,"tag":756,"props":4420,"children":4421},{"style":769},[4422],{"type":121,"value":4423},"none",{"type":115,"tag":756,"props":4425,"children":4426},{"style":1376},[4427],{"type":121,"value":1409},{"type":115,"tag":756,"props":4429,"children":4430},{"style":1376},[4431],{"type":121,"value":4432}," :",{"type":115,"tag":756,"props":4434,"children":4435},{"style":1376},[4436],{"type":121,"value":1400},{"type":115,"tag":756,"props":4438,"children":4439},{"style":769},[4440],{"type":121,"value":4441},"auto",{"type":115,"tag":756,"props":4443,"children":4444},{"style":1376},[4445],{"type":121,"value":1409},{"type":115,"tag":756,"props":4447,"children":4448},{"style":1376},[4449],{"type":121,"value":1538},{"type":115,"tag":756,"props":4451,"children":4452},{"class":758,"line":2206},[4453,4457,4461],{"type":115,"tag":756,"props":4454,"children":4455},{"style":1376},[4456],{"type":121,"value":2936},{"type":115,"tag":756,"props":4458,"children":4459},{"style":1382},[4460],{"type":121,"value":1550},{"type":115,"tag":756,"props":4462,"children":4463},{"style":1376},[4464],{"type":121,"value":1538},{"type":115,"tag":756,"props":4466,"children":4467},{"class":758,"line":2235},[4468,4472,4476],{"type":115,"tag":756,"props":4469,"children":4470},{"style":1376},[4471],{"type":121,"value":1446},{"type":115,"tag":756,"props":4473,"children":4474},{"style":1382},[4475],{"type":121,"value":1550},{"type":115,"tag":756,"props":4477,"children":4478},{"style":1376},[4479],{"type":121,"value":1414},{"type":115,"tag":756,"props":4481,"children":4482},{"class":758,"line":2251},[4483],{"type":115,"tag":756,"props":4484,"children":4485},{"emptyLinePlaceholder":1420},[4486],{"type":121,"value":1423},{"type":115,"tag":756,"props":4488,"children":4489},{"class":758,"line":2259},[4490,4494,4498,4502,4506,4510,4514,4519,4523,4528,4532],{"type":115,"tag":756,"props":4491,"children":4492},{"style":1429},[4493],{"type":121,"value":1432},{"type":115,"tag":756,"props":4495,"children":4496},{"style":1376},[4497],{"type":121,"value":1379},{"type":115,"tag":756,"props":4499,"children":4500},{"style":1382},[4501],{"type":121,"value":1441},{"type":115,"tag":756,"props":4503,"children":4504},{"style":1376},[4505],{"type":121,"value":1446},{"type":115,"tag":756,"props":4507,"children":4508},{"style":1376},[4509],{"type":121,"value":1451},{"type":115,"tag":756,"props":4511,"children":4512},{"style":1370},[4513],{"type":121,"value":1456},{"type":115,"tag":756,"props":4515,"children":4516},{"style":1382},[4517],{"type":121,"value":4518}," agent",{"type":115,"tag":756,"props":4520,"children":4521},{"style":1376},[4522],{"type":121,"value":352},{"type":115,"tag":756,"props":4524,"children":4525},{"style":1459},[4526],{"type":121,"value":4527},"generate",{"type":115,"tag":756,"props":4529,"children":4530},{"style":1382},[4531],{"type":121,"value":1466},{"type":115,"tag":756,"props":4533,"children":4534},{"style":1376},[4535],{"type":121,"value":1471},{"type":115,"tag":756,"props":4537,"children":4538},{"class":758,"line":2308},[4539,4543],{"type":115,"tag":756,"props":4540,"children":4541},{"style":1477},[4542],{"type":121,"value":1516},{"type":115,"tag":756,"props":4544,"children":4545},{"style":1376},[4546],{"type":121,"value":4547},":\n",{"type":115,"tag":756,"props":4549,"children":4550},{"class":758,"line":2352},[4551,4556,4561,4565],{"type":115,"tag":756,"props":4552,"children":4553},{"style":1376},[4554],{"type":121,"value":4555},"    \"",{"type":115,"tag":756,"props":4557,"children":4558},{"style":769},[4559],{"type":121,"value":4560},"Research the weather in Tokyo and calculate the average temperature this week.",{"type":115,"tag":756,"props":4562,"children":4563},{"style":1376},[4564],{"type":121,"value":1409},{"type":115,"tag":756,"props":4566,"children":4567},{"style":1376},[4568],{"type":121,"value":1538},{"type":115,"tag":756,"props":4570,"children":4571},{"class":758,"line":2913},[4572,4576,4580],{"type":115,"tag":756,"props":4573,"children":4574},{"style":1376},[4575],{"type":121,"value":1446},{"type":115,"tag":756,"props":4577,"children":4578},{"style":1382},[4579],{"type":121,"value":1550},{"type":115,"tag":756,"props":4581,"children":4582},{"style":1376},[4583],{"type":121,"value":1414},{"type":115,"tag":1945,"props":4585,"children":4587},{"id":4586},"mcp-client",[4588],{"type":121,"value":4589},"MCP Client",{"type":115,"tag":128,"props":4591,"children":4592},{},[4593],{"type":121,"value":4594},"Connect to any MCP server and use its tools:",{"type":115,"tag":745,"props":4596,"children":4598},{"className":1358,"code":4597,"language":1360,"meta":750,"style":750},"import { generateText } from \"ai\";\nimport { createMCPClient } from \"@ai-sdk\u002Fmcp\";\n\nconst mcpClient = await createMCPClient({\n  transport: {\n    type: \"sse\",\n    url: \"https:\u002F\u002Fmy-mcp-server.com\u002Fsse\",\n  },\n});\n\nconst tools = await mcpClient.tools();\n\nconst result = await generateText({\n  model: \"openai\u002Fgpt-5.4\",\n  tools,\n  prompt: \"Use the available tools to help the user.\",\n});\n\nawait mcpClient.close();\n",[4599],{"type":115,"tag":157,"props":4600,"children":4601},{"__ignoreMap":750},[4602,4641,4682,4689,4721,4737,4766,4795,4802,4817,4824,4865,4872,4903,4930,4941,4969,4984,4991],{"type":115,"tag":756,"props":4603,"children":4604},{"class":758,"line":759},[4605,4609,4613,4617,4621,4625,4629,4633,4637],{"type":115,"tag":756,"props":4606,"children":4607},{"style":1370},[4608],{"type":121,"value":1373},{"type":115,"tag":756,"props":4610,"children":4611},{"style":1376},[4612],{"type":121,"value":1379},{"type":115,"tag":756,"props":4614,"children":4615},{"style":1382},[4616],{"type":121,"value":1385},{"type":115,"tag":756,"props":4618,"children":4619},{"style":1376},[4620],{"type":121,"value":1390},{"type":115,"tag":756,"props":4622,"children":4623},{"style":1370},[4624],{"type":121,"value":1395},{"type":115,"tag":756,"props":4626,"children":4627},{"style":1376},[4628],{"type":121,"value":1400},{"type":115,"tag":756,"props":4630,"children":4631},{"style":769},[4632],{"type":121,"value":76},{"type":115,"tag":756,"props":4634,"children":4635},{"style":1376},[4636],{"type":121,"value":1409},{"type":115,"tag":756,"props":4638,"children":4639},{"style":1376},[4640],{"type":121,"value":1414},{"type":115,"tag":756,"props":4642,"children":4643},{"class":758,"line":785},[4644,4648,4652,4657,4661,4665,4669,4674,4678],{"type":115,"tag":756,"props":4645,"children":4646},{"style":1370},[4647],{"type":121,"value":1373},{"type":115,"tag":756,"props":4649,"children":4650},{"style":1376},[4651],{"type":121,"value":1379},{"type":115,"tag":756,"props":4653,"children":4654},{"style":1382},[4655],{"type":121,"value":4656}," createMCPClient",{"type":115,"tag":756,"props":4658,"children":4659},{"style":1376},[4660],{"type":121,"value":1390},{"type":115,"tag":756,"props":4662,"children":4663},{"style":1370},[4664],{"type":121,"value":1395},{"type":115,"tag":756,"props":4666,"children":4667},{"style":1376},[4668],{"type":121,"value":1400},{"type":115,"tag":756,"props":4670,"children":4671},{"style":769},[4672],{"type":121,"value":4673},"@ai-sdk\u002Fmcp",{"type":115,"tag":756,"props":4675,"children":4676},{"style":1376},[4677],{"type":121,"value":1409},{"type":115,"tag":756,"props":4679,"children":4680},{"style":1376},[4681],{"type":121,"value":1414},{"type":115,"tag":756,"props":4683,"children":4684},{"class":758,"line":808},[4685],{"type":115,"tag":756,"props":4686,"children":4687},{"emptyLinePlaceholder":1420},[4688],{"type":121,"value":1423},{"type":115,"tag":756,"props":4690,"children":4691},{"class":758,"line":830},[4692,4696,4701,4705,4709,4713,4717],{"type":115,"tag":756,"props":4693,"children":4694},{"style":1429},[4695],{"type":121,"value":1432},{"type":115,"tag":756,"props":4697,"children":4698},{"style":1382},[4699],{"type":121,"value":4700}," mcpClient ",{"type":115,"tag":756,"props":4702,"children":4703},{"style":1376},[4704],{"type":121,"value":2163},{"type":115,"tag":756,"props":4706,"children":4707},{"style":1370},[4708],{"type":121,"value":1456},{"type":115,"tag":756,"props":4710,"children":4711},{"style":1459},[4712],{"type":121,"value":4656},{"type":115,"tag":756,"props":4714,"children":4715},{"style":1382},[4716],{"type":121,"value":1466},{"type":115,"tag":756,"props":4718,"children":4719},{"style":1376},[4720],{"type":121,"value":1471},{"type":115,"tag":756,"props":4722,"children":4723},{"class":758,"line":1251},[4724,4729,4733],{"type":115,"tag":756,"props":4725,"children":4726},{"style":1477},[4727],{"type":121,"value":4728},"  transport",{"type":115,"tag":756,"props":4730,"children":4731},{"style":1376},[4732],{"type":121,"value":1485},{"type":115,"tag":756,"props":4734,"children":4735},{"style":1376},[4736],{"type":121,"value":3221},{"type":115,"tag":756,"props":4738,"children":4739},{"class":758,"line":110},[4740,4745,4749,4753,4758,4762],{"type":115,"tag":756,"props":4741,"children":4742},{"style":1477},[4743],{"type":121,"value":4744},"    type",{"type":115,"tag":756,"props":4746,"children":4747},{"style":1376},[4748],{"type":121,"value":1485},{"type":115,"tag":756,"props":4750,"children":4751},{"style":1376},[4752],{"type":121,"value":1400},{"type":115,"tag":756,"props":4754,"children":4755},{"style":769},[4756],{"type":121,"value":4757},"sse",{"type":115,"tag":756,"props":4759,"children":4760},{"style":1376},[4761],{"type":121,"value":1409},{"type":115,"tag":756,"props":4763,"children":4764},{"style":1376},[4765],{"type":121,"value":1538},{"type":115,"tag":756,"props":4767,"children":4768},{"class":758,"line":1817},[4769,4774,4778,4782,4787,4791],{"type":115,"tag":756,"props":4770,"children":4771},{"style":1477},[4772],{"type":121,"value":4773},"    url",{"type":115,"tag":756,"props":4775,"children":4776},{"style":1376},[4777],{"type":121,"value":1485},{"type":115,"tag":756,"props":4779,"children":4780},{"style":1376},[4781],{"type":121,"value":1400},{"type":115,"tag":756,"props":4783,"children":4784},{"style":769},[4785],{"type":121,"value":4786},"https:\u002F\u002Fmy-mcp-server.com\u002Fsse",{"type":115,"tag":756,"props":4788,"children":4789},{"style":1376},[4790],{"type":121,"value":1409},{"type":115,"tag":756,"props":4792,"children":4793},{"style":1376},[4794],{"type":121,"value":1538},{"type":115,"tag":756,"props":4796,"children":4797},{"class":758,"line":42},[4798],{"type":115,"tag":756,"props":4799,"children":4800},{"style":1376},[4801],{"type":121,"value":3704},{"type":115,"tag":756,"props":4803,"children":4804},{"class":758,"line":2139},[4805,4809,4813],{"type":115,"tag":756,"props":4806,"children":4807},{"style":1376},[4808],{"type":121,"value":1446},{"type":115,"tag":756,"props":4810,"children":4811},{"style":1382},[4812],{"type":121,"value":1550},{"type":115,"tag":756,"props":4814,"children":4815},{"style":1376},[4816],{"type":121,"value":1414},{"type":115,"tag":756,"props":4818,"children":4819},{"class":758,"line":2148},[4820],{"type":115,"tag":756,"props":4821,"children":4822},{"emptyLinePlaceholder":1420},[4823],{"type":121,"value":1423},{"type":115,"tag":756,"props":4825,"children":4826},{"class":758,"line":2178},[4827,4831,4835,4839,4843,4848,4852,4857,4861],{"type":115,"tag":756,"props":4828,"children":4829},{"style":1429},[4830],{"type":121,"value":1432},{"type":115,"tag":756,"props":4832,"children":4833},{"style":1382},[4834],{"type":121,"value":3826},{"type":115,"tag":756,"props":4836,"children":4837},{"style":1376},[4838],{"type":121,"value":2163},{"type":115,"tag":756,"props":4840,"children":4841},{"style":1370},[4842],{"type":121,"value":1456},{"type":115,"tag":756,"props":4844,"children":4845},{"style":1382},[4846],{"type":121,"value":4847}," mcpClient",{"type":115,"tag":756,"props":4849,"children":4850},{"style":1376},[4851],{"type":121,"value":352},{"type":115,"tag":756,"props":4853,"children":4854},{"style":1459},[4855],{"type":121,"value":4856},"tools",{"type":115,"tag":756,"props":4858,"children":4859},{"style":1382},[4860],{"type":121,"value":2698},{"type":115,"tag":756,"props":4862,"children":4863},{"style":1376},[4864],{"type":121,"value":1414},{"type":115,"tag":756,"props":4866,"children":4867},{"class":758,"line":2206},[4868],{"type":115,"tag":756,"props":4869,"children":4870},{"emptyLinePlaceholder":1420},[4871],{"type":121,"value":1423},{"type":115,"tag":756,"props":4873,"children":4874},{"class":758,"line":2235},[4875,4879,4883,4887,4891,4895,4899],{"type":115,"tag":756,"props":4876,"children":4877},{"style":1429},[4878],{"type":121,"value":1432},{"type":115,"tag":756,"props":4880,"children":4881},{"style":1382},[4882],{"type":121,"value":2158},{"type":115,"tag":756,"props":4884,"children":4885},{"style":1376},[4886],{"type":121,"value":2163},{"type":115,"tag":756,"props":4888,"children":4889},{"style":1370},[4890],{"type":121,"value":1456},{"type":115,"tag":756,"props":4892,"children":4893},{"style":1459},[4894],{"type":121,"value":1385},{"type":115,"tag":756,"props":4896,"children":4897},{"style":1382},[4898],{"type":121,"value":1466},{"type":115,"tag":756,"props":4900,"children":4901},{"style":1376},[4902],{"type":121,"value":1471},{"type":115,"tag":756,"props":4904,"children":4905},{"class":758,"line":2251},[4906,4910,4914,4918,4922,4926],{"type":115,"tag":756,"props":4907,"children":4908},{"style":1477},[4909],{"type":121,"value":1480},{"type":115,"tag":756,"props":4911,"children":4912},{"style":1376},[4913],{"type":121,"value":1485},{"type":115,"tag":756,"props":4915,"children":4916},{"style":1376},[4917],{"type":121,"value":1400},{"type":115,"tag":756,"props":4919,"children":4920},{"style":769},[4921],{"type":121,"value":1494},{"type":115,"tag":756,"props":4923,"children":4924},{"style":1376},[4925],{"type":121,"value":1409},{"type":115,"tag":756,"props":4927,"children":4928},{"style":1376},[4929],{"type":121,"value":1538},{"type":115,"tag":756,"props":4931,"children":4932},{"class":758,"line":2259},[4933,4937],{"type":115,"tag":756,"props":4934,"children":4935},{"style":1382},[4936],{"type":121,"value":3212},{"type":115,"tag":756,"props":4938,"children":4939},{"style":1376},[4940],{"type":121,"value":1538},{"type":115,"tag":756,"props":4942,"children":4943},{"class":758,"line":2308},[4944,4948,4952,4956,4961,4965],{"type":115,"tag":756,"props":4945,"children":4946},{"style":1477},[4947],{"type":121,"value":1516},{"type":115,"tag":756,"props":4949,"children":4950},{"style":1376},[4951],{"type":121,"value":1485},{"type":115,"tag":756,"props":4953,"children":4954},{"style":1376},[4955],{"type":121,"value":1400},{"type":115,"tag":756,"props":4957,"children":4958},{"style":769},[4959],{"type":121,"value":4960},"Use the available tools to help the user.",{"type":115,"tag":756,"props":4962,"children":4963},{"style":1376},[4964],{"type":121,"value":1409},{"type":115,"tag":756,"props":4966,"children":4967},{"style":1376},[4968],{"type":121,"value":1538},{"type":115,"tag":756,"props":4970,"children":4971},{"class":758,"line":2352},[4972,4976,4980],{"type":115,"tag":756,"props":4973,"children":4974},{"style":1376},[4975],{"type":121,"value":1446},{"type":115,"tag":756,"props":4977,"children":4978},{"style":1382},[4979],{"type":121,"value":1550},{"type":115,"tag":756,"props":4981,"children":4982},{"style":1376},[4983],{"type":121,"value":1414},{"type":115,"tag":756,"props":4985,"children":4986},{"class":758,"line":2913},[4987],{"type":115,"tag":756,"props":4988,"children":4989},{"emptyLinePlaceholder":1420},[4990],{"type":121,"value":1423},{"type":115,"tag":756,"props":4992,"children":4993},{"class":758,"line":2930},[4994,4999,5003,5007,5012,5016],{"type":115,"tag":756,"props":4995,"children":4996},{"style":1370},[4997],{"type":121,"value":4998},"await",{"type":115,"tag":756,"props":5000,"children":5001},{"style":1382},[5002],{"type":121,"value":4847},{"type":115,"tag":756,"props":5004,"children":5005},{"style":1376},[5006],{"type":121,"value":352},{"type":115,"tag":756,"props":5008,"children":5009},{"style":1459},[5010],{"type":121,"value":5011},"close",{"type":115,"tag":756,"props":5013,"children":5014},{"style":1382},[5015],{"type":121,"value":2698},{"type":115,"tag":756,"props":5017,"children":5018},{"style":1376},[5019],{"type":121,"value":1414},{"type":115,"tag":128,"props":5021,"children":5022},{},[5023,5025,5030],{"type":121,"value":5024},"MCP OAuth for remote servers is handled automatically by ",{"type":115,"tag":157,"props":5026,"children":5028},{"className":5027},[],[5029],{"type":121,"value":4673},{"type":121,"value":352},{"type":115,"tag":1945,"props":5032,"children":5034},{"id":5033},"tool-approval-human-in-the-loop",[5035],{"type":121,"value":5036},"Tool Approval (Human-in-the-Loop)",{"type":115,"tag":128,"props":5038,"children":5039},{},[5040,5042,5048,5050,5056],{"type":121,"value":5041},"Set ",{"type":115,"tag":157,"props":5043,"children":5045},{"className":5044},[],[5046],{"type":121,"value":5047},"needsApproval",{"type":121,"value":5049}," on any tool to require user confirmation before execution. The tool pauses in ",{"type":115,"tag":157,"props":5051,"children":5053},{"className":5052},[],[5054],{"type":121,"value":5055},"approval-requested",{"type":121,"value":5057}," state until the client responds.",{"type":115,"tag":745,"props":5059,"children":5061},{"className":1358,"code":5060,"language":1360,"meta":750,"style":750},"import { streamText, tool } from \"ai\";\nimport { z } from \"zod\";\n\nconst result = streamText({\n  model: \"openai\u002Fgpt-5.4\",\n  tools: {\n    deleteUser: tool({\n      description: \"Delete a user account\",\n      inputSchema: z.object({ userId: z.string() }),\n      needsApproval: true, \u002F\u002F Always require approval\n      execute: async ({ userId }) => {\n        await db.users.delete(userId);\n        return { deleted: true };\n      },\n    }),\n    processPayment: tool({\n      description: \"Process a payment\",\n      inputSchema: z.object({ amount: z.number(), recipient: z.string() }),\n      \u002F\u002F Conditional: only approve large amounts\n      needsApproval: async ({ amount }) => amount > 1000,\n      execute: async ({ amount, recipient }) => {\n        return await processPayment(amount, recipient);\n      },\n    }),\n  },\n  prompt: \"Delete user 123\",\n});\n",[5062],{"type":115,"tag":157,"props":5063,"children":5064},{"__ignoreMap":750},[5065,5112,5151,5158,5185,5212,5227,5251,5279,5349,5374,5409,5457,5485,5492,5507,5531,5559,5656,5664,5713,5756,5797,5804,5819,5827,5856],{"type":115,"tag":756,"props":5066,"children":5067},{"class":758,"line":759},[5068,5072,5076,5080,5084,5088,5092,5096,5100,5104,5108],{"type":115,"tag":756,"props":5069,"children":5070},{"style":1370},[5071],{"type":121,"value":1373},{"type":115,"tag":756,"props":5073,"children":5074},{"style":1376},[5075],{"type":121,"value":1379},{"type":115,"tag":756,"props":5077,"children":5078},{"style":1382},[5079],{"type":121,"value":1981},{"type":115,"tag":756,"props":5081,"children":5082},{"style":1376},[5083],{"type":121,"value":1503},{"type":115,"tag":756,"props":5085,"children":5086},{"style":1382},[5087],{"type":121,"value":3076},{"type":115,"tag":756,"props":5089,"children":5090},{"style":1376},[5091],{"type":121,"value":1390},{"type":115,"tag":756,"props":5093,"children":5094},{"style":1370},[5095],{"type":121,"value":1395},{"type":115,"tag":756,"props":5097,"children":5098},{"style":1376},[5099],{"type":121,"value":1400},{"type":115,"tag":756,"props":5101,"children":5102},{"style":769},[5103],{"type":121,"value":76},{"type":115,"tag":756,"props":5105,"children":5106},{"style":1376},[5107],{"type":121,"value":1409},{"type":115,"tag":756,"props":5109,"children":5110},{"style":1376},[5111],{"type":121,"value":1414},{"type":115,"tag":756,"props":5113,"children":5114},{"class":758,"line":785},[5115,5119,5123,5127,5131,5135,5139,5143,5147],{"type":115,"tag":756,"props":5116,"children":5117},{"style":1370},[5118],{"type":121,"value":1373},{"type":115,"tag":756,"props":5120,"children":5121},{"style":1376},[5122],{"type":121,"value":1379},{"type":115,"tag":756,"props":5124,"children":5125},{"style":1382},[5126],{"type":121,"value":2472},{"type":115,"tag":756,"props":5128,"children":5129},{"style":1376},[5130],{"type":121,"value":1390},{"type":115,"tag":756,"props":5132,"children":5133},{"style":1370},[5134],{"type":121,"value":1395},{"type":115,"tag":756,"props":5136,"children":5137},{"style":1376},[5138],{"type":121,"value":1400},{"type":115,"tag":756,"props":5140,"children":5141},{"style":769},[5142],{"type":121,"value":2489},{"type":115,"tag":756,"props":5144,"children":5145},{"style":1376},[5146],{"type":121,"value":1409},{"type":115,"tag":756,"props":5148,"children":5149},{"style":1376},[5150],{"type":121,"value":1414},{"type":115,"tag":756,"props":5152,"children":5153},{"class":758,"line":808},[5154],{"type":115,"tag":756,"props":5155,"children":5156},{"emptyLinePlaceholder":1420},[5157],{"type":121,"value":1423},{"type":115,"tag":756,"props":5159,"children":5160},{"class":758,"line":830},[5161,5165,5169,5173,5177,5181],{"type":115,"tag":756,"props":5162,"children":5163},{"style":1429},[5164],{"type":121,"value":1432},{"type":115,"tag":756,"props":5166,"children":5167},{"style":1382},[5168],{"type":121,"value":2158},{"type":115,"tag":756,"props":5170,"children":5171},{"style":1376},[5172],{"type":121,"value":2163},{"type":115,"tag":756,"props":5174,"children":5175},{"style":1459},[5176],{"type":121,"value":1981},{"type":115,"tag":756,"props":5178,"children":5179},{"style":1382},[5180],{"type":121,"value":1466},{"type":115,"tag":756,"props":5182,"children":5183},{"style":1376},[5184],{"type":121,"value":1471},{"type":115,"tag":756,"props":5186,"children":5187},{"class":758,"line":1251},[5188,5192,5196,5200,5204,5208],{"type":115,"tag":756,"props":5189,"children":5190},{"style":1477},[5191],{"type":121,"value":1480},{"type":115,"tag":756,"props":5193,"children":5194},{"style":1376},[5195],{"type":121,"value":1485},{"type":115,"tag":756,"props":5197,"children":5198},{"style":1376},[5199],{"type":121,"value":1400},{"type":115,"tag":756,"props":5201,"children":5202},{"style":769},[5203],{"type":121,"value":1494},{"type":115,"tag":756,"props":5205,"children":5206},{"style":1376},[5207],{"type":121,"value":1409},{"type":115,"tag":756,"props":5209,"children":5210},{"style":1376},[5211],{"type":121,"value":1538},{"type":115,"tag":756,"props":5213,"children":5214},{"class":758,"line":110},[5215,5219,5223],{"type":115,"tag":756,"props":5216,"children":5217},{"style":1477},[5218],{"type":121,"value":3212},{"type":115,"tag":756,"props":5220,"children":5221},{"style":1376},[5222],{"type":121,"value":1485},{"type":115,"tag":756,"props":5224,"children":5225},{"style":1376},[5226],{"type":121,"value":3221},{"type":115,"tag":756,"props":5228,"children":5229},{"class":758,"line":1817},[5230,5235,5239,5243,5247],{"type":115,"tag":756,"props":5231,"children":5232},{"style":1477},[5233],{"type":121,"value":5234},"    deleteUser",{"type":115,"tag":756,"props":5236,"children":5237},{"style":1376},[5238],{"type":121,"value":1485},{"type":115,"tag":756,"props":5240,"children":5241},{"style":1459},[5242],{"type":121,"value":3076},{"type":115,"tag":756,"props":5244,"children":5245},{"style":1382},[5246],{"type":121,"value":1466},{"type":115,"tag":756,"props":5248,"children":5249},{"style":1376},[5250],{"type":121,"value":1471},{"type":115,"tag":756,"props":5252,"children":5253},{"class":758,"line":42},[5254,5258,5262,5266,5271,5275],{"type":115,"tag":756,"props":5255,"children":5256},{"style":1477},[5257],{"type":121,"value":3253},{"type":115,"tag":756,"props":5259,"children":5260},{"style":1376},[5261],{"type":121,"value":1485},{"type":115,"tag":756,"props":5263,"children":5264},{"style":1376},[5265],{"type":121,"value":1400},{"type":115,"tag":756,"props":5267,"children":5268},{"style":769},[5269],{"type":121,"value":5270},"Delete a user account",{"type":115,"tag":756,"props":5272,"children":5273},{"style":1376},[5274],{"type":121,"value":1409},{"type":115,"tag":756,"props":5276,"children":5277},{"style":1376},[5278],{"type":121,"value":1538},{"type":115,"tag":756,"props":5280,"children":5281},{"class":758,"line":2139},[5282,5286,5290,5294,5298,5302,5306,5311,5316,5320,5324,5328,5332,5337,5341,5345],{"type":115,"tag":756,"props":5283,"children":5284},{"style":1477},[5285],{"type":121,"value":3282},{"type":115,"tag":756,"props":5287,"children":5288},{"style":1376},[5289],{"type":121,"value":1485},{"type":115,"tag":756,"props":5291,"children":5292},{"style":1382},[5293],{"type":121,"value":2472},{"type":115,"tag":756,"props":5295,"children":5296},{"style":1376},[5297],{"type":121,"value":352},{"type":115,"tag":756,"props":5299,"children":5300},{"style":1459},[5301],{"type":121,"value":2596},{"type":115,"tag":756,"props":5303,"children":5304},{"style":1382},[5305],{"type":121,"value":1466},{"type":115,"tag":756,"props":5307,"children":5308},{"style":1376},[5309],{"type":121,"value":5310},"{",{"type":115,"tag":756,"props":5312,"children":5313},{"style":1477},[5314],{"type":121,"value":5315}," userId",{"type":115,"tag":756,"props":5317,"children":5318},{"style":1376},[5319],{"type":121,"value":1485},{"type":115,"tag":756,"props":5321,"children":5322},{"style":1382},[5323],{"type":121,"value":2472},{"type":115,"tag":756,"props":5325,"children":5326},{"style":1376},[5327],{"type":121,"value":352},{"type":115,"tag":756,"props":5329,"children":5330},{"style":1459},[5331],{"type":121,"value":2693},{"type":115,"tag":756,"props":5333,"children":5334},{"style":1382},[5335],{"type":121,"value":5336},"() ",{"type":115,"tag":756,"props":5338,"children":5339},{"style":1376},[5340],{"type":121,"value":1446},{"type":115,"tag":756,"props":5342,"children":5343},{"style":1382},[5344],{"type":121,"value":1550},{"type":115,"tag":756,"props":5346,"children":5347},{"style":1376},[5348],{"type":121,"value":1538},{"type":115,"tag":756,"props":5350,"children":5351},{"class":758,"line":2148},[5352,5357,5361,5365,5369],{"type":115,"tag":756,"props":5353,"children":5354},{"style":1477},[5355],{"type":121,"value":5356},"      needsApproval",{"type":115,"tag":756,"props":5358,"children":5359},{"style":1376},[5360],{"type":121,"value":1485},{"type":115,"tag":756,"props":5362,"children":5363},{"style":3510},[5364],{"type":121,"value":3513},{"type":115,"tag":756,"props":5366,"children":5367},{"style":1376},[5368],{"type":121,"value":1503},{"type":115,"tag":756,"props":5370,"children":5371},{"style":802},[5372],{"type":121,"value":5373}," \u002F\u002F Always require approval\n",{"type":115,"tag":756,"props":5375,"children":5376},{"class":758,"line":2178},[5377,5381,5385,5389,5393,5397,5401,5405],{"type":115,"tag":756,"props":5378,"children":5379},{"style":1459},[5380],{"type":121,"value":3530},{"type":115,"tag":756,"props":5382,"children":5383},{"style":1376},[5384],{"type":121,"value":1485},{"type":115,"tag":756,"props":5386,"children":5387},{"style":1429},[5388],{"type":121,"value":3539},{"type":115,"tag":756,"props":5390,"children":5391},{"style":1376},[5392],{"type":121,"value":3544},{"type":115,"tag":756,"props":5394,"children":5395},{"style":3547},[5396],{"type":121,"value":5315},{"type":115,"tag":756,"props":5398,"children":5399},{"style":1376},[5400],{"type":121,"value":3555},{"type":115,"tag":756,"props":5402,"children":5403},{"style":1429},[5404],{"type":121,"value":3560},{"type":115,"tag":756,"props":5406,"children":5407},{"style":1376},[5408],{"type":121,"value":3221},{"type":115,"tag":756,"props":5410,"children":5411},{"class":758,"line":2206},[5412,5417,5422,5426,5431,5435,5440,5444,5449,5453],{"type":115,"tag":756,"props":5413,"children":5414},{"style":1370},[5415],{"type":121,"value":5416},"        await",{"type":115,"tag":756,"props":5418,"children":5419},{"style":1382},[5420],{"type":121,"value":5421}," db",{"type":115,"tag":756,"props":5423,"children":5424},{"style":1376},[5425],{"type":121,"value":352},{"type":115,"tag":756,"props":5427,"children":5428},{"style":1382},[5429],{"type":121,"value":5430},"users",{"type":115,"tag":756,"props":5432,"children":5433},{"style":1376},[5434],{"type":121,"value":352},{"type":115,"tag":756,"props":5436,"children":5437},{"style":1459},[5438],{"type":121,"value":5439},"delete",{"type":115,"tag":756,"props":5441,"children":5442},{"style":1477},[5443],{"type":121,"value":1466},{"type":115,"tag":756,"props":5445,"children":5446},{"style":1382},[5447],{"type":121,"value":5448},"userId",{"type":115,"tag":756,"props":5450,"children":5451},{"style":1477},[5452],{"type":121,"value":1550},{"type":115,"tag":756,"props":5454,"children":5455},{"style":1376},[5456],{"type":121,"value":1414},{"type":115,"tag":756,"props":5458,"children":5459},{"class":758,"line":2235},[5460,5464,5468,5473,5477,5481],{"type":115,"tag":756,"props":5461,"children":5462},{"style":1370},[5463],{"type":121,"value":3615},{"type":115,"tag":756,"props":5465,"children":5466},{"style":1376},[5467],{"type":121,"value":1379},{"type":115,"tag":756,"props":5469,"children":5470},{"style":1477},[5471],{"type":121,"value":5472}," deleted",{"type":115,"tag":756,"props":5474,"children":5475},{"style":1376},[5476],{"type":121,"value":1485},{"type":115,"tag":756,"props":5478,"children":5479},{"style":3510},[5480],{"type":121,"value":3513},{"type":115,"tag":756,"props":5482,"children":5483},{"style":1376},[5484],{"type":121,"value":3672},{"type":115,"tag":756,"props":5486,"children":5487},{"class":758,"line":2251},[5488],{"type":115,"tag":756,"props":5489,"children":5490},{"style":1376},[5491],{"type":121,"value":3680},{"type":115,"tag":756,"props":5493,"children":5494},{"class":758,"line":2259},[5495,5499,5503],{"type":115,"tag":756,"props":5496,"children":5497},{"style":1376},[5498],{"type":121,"value":2919},{"type":115,"tag":756,"props":5500,"children":5501},{"style":1382},[5502],{"type":121,"value":1550},{"type":115,"tag":756,"props":5504,"children":5505},{"style":1376},[5506],{"type":121,"value":1538},{"type":115,"tag":756,"props":5508,"children":5509},{"class":758,"line":2308},[5510,5515,5519,5523,5527],{"type":115,"tag":756,"props":5511,"children":5512},{"style":1477},[5513],{"type":121,"value":5514},"    processPayment",{"type":115,"tag":756,"props":5516,"children":5517},{"style":1376},[5518],{"type":121,"value":1485},{"type":115,"tag":756,"props":5520,"children":5521},{"style":1459},[5522],{"type":121,"value":3076},{"type":115,"tag":756,"props":5524,"children":5525},{"style":1382},[5526],{"type":121,"value":1466},{"type":115,"tag":756,"props":5528,"children":5529},{"style":1376},[5530],{"type":121,"value":1471},{"type":115,"tag":756,"props":5532,"children":5533},{"class":758,"line":2352},[5534,5538,5542,5546,5551,5555],{"type":115,"tag":756,"props":5535,"children":5536},{"style":1477},[5537],{"type":121,"value":3253},{"type":115,"tag":756,"props":5539,"children":5540},{"style":1376},[5541],{"type":121,"value":1485},{"type":115,"tag":756,"props":5543,"children":5544},{"style":1376},[5545],{"type":121,"value":1400},{"type":115,"tag":756,"props":5547,"children":5548},{"style":769},[5549],{"type":121,"value":5550},"Process a payment",{"type":115,"tag":756,"props":5552,"children":5553},{"style":1376},[5554],{"type":121,"value":1409},{"type":115,"tag":756,"props":5556,"children":5557},{"style":1376},[5558],{"type":121,"value":1538},{"type":115,"tag":756,"props":5560,"children":5561},{"class":758,"line":2913},[5562,5566,5570,5574,5578,5582,5586,5590,5595,5599,5603,5607,5611,5615,5619,5624,5628,5632,5636,5640,5644,5648,5652],{"type":115,"tag":756,"props":5563,"children":5564},{"style":1477},[5565],{"type":121,"value":3282},{"type":115,"tag":756,"props":5567,"children":5568},{"style":1376},[5569],{"type":121,"value":1485},{"type":115,"tag":756,"props":5571,"children":5572},{"style":1382},[5573],{"type":121,"value":2472},{"type":115,"tag":756,"props":5575,"children":5576},{"style":1376},[5577],{"type":121,"value":352},{"type":115,"tag":756,"props":5579,"children":5580},{"style":1459},[5581],{"type":121,"value":2596},{"type":115,"tag":756,"props":5583,"children":5584},{"style":1382},[5585],{"type":121,"value":1466},{"type":115,"tag":756,"props":5587,"children":5588},{"style":1376},[5589],{"type":121,"value":5310},{"type":115,"tag":756,"props":5591,"children":5592},{"style":1477},[5593],{"type":121,"value":5594}," amount",{"type":115,"tag":756,"props":5596,"children":5597},{"style":1376},[5598],{"type":121,"value":1485},{"type":115,"tag":756,"props":5600,"children":5601},{"style":1382},[5602],{"type":121,"value":2472},{"type":115,"tag":756,"props":5604,"children":5605},{"style":1376},[5606],{"type":121,"value":352},{"type":115,"tag":756,"props":5608,"children":5609},{"style":1459},[5610],{"type":121,"value":3440},{"type":115,"tag":756,"props":5612,"children":5613},{"style":1382},[5614],{"type":121,"value":2698},{"type":115,"tag":756,"props":5616,"children":5617},{"style":1376},[5618],{"type":121,"value":1503},{"type":115,"tag":756,"props":5620,"children":5621},{"style":1477},[5622],{"type":121,"value":5623}," recipient",{"type":115,"tag":756,"props":5625,"children":5626},{"style":1376},[5627],{"type":121,"value":1485},{"type":115,"tag":756,"props":5629,"children":5630},{"style":1382},[5631],{"type":121,"value":2472},{"type":115,"tag":756,"props":5633,"children":5634},{"style":1376},[5635],{"type":121,"value":352},{"type":115,"tag":756,"props":5637,"children":5638},{"style":1459},[5639],{"type":121,"value":2693},{"type":115,"tag":756,"props":5641,"children":5642},{"style":1382},[5643],{"type":121,"value":5336},{"type":115,"tag":756,"props":5645,"children":5646},{"style":1376},[5647],{"type":121,"value":1446},{"type":115,"tag":756,"props":5649,"children":5650},{"style":1382},[5651],{"type":121,"value":1550},{"type":115,"tag":756,"props":5653,"children":5654},{"style":1376},[5655],{"type":121,"value":1538},{"type":115,"tag":756,"props":5657,"children":5658},{"class":758,"line":2930},[5659],{"type":115,"tag":756,"props":5660,"children":5661},{"style":802},[5662],{"type":121,"value":5663},"      \u002F\u002F Conditional: only approve large amounts\n",{"type":115,"tag":756,"props":5665,"children":5666},{"class":758,"line":2947},[5667,5671,5675,5679,5683,5687,5691,5695,5700,5704,5709],{"type":115,"tag":756,"props":5668,"children":5669},{"style":1459},[5670],{"type":121,"value":5356},{"type":115,"tag":756,"props":5672,"children":5673},{"style":1376},[5674],{"type":121,"value":1485},{"type":115,"tag":756,"props":5676,"children":5677},{"style":1429},[5678],{"type":121,"value":3539},{"type":115,"tag":756,"props":5680,"children":5681},{"style":1376},[5682],{"type":121,"value":3544},{"type":115,"tag":756,"props":5684,"children":5685},{"style":3547},[5686],{"type":121,"value":5594},{"type":115,"tag":756,"props":5688,"children":5689},{"style":1376},[5690],{"type":121,"value":3555},{"type":115,"tag":756,"props":5692,"children":5693},{"style":1429},[5694],{"type":121,"value":3560},{"type":115,"tag":756,"props":5696,"children":5697},{"style":1382},[5698],{"type":121,"value":5699}," amount ",{"type":115,"tag":756,"props":5701,"children":5702},{"style":1376},[5703],{"type":121,"value":4403},{"type":115,"tag":756,"props":5705,"children":5706},{"style":4406},[5707],{"type":121,"value":5708}," 1000",{"type":115,"tag":756,"props":5710,"children":5711},{"style":1376},[5712],{"type":121,"value":1538},{"type":115,"tag":756,"props":5714,"children":5715},{"class":758,"line":2976},[5716,5720,5724,5728,5732,5736,5740,5744,5748,5752],{"type":115,"tag":756,"props":5717,"children":5718},{"style":1459},[5719],{"type":121,"value":3530},{"type":115,"tag":756,"props":5721,"children":5722},{"style":1376},[5723],{"type":121,"value":1485},{"type":115,"tag":756,"props":5725,"children":5726},{"style":1429},[5727],{"type":121,"value":3539},{"type":115,"tag":756,"props":5729,"children":5730},{"style":1376},[5731],{"type":121,"value":3544},{"type":115,"tag":756,"props":5733,"children":5734},{"style":3547},[5735],{"type":121,"value":5594},{"type":115,"tag":756,"props":5737,"children":5738},{"style":1376},[5739],{"type":121,"value":1503},{"type":115,"tag":756,"props":5741,"children":5742},{"style":3547},[5743],{"type":121,"value":5623},{"type":115,"tag":756,"props":5745,"children":5746},{"style":1376},[5747],{"type":121,"value":3555},{"type":115,"tag":756,"props":5749,"children":5750},{"style":1429},[5751],{"type":121,"value":3560},{"type":115,"tag":756,"props":5753,"children":5754},{"style":1376},[5755],{"type":121,"value":3221},{"type":115,"tag":756,"props":5757,"children":5758},{"class":758,"line":3698},[5759,5763,5767,5772,5776,5781,5785,5789,5793],{"type":115,"tag":756,"props":5760,"children":5761},{"style":1370},[5762],{"type":121,"value":3615},{"type":115,"tag":756,"props":5764,"children":5765},{"style":1370},[5766],{"type":121,"value":1456},{"type":115,"tag":756,"props":5768,"children":5769},{"style":1459},[5770],{"type":121,"value":5771}," processPayment",{"type":115,"tag":756,"props":5773,"children":5774},{"style":1477},[5775],{"type":121,"value":1466},{"type":115,"tag":756,"props":5777,"children":5778},{"style":1382},[5779],{"type":121,"value":5780},"amount",{"type":115,"tag":756,"props":5782,"children":5783},{"style":1376},[5784],{"type":121,"value":1503},{"type":115,"tag":756,"props":5786,"children":5787},{"style":1382},[5788],{"type":121,"value":5623},{"type":115,"tag":756,"props":5790,"children":5791},{"style":1477},[5792],{"type":121,"value":1550},{"type":115,"tag":756,"props":5794,"children":5795},{"style":1376},[5796],{"type":121,"value":1414},{"type":115,"tag":756,"props":5798,"children":5799},{"class":758,"line":3707},[5800],{"type":115,"tag":756,"props":5801,"children":5802},{"style":1376},[5803],{"type":121,"value":3680},{"type":115,"tag":756,"props":5805,"children":5806},{"class":758,"line":3736},[5807,5811,5815],{"type":115,"tag":756,"props":5808,"children":5809},{"style":1376},[5810],{"type":121,"value":2919},{"type":115,"tag":756,"props":5812,"children":5813},{"style":1382},[5814],{"type":121,"value":1550},{"type":115,"tag":756,"props":5816,"children":5817},{"style":1376},[5818],{"type":121,"value":1538},{"type":115,"tag":756,"props":5820,"children":5822},{"class":758,"line":5821},25,[5823],{"type":115,"tag":756,"props":5824,"children":5825},{"style":1376},[5826],{"type":121,"value":3704},{"type":115,"tag":756,"props":5828,"children":5830},{"class":758,"line":5829},26,[5831,5835,5839,5843,5848,5852],{"type":115,"tag":756,"props":5832,"children":5833},{"style":1477},[5834],{"type":121,"value":1516},{"type":115,"tag":756,"props":5836,"children":5837},{"style":1376},[5838],{"type":121,"value":1485},{"type":115,"tag":756,"props":5840,"children":5841},{"style":1376},[5842],{"type":121,"value":1400},{"type":115,"tag":756,"props":5844,"children":5845},{"style":769},[5846],{"type":121,"value":5847},"Delete user 123",{"type":115,"tag":756,"props":5849,"children":5850},{"style":1376},[5851],{"type":121,"value":1409},{"type":115,"tag":756,"props":5853,"children":5854},{"style":1376},[5855],{"type":121,"value":1538},{"type":115,"tag":756,"props":5857,"children":5859},{"class":758,"line":5858},27,[5860,5864,5868],{"type":115,"tag":756,"props":5861,"children":5862},{"style":1376},[5863],{"type":121,"value":1446},{"type":115,"tag":756,"props":5865,"children":5866},{"style":1382},[5867],{"type":121,"value":1550},{"type":115,"tag":756,"props":5869,"children":5870},{"style":1376},[5871],{"type":121,"value":1414},{"type":115,"tag":128,"props":5873,"children":5874},{},[5875],{"type":115,"tag":132,"props":5876,"children":5877},{},[5878,5880,5885],{"type":121,"value":5879},"Client-side approval with ",{"type":115,"tag":157,"props":5881,"children":5883},{"className":5882},[],[5884],{"type":121,"value":209},{"type":121,"value":1485},{"type":115,"tag":745,"props":5887,"children":5891},{"className":5888,"code":5889,"language":5890,"meta":750,"style":750},"language-tsx shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\"use client\";\nimport { useChat } from \"@ai-sdk\u002Freact\";\n\nfunction Chat() {\n  const { messages, addToolApprovalResponse } = useChat();\n\n  return messages.map((m) =>\n    m.parts?.map((part, i) => {\n      \u002F\u002F Tool parts in approval-requested state need user action\n      if (part.type.startsWith(\"tool-\") && part.approval?.state === \"approval-requested\") {\n        return (\n          \u003Cdiv key={i}>\n            \u003Cp>Tool wants to run: {JSON.stringify(part.args)}\u003C\u002Fp>\n            \u003Cbutton onClick={() => addToolApprovalResponse({ id: part.approval.id, approved: true })}>\n              Approve\n            \u003C\u002Fbutton>\n            \u003Cbutton onClick={() => addToolApprovalResponse({ id: part.approval.id, approved: false })}>\n              Deny\n            \u003C\u002Fbutton>\n          \u003C\u002Fdiv>\n        );\n      }\n      return null;\n    }),\n  );\n}\n","tsx",[5892],{"type":115,"tag":157,"props":5893,"children":5894},{"__ignoreMap":750},[5895,5915,5955,5962,5983,6029,6036,6079,6139,6147,6256,6268,6301,6368,6465,6473,6489,6581,6589,6604,6620,6631,6639,6651,6666,6678],{"type":115,"tag":756,"props":5896,"children":5897},{"class":758,"line":759},[5898,5902,5907,5911],{"type":115,"tag":756,"props":5899,"children":5900},{"style":1376},[5901],{"type":121,"value":1409},{"type":115,"tag":756,"props":5903,"children":5904},{"style":769},[5905],{"type":121,"value":5906},"use client",{"type":115,"tag":756,"props":5908,"children":5909},{"style":1376},[5910],{"type":121,"value":1409},{"type":115,"tag":756,"props":5912,"children":5913},{"style":1376},[5914],{"type":121,"value":1414},{"type":115,"tag":756,"props":5916,"children":5917},{"class":758,"line":785},[5918,5922,5926,5931,5935,5939,5943,5947,5951],{"type":115,"tag":756,"props":5919,"children":5920},{"style":1370},[5921],{"type":121,"value":1373},{"type":115,"tag":756,"props":5923,"children":5924},{"style":1376},[5925],{"type":121,"value":1379},{"type":115,"tag":756,"props":5927,"children":5928},{"style":1382},[5929],{"type":121,"value":5930}," useChat",{"type":115,"tag":756,"props":5932,"children":5933},{"style":1376},[5934],{"type":121,"value":1390},{"type":115,"tag":756,"props":5936,"children":5937},{"style":1370},[5938],{"type":121,"value":1395},{"type":115,"tag":756,"props":5940,"children":5941},{"style":1376},[5942],{"type":121,"value":1400},{"type":115,"tag":756,"props":5944,"children":5945},{"style":769},[5946],{"type":121,"value":248},{"type":115,"tag":756,"props":5948,"children":5949},{"style":1376},[5950],{"type":121,"value":1409},{"type":115,"tag":756,"props":5952,"children":5953},{"style":1376},[5954],{"type":121,"value":1414},{"type":115,"tag":756,"props":5956,"children":5957},{"class":758,"line":808},[5958],{"type":115,"tag":756,"props":5959,"children":5960},{"emptyLinePlaceholder":1420},[5961],{"type":121,"value":1423},{"type":115,"tag":756,"props":5963,"children":5964},{"class":758,"line":830},[5965,5970,5975,5979],{"type":115,"tag":756,"props":5966,"children":5967},{"style":1429},[5968],{"type":121,"value":5969},"function",{"type":115,"tag":756,"props":5971,"children":5972},{"style":1459},[5973],{"type":121,"value":5974}," Chat",{"type":115,"tag":756,"props":5976,"children":5977},{"style":1376},[5978],{"type":121,"value":2698},{"type":115,"tag":756,"props":5980,"children":5981},{"style":1376},[5982],{"type":121,"value":3221},{"type":115,"tag":756,"props":5984,"children":5985},{"class":758,"line":1251},[5986,5991,5995,6000,6004,6009,6013,6017,6021,6025],{"type":115,"tag":756,"props":5987,"children":5988},{"style":1429},[5989],{"type":121,"value":5990},"  const",{"type":115,"tag":756,"props":5992,"children":5993},{"style":1376},[5994],{"type":121,"value":1379},{"type":115,"tag":756,"props":5996,"children":5997},{"style":1382},[5998],{"type":121,"value":5999}," messages",{"type":115,"tag":756,"props":6001,"children":6002},{"style":1376},[6003],{"type":121,"value":1503},{"type":115,"tag":756,"props":6005,"children":6006},{"style":1382},[6007],{"type":121,"value":6008}," addToolApprovalResponse",{"type":115,"tag":756,"props":6010,"children":6011},{"style":1376},[6012],{"type":121,"value":1390},{"type":115,"tag":756,"props":6014,"children":6015},{"style":1376},[6016],{"type":121,"value":1451},{"type":115,"tag":756,"props":6018,"children":6019},{"style":1459},[6020],{"type":121,"value":5930},{"type":115,"tag":756,"props":6022,"children":6023},{"style":1477},[6024],{"type":121,"value":2698},{"type":115,"tag":756,"props":6026,"children":6027},{"style":1376},[6028],{"type":121,"value":1414},{"type":115,"tag":756,"props":6030,"children":6031},{"class":758,"line":110},[6032],{"type":115,"tag":756,"props":6033,"children":6034},{"emptyLinePlaceholder":1420},[6035],{"type":121,"value":1423},{"type":115,"tag":756,"props":6037,"children":6038},{"class":758,"line":1817},[6039,6044,6048,6052,6057,6061,6065,6070,6074],{"type":115,"tag":756,"props":6040,"children":6041},{"style":1370},[6042],{"type":121,"value":6043},"  return",{"type":115,"tag":756,"props":6045,"children":6046},{"style":1382},[6047],{"type":121,"value":5999},{"type":115,"tag":756,"props":6049,"children":6050},{"style":1376},[6051],{"type":121,"value":352},{"type":115,"tag":756,"props":6053,"children":6054},{"style":1459},[6055],{"type":121,"value":6056},"map",{"type":115,"tag":756,"props":6058,"children":6059},{"style":1477},[6060],{"type":121,"value":1466},{"type":115,"tag":756,"props":6062,"children":6063},{"style":1376},[6064],{"type":121,"value":1466},{"type":115,"tag":756,"props":6066,"children":6067},{"style":3547},[6068],{"type":121,"value":6069},"m",{"type":115,"tag":756,"props":6071,"children":6072},{"style":1376},[6073],{"type":121,"value":1550},{"type":115,"tag":756,"props":6075,"children":6076},{"style":1429},[6077],{"type":121,"value":6078}," =>\n",{"type":115,"tag":756,"props":6080,"children":6081},{"class":758,"line":42},[6082,6087,6091,6096,6101,6105,6109,6113,6118,6122,6127,6131,6135],{"type":115,"tag":756,"props":6083,"children":6084},{"style":1382},[6085],{"type":121,"value":6086},"    m",{"type":115,"tag":756,"props":6088,"children":6089},{"style":1376},[6090],{"type":121,"value":352},{"type":115,"tag":756,"props":6092,"children":6093},{"style":1382},[6094],{"type":121,"value":6095},"parts",{"type":115,"tag":756,"props":6097,"children":6098},{"style":1376},[6099],{"type":121,"value":6100},"?.",{"type":115,"tag":756,"props":6102,"children":6103},{"style":1459},[6104],{"type":121,"value":6056},{"type":115,"tag":756,"props":6106,"children":6107},{"style":1477},[6108],{"type":121,"value":1466},{"type":115,"tag":756,"props":6110,"children":6111},{"style":1376},[6112],{"type":121,"value":1466},{"type":115,"tag":756,"props":6114,"children":6115},{"style":3547},[6116],{"type":121,"value":6117},"part",{"type":115,"tag":756,"props":6119,"children":6120},{"style":1376},[6121],{"type":121,"value":1503},{"type":115,"tag":756,"props":6123,"children":6124},{"style":3547},[6125],{"type":121,"value":6126}," i",{"type":115,"tag":756,"props":6128,"children":6129},{"style":1376},[6130],{"type":121,"value":1550},{"type":115,"tag":756,"props":6132,"children":6133},{"style":1429},[6134],{"type":121,"value":3560},{"type":115,"tag":756,"props":6136,"children":6137},{"style":1376},[6138],{"type":121,"value":3221},{"type":115,"tag":756,"props":6140,"children":6141},{"class":758,"line":2139},[6142],{"type":115,"tag":756,"props":6143,"children":6144},{"style":802},[6145],{"type":121,"value":6146},"      \u002F\u002F Tool parts in approval-requested state need user action\n",{"type":115,"tag":756,"props":6148,"children":6149},{"class":758,"line":2148},[6150,6155,6159,6163,6167,6172,6176,6181,6185,6189,6194,6198,6203,6208,6213,6217,6222,6226,6231,6236,6240,6244,6248,6252],{"type":115,"tag":756,"props":6151,"children":6152},{"style":1370},[6153],{"type":121,"value":6154},"      if",{"type":115,"tag":756,"props":6156,"children":6157},{"style":1477},[6158],{"type":121,"value":1923},{"type":115,"tag":756,"props":6160,"children":6161},{"style":1382},[6162],{"type":121,"value":6117},{"type":115,"tag":756,"props":6164,"children":6165},{"style":1376},[6166],{"type":121,"value":352},{"type":115,"tag":756,"props":6168,"children":6169},{"style":1382},[6170],{"type":121,"value":6171},"type",{"type":115,"tag":756,"props":6173,"children":6174},{"style":1376},[6175],{"type":121,"value":352},{"type":115,"tag":756,"props":6177,"children":6178},{"style":1459},[6179],{"type":121,"value":6180},"startsWith",{"type":115,"tag":756,"props":6182,"children":6183},{"style":1477},[6184],{"type":121,"value":1466},{"type":115,"tag":756,"props":6186,"children":6187},{"style":1376},[6188],{"type":121,"value":1409},{"type":115,"tag":756,"props":6190,"children":6191},{"style":769},[6192],{"type":121,"value":6193},"tool-",{"type":115,"tag":756,"props":6195,"children":6196},{"style":1376},[6197],{"type":121,"value":1409},{"type":115,"tag":756,"props":6199,"children":6200},{"style":1477},[6201],{"type":121,"value":6202},") ",{"type":115,"tag":756,"props":6204,"children":6205},{"style":1376},[6206],{"type":121,"value":6207},"&&",{"type":115,"tag":756,"props":6209,"children":6210},{"style":1382},[6211],{"type":121,"value":6212}," part",{"type":115,"tag":756,"props":6214,"children":6215},{"style":1376},[6216],{"type":121,"value":352},{"type":115,"tag":756,"props":6218,"children":6219},{"style":1382},[6220],{"type":121,"value":6221},"approval",{"type":115,"tag":756,"props":6223,"children":6224},{"style":1376},[6225],{"type":121,"value":6100},{"type":115,"tag":756,"props":6227,"children":6228},{"style":1382},[6229],{"type":121,"value":6230},"state",{"type":115,"tag":756,"props":6232,"children":6233},{"style":1376},[6234],{"type":121,"value":6235}," ===",{"type":115,"tag":756,"props":6237,"children":6238},{"style":1376},[6239],{"type":121,"value":1400},{"type":115,"tag":756,"props":6241,"children":6242},{"style":769},[6243],{"type":121,"value":5055},{"type":115,"tag":756,"props":6245,"children":6246},{"style":1376},[6247],{"type":121,"value":1409},{"type":115,"tag":756,"props":6249,"children":6250},{"style":1477},[6251],{"type":121,"value":6202},{"type":115,"tag":756,"props":6253,"children":6254},{"style":1376},[6255],{"type":121,"value":1471},{"type":115,"tag":756,"props":6257,"children":6258},{"class":758,"line":2178},[6259,6263],{"type":115,"tag":756,"props":6260,"children":6261},{"style":1370},[6262],{"type":121,"value":3615},{"type":115,"tag":756,"props":6264,"children":6265},{"style":1477},[6266],{"type":121,"value":6267}," (\n",{"type":115,"tag":756,"props":6269,"children":6270},{"class":758,"line":2206},[6271,6276,6281,6286,6291,6296],{"type":115,"tag":756,"props":6272,"children":6273},{"style":1376},[6274],{"type":121,"value":6275},"          \u003C",{"type":115,"tag":756,"props":6277,"children":6278},{"style":1477},[6279],{"type":121,"value":6280},"div",{"type":115,"tag":756,"props":6282,"children":6283},{"style":1429},[6284],{"type":121,"value":6285}," key",{"type":115,"tag":756,"props":6287,"children":6288},{"style":1376},[6289],{"type":121,"value":6290},"={",{"type":115,"tag":756,"props":6292,"children":6293},{"style":1382},[6294],{"type":121,"value":6295},"i",{"type":115,"tag":756,"props":6297,"children":6298},{"style":1376},[6299],{"type":121,"value":6300},"}>\n",{"type":115,"tag":756,"props":6302,"children":6303},{"class":758,"line":2235},[6304,6309,6313,6317,6322,6326,6331,6335,6340,6345,6349,6354,6359,6363],{"type":115,"tag":756,"props":6305,"children":6306},{"style":1376},[6307],{"type":121,"value":6308},"            \u003C",{"type":115,"tag":756,"props":6310,"children":6311},{"style":1477},[6312],{"type":121,"value":128},{"type":115,"tag":756,"props":6314,"children":6315},{"style":1376},[6316],{"type":121,"value":4403},{"type":115,"tag":756,"props":6318,"children":6319},{"style":1382},[6320],{"type":121,"value":6321},"Tool wants to run: ",{"type":115,"tag":756,"props":6323,"children":6324},{"style":1376},[6325],{"type":121,"value":5310},{"type":115,"tag":756,"props":6327,"children":6328},{"style":1382},[6329],{"type":121,"value":6330},"JSON",{"type":115,"tag":756,"props":6332,"children":6333},{"style":1376},[6334],{"type":121,"value":352},{"type":115,"tag":756,"props":6336,"children":6337},{"style":1459},[6338],{"type":121,"value":6339},"stringify",{"type":115,"tag":756,"props":6341,"children":6342},{"style":1382},[6343],{"type":121,"value":6344},"(part",{"type":115,"tag":756,"props":6346,"children":6347},{"style":1376},[6348],{"type":121,"value":352},{"type":115,"tag":756,"props":6350,"children":6351},{"style":1382},[6352],{"type":121,"value":6353},"args)",{"type":115,"tag":756,"props":6355,"children":6356},{"style":1376},[6357],{"type":121,"value":6358},"}\u003C\u002F",{"type":115,"tag":756,"props":6360,"children":6361},{"style":1477},[6362],{"type":121,"value":128},{"type":115,"tag":756,"props":6364,"children":6365},{"style":1376},[6366],{"type":121,"value":6367},">\n",{"type":115,"tag":756,"props":6369,"children":6370},{"class":758,"line":2251},[6371,6375,6380,6385,6390,6394,6398,6402,6406,6411,6415,6419,6423,6427,6431,6436,6440,6445,6449,6453,6457,6461],{"type":115,"tag":756,"props":6372,"children":6373},{"style":1376},[6374],{"type":121,"value":6308},{"type":115,"tag":756,"props":6376,"children":6377},{"style":1477},[6378],{"type":121,"value":6379},"button",{"type":115,"tag":756,"props":6381,"children":6382},{"style":1429},[6383],{"type":121,"value":6384}," onClick",{"type":115,"tag":756,"props":6386,"children":6387},{"style":1376},[6388],{"type":121,"value":6389},"={()",{"type":115,"tag":756,"props":6391,"children":6392},{"style":1429},[6393],{"type":121,"value":3560},{"type":115,"tag":756,"props":6395,"children":6396},{"style":1459},[6397],{"type":121,"value":6008},{"type":115,"tag":756,"props":6399,"children":6400},{"style":1382},[6401],{"type":121,"value":1466},{"type":115,"tag":756,"props":6403,"children":6404},{"style":1376},[6405],{"type":121,"value":5310},{"type":115,"tag":756,"props":6407,"children":6408},{"style":1477},[6409],{"type":121,"value":6410}," id",{"type":115,"tag":756,"props":6412,"children":6413},{"style":1376},[6414],{"type":121,"value":1485},{"type":115,"tag":756,"props":6416,"children":6417},{"style":1382},[6418],{"type":121,"value":6212},{"type":115,"tag":756,"props":6420,"children":6421},{"style":1376},[6422],{"type":121,"value":352},{"type":115,"tag":756,"props":6424,"children":6425},{"style":1382},[6426],{"type":121,"value":6221},{"type":115,"tag":756,"props":6428,"children":6429},{"style":1376},[6430],{"type":121,"value":352},{"type":115,"tag":756,"props":6432,"children":6433},{"style":1382},[6434],{"type":121,"value":6435},"id",{"type":115,"tag":756,"props":6437,"children":6438},{"style":1376},[6439],{"type":121,"value":1503},{"type":115,"tag":756,"props":6441,"children":6442},{"style":1477},[6443],{"type":121,"value":6444}," approved",{"type":115,"tag":756,"props":6446,"children":6447},{"style":1376},[6448],{"type":121,"value":1485},{"type":115,"tag":756,"props":6450,"children":6451},{"style":3510},[6452],{"type":121,"value":3513},{"type":115,"tag":756,"props":6454,"children":6455},{"style":1376},[6456],{"type":121,"value":1390},{"type":115,"tag":756,"props":6458,"children":6459},{"style":1382},[6460],{"type":121,"value":1550},{"type":115,"tag":756,"props":6462,"children":6463},{"style":1376},[6464],{"type":121,"value":6300},{"type":115,"tag":756,"props":6466,"children":6467},{"class":758,"line":2259},[6468],{"type":115,"tag":756,"props":6469,"children":6470},{"style":1382},[6471],{"type":121,"value":6472},"              Approve\n",{"type":115,"tag":756,"props":6474,"children":6475},{"class":758,"line":2308},[6476,6481,6485],{"type":115,"tag":756,"props":6477,"children":6478},{"style":1376},[6479],{"type":121,"value":6480},"            \u003C\u002F",{"type":115,"tag":756,"props":6482,"children":6483},{"style":1477},[6484],{"type":121,"value":6379},{"type":115,"tag":756,"props":6486,"children":6487},{"style":1376},[6488],{"type":121,"value":6367},{"type":115,"tag":756,"props":6490,"children":6491},{"class":758,"line":2352},[6492,6496,6500,6504,6508,6512,6516,6520,6524,6528,6532,6536,6540,6544,6548,6552,6556,6560,6564,6569,6573,6577],{"type":115,"tag":756,"props":6493,"children":6494},{"style":1376},[6495],{"type":121,"value":6308},{"type":115,"tag":756,"props":6497,"children":6498},{"style":1477},[6499],{"type":121,"value":6379},{"type":115,"tag":756,"props":6501,"children":6502},{"style":1429},[6503],{"type":121,"value":6384},{"type":115,"tag":756,"props":6505,"children":6506},{"style":1376},[6507],{"type":121,"value":6389},{"type":115,"tag":756,"props":6509,"children":6510},{"style":1429},[6511],{"type":121,"value":3560},{"type":115,"tag":756,"props":6513,"children":6514},{"style":1459},[6515],{"type":121,"value":6008},{"type":115,"tag":756,"props":6517,"children":6518},{"style":1382},[6519],{"type":121,"value":1466},{"type":115,"tag":756,"props":6521,"children":6522},{"style":1376},[6523],{"type":121,"value":5310},{"type":115,"tag":756,"props":6525,"children":6526},{"style":1477},[6527],{"type":121,"value":6410},{"type":115,"tag":756,"props":6529,"children":6530},{"style":1376},[6531],{"type":121,"value":1485},{"type":115,"tag":756,"props":6533,"children":6534},{"style":1382},[6535],{"type":121,"value":6212},{"type":115,"tag":756,"props":6537,"children":6538},{"style":1376},[6539],{"type":121,"value":352},{"type":115,"tag":756,"props":6541,"children":6542},{"style":1382},[6543],{"type":121,"value":6221},{"type":115,"tag":756,"props":6545,"children":6546},{"style":1376},[6547],{"type":121,"value":352},{"type":115,"tag":756,"props":6549,"children":6550},{"style":1382},[6551],{"type":121,"value":6435},{"type":115,"tag":756,"props":6553,"children":6554},{"style":1376},[6555],{"type":121,"value":1503},{"type":115,"tag":756,"props":6557,"children":6558},{"style":1477},[6559],{"type":121,"value":6444},{"type":115,"tag":756,"props":6561,"children":6562},{"style":1376},[6563],{"type":121,"value":1485},{"type":115,"tag":756,"props":6565,"children":6566},{"style":3510},[6567],{"type":121,"value":6568}," false",{"type":115,"tag":756,"props":6570,"children":6571},{"style":1376},[6572],{"type":121,"value":1390},{"type":115,"tag":756,"props":6574,"children":6575},{"style":1382},[6576],{"type":121,"value":1550},{"type":115,"tag":756,"props":6578,"children":6579},{"style":1376},[6580],{"type":121,"value":6300},{"type":115,"tag":756,"props":6582,"children":6583},{"class":758,"line":2913},[6584],{"type":115,"tag":756,"props":6585,"children":6586},{"style":1382},[6587],{"type":121,"value":6588},"              Deny\n",{"type":115,"tag":756,"props":6590,"children":6591},{"class":758,"line":2930},[6592,6596,6600],{"type":115,"tag":756,"props":6593,"children":6594},{"style":1376},[6595],{"type":121,"value":6480},{"type":115,"tag":756,"props":6597,"children":6598},{"style":1477},[6599],{"type":121,"value":6379},{"type":115,"tag":756,"props":6601,"children":6602},{"style":1376},[6603],{"type":121,"value":6367},{"type":115,"tag":756,"props":6605,"children":6606},{"class":758,"line":2947},[6607,6612,6616],{"type":115,"tag":756,"props":6608,"children":6609},{"style":1376},[6610],{"type":121,"value":6611},"          \u003C\u002F",{"type":115,"tag":756,"props":6613,"children":6614},{"style":1477},[6615],{"type":121,"value":6280},{"type":115,"tag":756,"props":6617,"children":6618},{"style":1376},[6619],{"type":121,"value":6367},{"type":115,"tag":756,"props":6621,"children":6622},{"class":758,"line":2976},[6623,6627],{"type":115,"tag":756,"props":6624,"children":6625},{"style":1477},[6626],{"type":121,"value":2844},{"type":115,"tag":756,"props":6628,"children":6629},{"style":1376},[6630],{"type":121,"value":1414},{"type":115,"tag":756,"props":6632,"children":6633},{"class":758,"line":3698},[6634],{"type":115,"tag":756,"props":6635,"children":6636},{"style":1376},[6637],{"type":121,"value":6638},"      }\n",{"type":115,"tag":756,"props":6640,"children":6641},{"class":758,"line":3707},[6642,6646],{"type":115,"tag":756,"props":6643,"children":6644},{"style":1370},[6645],{"type":121,"value":3940},{"type":115,"tag":756,"props":6647,"children":6648},{"style":1376},[6649],{"type":121,"value":6650}," null;\n",{"type":115,"tag":756,"props":6652,"children":6653},{"class":758,"line":3736},[6654,6658,6662],{"type":115,"tag":756,"props":6655,"children":6656},{"style":1376},[6657],{"type":121,"value":2919},{"type":115,"tag":756,"props":6659,"children":6660},{"style":1477},[6661],{"type":121,"value":1550},{"type":115,"tag":756,"props":6663,"children":6664},{"style":1376},[6665],{"type":121,"value":1538},{"type":115,"tag":756,"props":6667,"children":6668},{"class":758,"line":5821},[6669,6674],{"type":115,"tag":756,"props":6670,"children":6671},{"style":1477},[6672],{"type":121,"value":6673},"  )",{"type":115,"tag":756,"props":6675,"children":6676},{"style":1376},[6677],{"type":121,"value":1414},{"type":115,"tag":756,"props":6679,"children":6680},{"class":758,"line":5829},[6681],{"type":115,"tag":756,"props":6682,"children":6683},{"style":1376},[6684],{"type":121,"value":2358},{"type":115,"tag":128,"props":6686,"children":6687},{},[6688,6693,6695,6701,6703,6709,6710,6715,6717,6722,6724,6730,6732],{"type":115,"tag":132,"props":6689,"children":6690},{},[6691],{"type":121,"value":6692},"Tool part states:",{"type":121,"value":6694}," ",{"type":115,"tag":157,"props":6696,"children":6698},{"className":6697},[],[6699],{"type":121,"value":6700},"input-streaming",{"type":121,"value":6702}," → ",{"type":115,"tag":157,"props":6704,"children":6706},{"className":6705},[],[6707],{"type":121,"value":6708},"input-available",{"type":121,"value":6702},{"type":115,"tag":157,"props":6711,"children":6713},{"className":6712},[],[6714],{"type":121,"value":5055},{"type":121,"value":6716}," (if ",{"type":115,"tag":157,"props":6718,"children":6720},{"className":6719},[],[6721],{"type":121,"value":5047},{"type":121,"value":6723},") → ",{"type":115,"tag":157,"props":6725,"children":6727},{"className":6726},[],[6728],{"type":121,"value":6729},"output-available",{"type":121,"value":6731}," | ",{"type":115,"tag":157,"props":6733,"children":6735},{"className":6734},[],[6736],{"type":121,"value":6737},"output-error",{"type":115,"tag":1945,"props":6739,"children":6741},{"id":6740},"embeddings-reranking",[6742],{"type":121,"value":6743},"Embeddings & Reranking",{"type":115,"tag":128,"props":6745,"children":6746},{},[6747],{"type":121,"value":6748},"Use a direct provider SDK for embeddings. AI Gateway does not support embedding models.",{"type":115,"tag":745,"props":6750,"children":6752},{"className":1358,"code":6751,"language":1360,"meta":750,"style":750},"import { embed, embedMany, rerank } from \"ai\";\nimport { openai } from \"@ai-sdk\u002Fopenai\";\n\n\u002F\u002F Single embedding\nconst { embedding } = await embed({\n  model: openai.embedding(\"text-embedding-3-small\"),\n  value: \"The quick brown fox\",\n});\n\n\u002F\u002F Batch embeddings\nconst { embeddings } = await embedMany({\n  model: openai.embedding(\"text-embedding-3-small\"),\n  values: [\"text 1\", \"text 2\", \"text 3\"],\n});\n\n\u002F\u002F Rerank search results by relevance\nconst { results } = await rerank({\n  model: cohere.reranker(\"rerank-v3.5\"),\n  query: \"What is quantum computing?\",\n  documents: searchResults,\n});\n",[6753],{"type":115,"tag":157,"props":6754,"children":6755},{"__ignoreMap":750},[6756,6814,6854,6861,6869,6909,6958,6987,7002,7009,7017,7057,7104,7176,7191,7198,7206,7246,7296,7325,7346],{"type":115,"tag":756,"props":6757,"children":6758},{"class":758,"line":759},[6759,6763,6767,6772,6776,6781,6785,6790,6794,6798,6802,6806,6810],{"type":115,"tag":756,"props":6760,"children":6761},{"style":1370},[6762],{"type":121,"value":1373},{"type":115,"tag":756,"props":6764,"children":6765},{"style":1376},[6766],{"type":121,"value":1379},{"type":115,"tag":756,"props":6768,"children":6769},{"style":1382},[6770],{"type":121,"value":6771}," embed",{"type":115,"tag":756,"props":6773,"children":6774},{"style":1376},[6775],{"type":121,"value":1503},{"type":115,"tag":756,"props":6777,"children":6778},{"style":1382},[6779],{"type":121,"value":6780}," embedMany",{"type":115,"tag":756,"props":6782,"children":6783},{"style":1376},[6784],{"type":121,"value":1503},{"type":115,"tag":756,"props":6786,"children":6787},{"style":1382},[6788],{"type":121,"value":6789}," rerank",{"type":115,"tag":756,"props":6791,"children":6792},{"style":1376},[6793],{"type":121,"value":1390},{"type":115,"tag":756,"props":6795,"children":6796},{"style":1370},[6797],{"type":121,"value":1395},{"type":115,"tag":756,"props":6799,"children":6800},{"style":1376},[6801],{"type":121,"value":1400},{"type":115,"tag":756,"props":6803,"children":6804},{"style":769},[6805],{"type":121,"value":76},{"type":115,"tag":756,"props":6807,"children":6808},{"style":1376},[6809],{"type":121,"value":1409},{"type":115,"tag":756,"props":6811,"children":6812},{"style":1376},[6813],{"type":121,"value":1414},{"type":115,"tag":756,"props":6815,"children":6816},{"class":758,"line":785},[6817,6821,6825,6830,6834,6838,6842,6846,6850],{"type":115,"tag":756,"props":6818,"children":6819},{"style":1370},[6820],{"type":121,"value":1373},{"type":115,"tag":756,"props":6822,"children":6823},{"style":1376},[6824],{"type":121,"value":1379},{"type":115,"tag":756,"props":6826,"children":6827},{"style":1382},[6828],{"type":121,"value":6829}," openai",{"type":115,"tag":756,"props":6831,"children":6832},{"style":1376},[6833],{"type":121,"value":1390},{"type":115,"tag":756,"props":6835,"children":6836},{"style":1370},[6837],{"type":121,"value":1395},{"type":115,"tag":756,"props":6839,"children":6840},{"style":1376},[6841],{"type":121,"value":1400},{"type":115,"tag":756,"props":6843,"children":6844},{"style":769},[6845],{"type":121,"value":521},{"type":115,"tag":756,"props":6847,"children":6848},{"style":1376},[6849],{"type":121,"value":1409},{"type":115,"tag":756,"props":6851,"children":6852},{"style":1376},[6853],{"type":121,"value":1414},{"type":115,"tag":756,"props":6855,"children":6856},{"class":758,"line":808},[6857],{"type":115,"tag":756,"props":6858,"children":6859},{"emptyLinePlaceholder":1420},[6860],{"type":121,"value":1423},{"type":115,"tag":756,"props":6862,"children":6863},{"class":758,"line":830},[6864],{"type":115,"tag":756,"props":6865,"children":6866},{"style":802},[6867],{"type":121,"value":6868},"\u002F\u002F Single embedding\n",{"type":115,"tag":756,"props":6870,"children":6871},{"class":758,"line":1251},[6872,6876,6880,6885,6889,6893,6897,6901,6905],{"type":115,"tag":756,"props":6873,"children":6874},{"style":1429},[6875],{"type":121,"value":1432},{"type":115,"tag":756,"props":6877,"children":6878},{"style":1376},[6879],{"type":121,"value":1379},{"type":115,"tag":756,"props":6881,"children":6882},{"style":1382},[6883],{"type":121,"value":6884}," embedding ",{"type":115,"tag":756,"props":6886,"children":6887},{"style":1376},[6888],{"type":121,"value":1446},{"type":115,"tag":756,"props":6890,"children":6891},{"style":1376},[6892],{"type":121,"value":1451},{"type":115,"tag":756,"props":6894,"children":6895},{"style":1370},[6896],{"type":121,"value":1456},{"type":115,"tag":756,"props":6898,"children":6899},{"style":1459},[6900],{"type":121,"value":6771},{"type":115,"tag":756,"props":6902,"children":6903},{"style":1382},[6904],{"type":121,"value":1466},{"type":115,"tag":756,"props":6906,"children":6907},{"style":1376},[6908],{"type":121,"value":1471},{"type":115,"tag":756,"props":6910,"children":6911},{"class":758,"line":110},[6912,6916,6920,6924,6928,6933,6937,6941,6946,6950,6954],{"type":115,"tag":756,"props":6913,"children":6914},{"style":1477},[6915],{"type":121,"value":1480},{"type":115,"tag":756,"props":6917,"children":6918},{"style":1376},[6919],{"type":121,"value":1485},{"type":115,"tag":756,"props":6921,"children":6922},{"style":1382},[6923],{"type":121,"value":6829},{"type":115,"tag":756,"props":6925,"children":6926},{"style":1376},[6927],{"type":121,"value":352},{"type":115,"tag":756,"props":6929,"children":6930},{"style":1459},[6931],{"type":121,"value":6932},"embedding",{"type":115,"tag":756,"props":6934,"children":6935},{"style":1382},[6936],{"type":121,"value":1466},{"type":115,"tag":756,"props":6938,"children":6939},{"style":1376},[6940],{"type":121,"value":1409},{"type":115,"tag":756,"props":6942,"children":6943},{"style":769},[6944],{"type":121,"value":6945},"text-embedding-3-small",{"type":115,"tag":756,"props":6947,"children":6948},{"style":1376},[6949],{"type":121,"value":1409},{"type":115,"tag":756,"props":6951,"children":6952},{"style":1382},[6953],{"type":121,"value":1550},{"type":115,"tag":756,"props":6955,"children":6956},{"style":1376},[6957],{"type":121,"value":1538},{"type":115,"tag":756,"props":6959,"children":6960},{"class":758,"line":1817},[6961,6966,6970,6974,6979,6983],{"type":115,"tag":756,"props":6962,"children":6963},{"style":1477},[6964],{"type":121,"value":6965},"  value",{"type":115,"tag":756,"props":6967,"children":6968},{"style":1376},[6969],{"type":121,"value":1485},{"type":115,"tag":756,"props":6971,"children":6972},{"style":1376},[6973],{"type":121,"value":1400},{"type":115,"tag":756,"props":6975,"children":6976},{"style":769},[6977],{"type":121,"value":6978},"The quick brown fox",{"type":115,"tag":756,"props":6980,"children":6981},{"style":1376},[6982],{"type":121,"value":1409},{"type":115,"tag":756,"props":6984,"children":6985},{"style":1376},[6986],{"type":121,"value":1538},{"type":115,"tag":756,"props":6988,"children":6989},{"class":758,"line":42},[6990,6994,6998],{"type":115,"tag":756,"props":6991,"children":6992},{"style":1376},[6993],{"type":121,"value":1446},{"type":115,"tag":756,"props":6995,"children":6996},{"style":1382},[6997],{"type":121,"value":1550},{"type":115,"tag":756,"props":6999,"children":7000},{"style":1376},[7001],{"type":121,"value":1414},{"type":115,"tag":756,"props":7003,"children":7004},{"class":758,"line":2139},[7005],{"type":115,"tag":756,"props":7006,"children":7007},{"emptyLinePlaceholder":1420},[7008],{"type":121,"value":1423},{"type":115,"tag":756,"props":7010,"children":7011},{"class":758,"line":2148},[7012],{"type":115,"tag":756,"props":7013,"children":7014},{"style":802},[7015],{"type":121,"value":7016},"\u002F\u002F Batch embeddings\n",{"type":115,"tag":756,"props":7018,"children":7019},{"class":758,"line":2178},[7020,7024,7028,7033,7037,7041,7045,7049,7053],{"type":115,"tag":756,"props":7021,"children":7022},{"style":1429},[7023],{"type":121,"value":1432},{"type":115,"tag":756,"props":7025,"children":7026},{"style":1376},[7027],{"type":121,"value":1379},{"type":115,"tag":756,"props":7029,"children":7030},{"style":1382},[7031],{"type":121,"value":7032}," embeddings ",{"type":115,"tag":756,"props":7034,"children":7035},{"style":1376},[7036],{"type":121,"value":1446},{"type":115,"tag":756,"props":7038,"children":7039},{"style":1376},[7040],{"type":121,"value":1451},{"type":115,"tag":756,"props":7042,"children":7043},{"style":1370},[7044],{"type":121,"value":1456},{"type":115,"tag":756,"props":7046,"children":7047},{"style":1459},[7048],{"type":121,"value":6780},{"type":115,"tag":756,"props":7050,"children":7051},{"style":1382},[7052],{"type":121,"value":1466},{"type":115,"tag":756,"props":7054,"children":7055},{"style":1376},[7056],{"type":121,"value":1471},{"type":115,"tag":756,"props":7058,"children":7059},{"class":758,"line":2206},[7060,7064,7068,7072,7076,7080,7084,7088,7092,7096,7100],{"type":115,"tag":756,"props":7061,"children":7062},{"style":1477},[7063],{"type":121,"value":1480},{"type":115,"tag":756,"props":7065,"children":7066},{"style":1376},[7067],{"type":121,"value":1485},{"type":115,"tag":756,"props":7069,"children":7070},{"style":1382},[7071],{"type":121,"value":6829},{"type":115,"tag":756,"props":7073,"children":7074},{"style":1376},[7075],{"type":121,"value":352},{"type":115,"tag":756,"props":7077,"children":7078},{"style":1459},[7079],{"type":121,"value":6932},{"type":115,"tag":756,"props":7081,"children":7082},{"style":1382},[7083],{"type":121,"value":1466},{"type":115,"tag":756,"props":7085,"children":7086},{"style":1376},[7087],{"type":121,"value":1409},{"type":115,"tag":756,"props":7089,"children":7090},{"style":769},[7091],{"type":121,"value":6945},{"type":115,"tag":756,"props":7093,"children":7094},{"style":1376},[7095],{"type":121,"value":1409},{"type":115,"tag":756,"props":7097,"children":7098},{"style":1382},[7099],{"type":121,"value":1550},{"type":115,"tag":756,"props":7101,"children":7102},{"style":1376},[7103],{"type":121,"value":1538},{"type":115,"tag":756,"props":7105,"children":7106},{"class":758,"line":2235},[7107,7112,7116,7120,7124,7129,7133,7137,7141,7146,7150,7154,7158,7163,7167,7172],{"type":115,"tag":756,"props":7108,"children":7109},{"style":1477},[7110],{"type":121,"value":7111},"  values",{"type":115,"tag":756,"props":7113,"children":7114},{"style":1376},[7115],{"type":121,"value":1485},{"type":115,"tag":756,"props":7117,"children":7118},{"style":1382},[7119],{"type":121,"value":1771},{"type":115,"tag":756,"props":7121,"children":7122},{"style":1376},[7123],{"type":121,"value":1409},{"type":115,"tag":756,"props":7125,"children":7126},{"style":769},[7127],{"type":121,"value":7128},"text 1",{"type":115,"tag":756,"props":7130,"children":7131},{"style":1376},[7132],{"type":121,"value":1409},{"type":115,"tag":756,"props":7134,"children":7135},{"style":1376},[7136],{"type":121,"value":1503},{"type":115,"tag":756,"props":7138,"children":7139},{"style":1376},[7140],{"type":121,"value":1400},{"type":115,"tag":756,"props":7142,"children":7143},{"style":769},[7144],{"type":121,"value":7145},"text 2",{"type":115,"tag":756,"props":7147,"children":7148},{"style":1376},[7149],{"type":121,"value":1409},{"type":115,"tag":756,"props":7151,"children":7152},{"style":1376},[7153],{"type":121,"value":1503},{"type":115,"tag":756,"props":7155,"children":7156},{"style":1376},[7157],{"type":121,"value":1400},{"type":115,"tag":756,"props":7159,"children":7160},{"style":769},[7161],{"type":121,"value":7162},"text 3",{"type":115,"tag":756,"props":7164,"children":7165},{"style":1376},[7166],{"type":121,"value":1409},{"type":115,"tag":756,"props":7168,"children":7169},{"style":1382},[7170],{"type":121,"value":7171},"]",{"type":115,"tag":756,"props":7173,"children":7174},{"style":1376},[7175],{"type":121,"value":1538},{"type":115,"tag":756,"props":7177,"children":7178},{"class":758,"line":2251},[7179,7183,7187],{"type":115,"tag":756,"props":7180,"children":7181},{"style":1376},[7182],{"type":121,"value":1446},{"type":115,"tag":756,"props":7184,"children":7185},{"style":1382},[7186],{"type":121,"value":1550},{"type":115,"tag":756,"props":7188,"children":7189},{"style":1376},[7190],{"type":121,"value":1414},{"type":115,"tag":756,"props":7192,"children":7193},{"class":758,"line":2259},[7194],{"type":115,"tag":756,"props":7195,"children":7196},{"emptyLinePlaceholder":1420},[7197],{"type":121,"value":1423},{"type":115,"tag":756,"props":7199,"children":7200},{"class":758,"line":2308},[7201],{"type":115,"tag":756,"props":7202,"children":7203},{"style":802},[7204],{"type":121,"value":7205},"\u002F\u002F Rerank search results by relevance\n",{"type":115,"tag":756,"props":7207,"children":7208},{"class":758,"line":2352},[7209,7213,7217,7222,7226,7230,7234,7238,7242],{"type":115,"tag":756,"props":7210,"children":7211},{"style":1429},[7212],{"type":121,"value":1432},{"type":115,"tag":756,"props":7214,"children":7215},{"style":1376},[7216],{"type":121,"value":1379},{"type":115,"tag":756,"props":7218,"children":7219},{"style":1382},[7220],{"type":121,"value":7221}," results ",{"type":115,"tag":756,"props":7223,"children":7224},{"style":1376},[7225],{"type":121,"value":1446},{"type":115,"tag":756,"props":7227,"children":7228},{"style":1376},[7229],{"type":121,"value":1451},{"type":115,"tag":756,"props":7231,"children":7232},{"style":1370},[7233],{"type":121,"value":1456},{"type":115,"tag":756,"props":7235,"children":7236},{"style":1459},[7237],{"type":121,"value":6789},{"type":115,"tag":756,"props":7239,"children":7240},{"style":1382},[7241],{"type":121,"value":1466},{"type":115,"tag":756,"props":7243,"children":7244},{"style":1376},[7245],{"type":121,"value":1471},{"type":115,"tag":756,"props":7247,"children":7248},{"class":758,"line":2913},[7249,7253,7257,7262,7266,7271,7275,7279,7284,7288,7292],{"type":115,"tag":756,"props":7250,"children":7251},{"style":1477},[7252],{"type":121,"value":1480},{"type":115,"tag":756,"props":7254,"children":7255},{"style":1376},[7256],{"type":121,"value":1485},{"type":115,"tag":756,"props":7258,"children":7259},{"style":1382},[7260],{"type":121,"value":7261}," cohere",{"type":115,"tag":756,"props":7263,"children":7264},{"style":1376},[7265],{"type":121,"value":352},{"type":115,"tag":756,"props":7267,"children":7268},{"style":1459},[7269],{"type":121,"value":7270},"reranker",{"type":115,"tag":756,"props":7272,"children":7273},{"style":1382},[7274],{"type":121,"value":1466},{"type":115,"tag":756,"props":7276,"children":7277},{"style":1376},[7278],{"type":121,"value":1409},{"type":115,"tag":756,"props":7280,"children":7281},{"style":769},[7282],{"type":121,"value":7283},"rerank-v3.5",{"type":115,"tag":756,"props":7285,"children":7286},{"style":1376},[7287],{"type":121,"value":1409},{"type":115,"tag":756,"props":7289,"children":7290},{"style":1382},[7291],{"type":121,"value":1550},{"type":115,"tag":756,"props":7293,"children":7294},{"style":1376},[7295],{"type":121,"value":1538},{"type":115,"tag":756,"props":7297,"children":7298},{"class":758,"line":2930},[7299,7304,7308,7312,7317,7321],{"type":115,"tag":756,"props":7300,"children":7301},{"style":1477},[7302],{"type":121,"value":7303},"  query",{"type":115,"tag":756,"props":7305,"children":7306},{"style":1376},[7307],{"type":121,"value":1485},{"type":115,"tag":756,"props":7309,"children":7310},{"style":1376},[7311],{"type":121,"value":1400},{"type":115,"tag":756,"props":7313,"children":7314},{"style":769},[7315],{"type":121,"value":7316},"What is quantum computing?",{"type":115,"tag":756,"props":7318,"children":7319},{"style":1376},[7320],{"type":121,"value":1409},{"type":115,"tag":756,"props":7322,"children":7323},{"style":1376},[7324],{"type":121,"value":1538},{"type":115,"tag":756,"props":7326,"children":7327},{"class":758,"line":2947},[7328,7333,7337,7342],{"type":115,"tag":756,"props":7329,"children":7330},{"style":1477},[7331],{"type":121,"value":7332},"  documents",{"type":115,"tag":756,"props":7334,"children":7335},{"style":1376},[7336],{"type":121,"value":1485},{"type":115,"tag":756,"props":7338,"children":7339},{"style":1382},[7340],{"type":121,"value":7341}," searchResults",{"type":115,"tag":756,"props":7343,"children":7344},{"style":1376},[7345],{"type":121,"value":1538},{"type":115,"tag":756,"props":7347,"children":7348},{"class":758,"line":2976},[7349,7353,7357],{"type":115,"tag":756,"props":7350,"children":7351},{"style":1376},[7352],{"type":121,"value":1446},{"type":115,"tag":756,"props":7354,"children":7355},{"style":1382},[7356],{"type":121,"value":1550},{"type":115,"tag":756,"props":7358,"children":7359},{"style":1376},[7360],{"type":121,"value":1414},{"type":115,"tag":1945,"props":7362,"children":7364},{"id":7363},"image-generation-editing",[7365],{"type":121,"value":7366},"Image Generation & Editing",{"type":115,"tag":128,"props":7368,"children":7369},{},[7370,7372,7381,7383,7389,7390,7396],{"type":121,"value":7371},"AI Gateway supports image generation. Use the ",{"type":115,"tag":132,"props":7373,"children":7374},{},[7375],{"type":115,"tag":157,"props":7376,"children":7378},{"className":7377},[],[7379],{"type":121,"value":7380},"google\u002Fgemini-3.1-flash-image-preview",{"type":121,"value":7382}," model — it is significantly better than older models like ",{"type":115,"tag":157,"props":7384,"children":7386},{"className":7385},[],[7387],{"type":121,"value":7388},"gemini-2.0-flash-exp-image-generation",{"type":121,"value":336},{"type":115,"tag":157,"props":7391,"children":7393},{"className":7392},[],[7394],{"type":121,"value":7395},"gemini-2.0-flash-001",{"type":121,"value":352},{"type":115,"tag":128,"props":7398,"children":7399},{},[7400,7410,7412,7418,7419,7425],{"type":115,"tag":132,"props":7401,"children":7402},{},[7403,7405],{"type":121,"value":7404},"Always use ",{"type":115,"tag":157,"props":7406,"children":7408},{"className":7407},[],[7409],{"type":121,"value":7380},{"type":121,"value":7411}," for image generation. Do NOT use older models (",{"type":115,"tag":157,"props":7413,"children":7415},{"className":7414},[],[7416],{"type":121,"value":7417},"gemini-2.0-*",{"type":121,"value":1930},{"type":115,"tag":157,"props":7420,"children":7422},{"className":7421},[],[7423],{"type":121,"value":7424},"gemini-2.5-*",{"type":121,"value":7426},") — they produce much worse results and some do not support image output at all.",{"type":115,"tag":7428,"props":7429,"children":7431},"h4",{"id":7430},"multimodal-llms-recommended-use-generatetextstreamtext",[7432,7434,7439,7440,7445],{"type":121,"value":7433},"Multimodal LLMs (recommended — use ",{"type":115,"tag":157,"props":7435,"children":7437},{"className":7436},[],[7438],{"type":121,"value":1156},{"type":121,"value":3022},{"type":115,"tag":157,"props":7441,"children":7443},{"className":7442},[],[7444],{"type":121,"value":615},{"type":121,"value":1550},{"type":115,"tag":745,"props":7447,"children":7449},{"className":1358,"code":7448,"language":1360,"meta":750,"style":750},"import { generateText, streamText } from \"ai\";\n\n\u002F\u002F generateText — images returned in result.files\nconst result = await generateText({\n  model: \"google\u002Fgemini-3.1-flash-image-preview\",\n  prompt: \"A futuristic cityscape at sunset\",\n});\nconst imageFiles = result.files.filter((f) => f.mediaType?.startsWith(\"image\u002F\"));\n\n\u002F\u002F Convert to data URL for display\nconst imageFile = imageFiles[0];\nconst dataUrl = `data:${imageFile.mediaType};base64,${Buffer.from(imageFile.data).toString(\"base64\")}`;\n\n\u002F\u002F streamText — stream text, then access images after completion\nconst stream = streamText({\n  model: \"google\u002Fgemini-3.1-flash-image-preview\",\n  prompt: \"A futuristic cityscape at sunset\",\n});\nfor await (const delta of stream.fullStream) {\n  if (delta.type === \"text-delta\") process.stdout.write(delta.text);\n}\nconst finalResult = await stream;\nconsole.log(`Generated ${finalResult.files.length} image(s)`);\n",[7450],{"type":115,"tag":157,"props":7451,"children":7452},{"__ignoreMap":750},[7453,7500,7507,7515,7546,7573,7601,7616,7723,7730,7738,7772,7896,7903,7911,7939,7966,7993,8008,8054,8145,8152,8180],{"type":115,"tag":756,"props":7454,"children":7455},{"class":758,"line":759},[7456,7460,7464,7468,7472,7476,7480,7484,7488,7492,7496],{"type":115,"tag":756,"props":7457,"children":7458},{"style":1370},[7459],{"type":121,"value":1373},{"type":115,"tag":756,"props":7461,"children":7462},{"style":1376},[7463],{"type":121,"value":1379},{"type":115,"tag":756,"props":7465,"children":7466},{"style":1382},[7467],{"type":121,"value":1385},{"type":115,"tag":756,"props":7469,"children":7470},{"style":1376},[7471],{"type":121,"value":1503},{"type":115,"tag":756,"props":7473,"children":7474},{"style":1382},[7475],{"type":121,"value":1981},{"type":115,"tag":756,"props":7477,"children":7478},{"style":1376},[7479],{"type":121,"value":1390},{"type":115,"tag":756,"props":7481,"children":7482},{"style":1370},[7483],{"type":121,"value":1395},{"type":115,"tag":756,"props":7485,"children":7486},{"style":1376},[7487],{"type":121,"value":1400},{"type":115,"tag":756,"props":7489,"children":7490},{"style":769},[7491],{"type":121,"value":76},{"type":115,"tag":756,"props":7493,"children":7494},{"style":1376},[7495],{"type":121,"value":1409},{"type":115,"tag":756,"props":7497,"children":7498},{"style":1376},[7499],{"type":121,"value":1414},{"type":115,"tag":756,"props":7501,"children":7502},{"class":758,"line":785},[7503],{"type":115,"tag":756,"props":7504,"children":7505},{"emptyLinePlaceholder":1420},[7506],{"type":121,"value":1423},{"type":115,"tag":756,"props":7508,"children":7509},{"class":758,"line":808},[7510],{"type":115,"tag":756,"props":7511,"children":7512},{"style":802},[7513],{"type":121,"value":7514},"\u002F\u002F generateText — images returned in result.files\n",{"type":115,"tag":756,"props":7516,"children":7517},{"class":758,"line":830},[7518,7522,7526,7530,7534,7538,7542],{"type":115,"tag":756,"props":7519,"children":7520},{"style":1429},[7521],{"type":121,"value":1432},{"type":115,"tag":756,"props":7523,"children":7524},{"style":1382},[7525],{"type":121,"value":2158},{"type":115,"tag":756,"props":7527,"children":7528},{"style":1376},[7529],{"type":121,"value":2163},{"type":115,"tag":756,"props":7531,"children":7532},{"style":1370},[7533],{"type":121,"value":1456},{"type":115,"tag":756,"props":7535,"children":7536},{"style":1459},[7537],{"type":121,"value":1385},{"type":115,"tag":756,"props":7539,"children":7540},{"style":1382},[7541],{"type":121,"value":1466},{"type":115,"tag":756,"props":7543,"children":7544},{"style":1376},[7545],{"type":121,"value":1471},{"type":115,"tag":756,"props":7547,"children":7548},{"class":758,"line":1251},[7549,7553,7557,7561,7565,7569],{"type":115,"tag":756,"props":7550,"children":7551},{"style":1477},[7552],{"type":121,"value":1480},{"type":115,"tag":756,"props":7554,"children":7555},{"style":1376},[7556],{"type":121,"value":1485},{"type":115,"tag":756,"props":7558,"children":7559},{"style":1376},[7560],{"type":121,"value":1400},{"type":115,"tag":756,"props":7562,"children":7563},{"style":769},[7564],{"type":121,"value":7380},{"type":115,"tag":756,"props":7566,"children":7567},{"style":1376},[7568],{"type":121,"value":1409},{"type":115,"tag":756,"props":7570,"children":7571},{"style":1376},[7572],{"type":121,"value":1538},{"type":115,"tag":756,"props":7574,"children":7575},{"class":758,"line":110},[7576,7580,7584,7588,7593,7597],{"type":115,"tag":756,"props":7577,"children":7578},{"style":1477},[7579],{"type":121,"value":1516},{"type":115,"tag":756,"props":7581,"children":7582},{"style":1376},[7583],{"type":121,"value":1485},{"type":115,"tag":756,"props":7585,"children":7586},{"style":1376},[7587],{"type":121,"value":1400},{"type":115,"tag":756,"props":7589,"children":7590},{"style":769},[7591],{"type":121,"value":7592},"A futuristic cityscape at sunset",{"type":115,"tag":756,"props":7594,"children":7595},{"style":1376},[7596],{"type":121,"value":1409},{"type":115,"tag":756,"props":7598,"children":7599},{"style":1376},[7600],{"type":121,"value":1538},{"type":115,"tag":756,"props":7602,"children":7603},{"class":758,"line":1817},[7604,7608,7612],{"type":115,"tag":756,"props":7605,"children":7606},{"style":1376},[7607],{"type":121,"value":1446},{"type":115,"tag":756,"props":7609,"children":7610},{"style":1382},[7611],{"type":121,"value":1550},{"type":115,"tag":756,"props":7613,"children":7614},{"style":1376},[7615],{"type":121,"value":1414},{"type":115,"tag":756,"props":7617,"children":7618},{"class":758,"line":42},[7619,7623,7628,7632,7636,7640,7645,7649,7654,7658,7662,7667,7671,7675,7680,7684,7689,7693,7697,7701,7705,7710,7714,7719],{"type":115,"tag":756,"props":7620,"children":7621},{"style":1429},[7622],{"type":121,"value":1432},{"type":115,"tag":756,"props":7624,"children":7625},{"style":1382},[7626],{"type":121,"value":7627}," imageFiles ",{"type":115,"tag":756,"props":7629,"children":7630},{"style":1376},[7631],{"type":121,"value":2163},{"type":115,"tag":756,"props":7633,"children":7634},{"style":1382},[7635],{"type":121,"value":2292},{"type":115,"tag":756,"props":7637,"children":7638},{"style":1376},[7639],{"type":121,"value":352},{"type":115,"tag":756,"props":7641,"children":7642},{"style":1382},[7643],{"type":121,"value":7644},"files",{"type":115,"tag":756,"props":7646,"children":7647},{"style":1376},[7648],{"type":121,"value":352},{"type":115,"tag":756,"props":7650,"children":7651},{"style":1459},[7652],{"type":121,"value":7653},"filter",{"type":115,"tag":756,"props":7655,"children":7656},{"style":1382},[7657],{"type":121,"value":1466},{"type":115,"tag":756,"props":7659,"children":7660},{"style":1376},[7661],{"type":121,"value":1466},{"type":115,"tag":756,"props":7663,"children":7664},{"style":3547},[7665],{"type":121,"value":7666},"f",{"type":115,"tag":756,"props":7668,"children":7669},{"style":1376},[7670],{"type":121,"value":1550},{"type":115,"tag":756,"props":7672,"children":7673},{"style":1429},[7674],{"type":121,"value":3560},{"type":115,"tag":756,"props":7676,"children":7677},{"style":1382},[7678],{"type":121,"value":7679}," f",{"type":115,"tag":756,"props":7681,"children":7682},{"style":1376},[7683],{"type":121,"value":352},{"type":115,"tag":756,"props":7685,"children":7686},{"style":1382},[7687],{"type":121,"value":7688},"mediaType",{"type":115,"tag":756,"props":7690,"children":7691},{"style":1376},[7692],{"type":121,"value":6100},{"type":115,"tag":756,"props":7694,"children":7695},{"style":1459},[7696],{"type":121,"value":6180},{"type":115,"tag":756,"props":7698,"children":7699},{"style":1382},[7700],{"type":121,"value":1466},{"type":115,"tag":756,"props":7702,"children":7703},{"style":1376},[7704],{"type":121,"value":1409},{"type":115,"tag":756,"props":7706,"children":7707},{"style":769},[7708],{"type":121,"value":7709},"image\u002F",{"type":115,"tag":756,"props":7711,"children":7712},{"style":1376},[7713],{"type":121,"value":1409},{"type":115,"tag":756,"props":7715,"children":7716},{"style":1382},[7717],{"type":121,"value":7718},"))",{"type":115,"tag":756,"props":7720,"children":7721},{"style":1376},[7722],{"type":121,"value":1414},{"type":115,"tag":756,"props":7724,"children":7725},{"class":758,"line":2139},[7726],{"type":115,"tag":756,"props":7727,"children":7728},{"emptyLinePlaceholder":1420},[7729],{"type":121,"value":1423},{"type":115,"tag":756,"props":7731,"children":7732},{"class":758,"line":2148},[7733],{"type":115,"tag":756,"props":7734,"children":7735},{"style":802},[7736],{"type":121,"value":7737},"\u002F\u002F Convert to data URL for display\n",{"type":115,"tag":756,"props":7739,"children":7740},{"class":758,"line":2178},[7741,7745,7750,7754,7759,7764,7768],{"type":115,"tag":756,"props":7742,"children":7743},{"style":1429},[7744],{"type":121,"value":1432},{"type":115,"tag":756,"props":7746,"children":7747},{"style":1382},[7748],{"type":121,"value":7749}," imageFile ",{"type":115,"tag":756,"props":7751,"children":7752},{"style":1376},[7753],{"type":121,"value":2163},{"type":115,"tag":756,"props":7755,"children":7756},{"style":1382},[7757],{"type":121,"value":7758}," imageFiles[",{"type":115,"tag":756,"props":7760,"children":7761},{"style":4406},[7762],{"type":121,"value":7763},"0",{"type":115,"tag":756,"props":7765,"children":7766},{"style":1382},[7767],{"type":121,"value":7171},{"type":115,"tag":756,"props":7769,"children":7770},{"style":1376},[7771],{"type":121,"value":1414},{"type":115,"tag":756,"props":7773,"children":7774},{"class":758,"line":2206},[7775,7779,7784,7788,7793,7798,7803,7808,7812,7816,7820,7825,7829,7834,7838,7843,7848,7852,7857,7861,7866,7870,7874,7879,7883,7887,7892],{"type":115,"tag":756,"props":7776,"children":7777},{"style":1429},[7778],{"type":121,"value":1432},{"type":115,"tag":756,"props":7780,"children":7781},{"style":1382},[7782],{"type":121,"value":7783}," dataUrl ",{"type":115,"tag":756,"props":7785,"children":7786},{"style":1376},[7787],{"type":121,"value":2163},{"type":115,"tag":756,"props":7789,"children":7790},{"style":1376},[7791],{"type":121,"value":7792}," `",{"type":115,"tag":756,"props":7794,"children":7795},{"style":769},[7796],{"type":121,"value":7797},"data:",{"type":115,"tag":756,"props":7799,"children":7800},{"style":1376},[7801],{"type":121,"value":7802},"${",{"type":115,"tag":756,"props":7804,"children":7805},{"style":1382},[7806],{"type":121,"value":7807},"imageFile",{"type":115,"tag":756,"props":7809,"children":7810},{"style":1376},[7811],{"type":121,"value":352},{"type":115,"tag":756,"props":7813,"children":7814},{"style":1382},[7815],{"type":121,"value":7688},{"type":115,"tag":756,"props":7817,"children":7818},{"style":1376},[7819],{"type":121,"value":1446},{"type":115,"tag":756,"props":7821,"children":7822},{"style":769},[7823],{"type":121,"value":7824},";base64,",{"type":115,"tag":756,"props":7826,"children":7827},{"style":1376},[7828],{"type":121,"value":7802},{"type":115,"tag":756,"props":7830,"children":7831},{"style":1382},[7832],{"type":121,"value":7833},"Buffer",{"type":115,"tag":756,"props":7835,"children":7836},{"style":1376},[7837],{"type":121,"value":352},{"type":115,"tag":756,"props":7839,"children":7840},{"style":1459},[7841],{"type":121,"value":7842},"from",{"type":115,"tag":756,"props":7844,"children":7845},{"style":1382},[7846],{"type":121,"value":7847},"(imageFile",{"type":115,"tag":756,"props":7849,"children":7850},{"style":1376},[7851],{"type":121,"value":352},{"type":115,"tag":756,"props":7853,"children":7854},{"style":1382},[7855],{"type":121,"value":7856},"data)",{"type":115,"tag":756,"props":7858,"children":7859},{"style":1376},[7860],{"type":121,"value":352},{"type":115,"tag":756,"props":7862,"children":7863},{"style":1459},[7864],{"type":121,"value":7865},"toString",{"type":115,"tag":756,"props":7867,"children":7868},{"style":1382},[7869],{"type":121,"value":1466},{"type":115,"tag":756,"props":7871,"children":7872},{"style":1376},[7873],{"type":121,"value":1409},{"type":115,"tag":756,"props":7875,"children":7876},{"style":769},[7877],{"type":121,"value":7878},"base64",{"type":115,"tag":756,"props":7880,"children":7881},{"style":1376},[7882],{"type":121,"value":1409},{"type":115,"tag":756,"props":7884,"children":7885},{"style":1382},[7886],{"type":121,"value":1550},{"type":115,"tag":756,"props":7888,"children":7889},{"style":1376},[7890],{"type":121,"value":7891},"}`",{"type":115,"tag":756,"props":7893,"children":7894},{"style":1376},[7895],{"type":121,"value":1414},{"type":115,"tag":756,"props":7897,"children":7898},{"class":758,"line":2235},[7899],{"type":115,"tag":756,"props":7900,"children":7901},{"emptyLinePlaceholder":1420},[7902],{"type":121,"value":1423},{"type":115,"tag":756,"props":7904,"children":7905},{"class":758,"line":2251},[7906],{"type":115,"tag":756,"props":7907,"children":7908},{"style":802},[7909],{"type":121,"value":7910},"\u002F\u002F streamText — stream text, then access images after completion\n",{"type":115,"tag":756,"props":7912,"children":7913},{"class":758,"line":2259},[7914,7918,7923,7927,7931,7935],{"type":115,"tag":756,"props":7915,"children":7916},{"style":1429},[7917],{"type":121,"value":1432},{"type":115,"tag":756,"props":7919,"children":7920},{"style":1382},[7921],{"type":121,"value":7922}," stream ",{"type":115,"tag":756,"props":7924,"children":7925},{"style":1376},[7926],{"type":121,"value":2163},{"type":115,"tag":756,"props":7928,"children":7929},{"style":1459},[7930],{"type":121,"value":1981},{"type":115,"tag":756,"props":7932,"children":7933},{"style":1382},[7934],{"type":121,"value":1466},{"type":115,"tag":756,"props":7936,"children":7937},{"style":1376},[7938],{"type":121,"value":1471},{"type":115,"tag":756,"props":7940,"children":7941},{"class":758,"line":2308},[7942,7946,7950,7954,7958,7962],{"type":115,"tag":756,"props":7943,"children":7944},{"style":1477},[7945],{"type":121,"value":1480},{"type":115,"tag":756,"props":7947,"children":7948},{"style":1376},[7949],{"type":121,"value":1485},{"type":115,"tag":756,"props":7951,"children":7952},{"style":1376},[7953],{"type":121,"value":1400},{"type":115,"tag":756,"props":7955,"children":7956},{"style":769},[7957],{"type":121,"value":7380},{"type":115,"tag":756,"props":7959,"children":7960},{"style":1376},[7961],{"type":121,"value":1409},{"type":115,"tag":756,"props":7963,"children":7964},{"style":1376},[7965],{"type":121,"value":1538},{"type":115,"tag":756,"props":7967,"children":7968},{"class":758,"line":2352},[7969,7973,7977,7981,7985,7989],{"type":115,"tag":756,"props":7970,"children":7971},{"style":1477},[7972],{"type":121,"value":1516},{"type":115,"tag":756,"props":7974,"children":7975},{"style":1376},[7976],{"type":121,"value":1485},{"type":115,"tag":756,"props":7978,"children":7979},{"style":1376},[7980],{"type":121,"value":1400},{"type":115,"tag":756,"props":7982,"children":7983},{"style":769},[7984],{"type":121,"value":7592},{"type":115,"tag":756,"props":7986,"children":7987},{"style":1376},[7988],{"type":121,"value":1409},{"type":115,"tag":756,"props":7990,"children":7991},{"style":1376},[7992],{"type":121,"value":1538},{"type":115,"tag":756,"props":7994,"children":7995},{"class":758,"line":2913},[7996,8000,8004],{"type":115,"tag":756,"props":7997,"children":7998},{"style":1376},[7999],{"type":121,"value":1446},{"type":115,"tag":756,"props":8001,"children":8002},{"style":1382},[8003],{"type":121,"value":1550},{"type":115,"tag":756,"props":8005,"children":8006},{"style":1376},[8007],{"type":121,"value":1414},{"type":115,"tag":756,"props":8009,"children":8010},{"class":758,"line":2930},[8011,8015,8019,8023,8027,8032,8036,8041,8045,8050],{"type":115,"tag":756,"props":8012,"children":8013},{"style":1370},[8014],{"type":121,"value":2265},{"type":115,"tag":756,"props":8016,"children":8017},{"style":1370},[8018],{"type":121,"value":1456},{"type":115,"tag":756,"props":8020,"children":8021},{"style":1382},[8022],{"type":121,"value":1923},{"type":115,"tag":756,"props":8024,"children":8025},{"style":1429},[8026],{"type":121,"value":1432},{"type":115,"tag":756,"props":8028,"children":8029},{"style":1382},[8030],{"type":121,"value":8031}," delta ",{"type":115,"tag":756,"props":8033,"children":8034},{"style":1376},[8035],{"type":121,"value":2287},{"type":115,"tag":756,"props":8037,"children":8038},{"style":1382},[8039],{"type":121,"value":8040}," stream",{"type":115,"tag":756,"props":8042,"children":8043},{"style":1376},[8044],{"type":121,"value":352},{"type":115,"tag":756,"props":8046,"children":8047},{"style":1382},[8048],{"type":121,"value":8049},"fullStream) ",{"type":115,"tag":756,"props":8051,"children":8052},{"style":1376},[8053],{"type":121,"value":1471},{"type":115,"tag":756,"props":8055,"children":8056},{"class":758,"line":2947},[8057,8062,8066,8071,8075,8079,8083,8087,8092,8096,8100,8105,8109,8113,8117,8121,8125,8129,8133,8137,8141],{"type":115,"tag":756,"props":8058,"children":8059},{"style":1370},[8060],{"type":121,"value":8061},"  if",{"type":115,"tag":756,"props":8063,"children":8064},{"style":1477},[8065],{"type":121,"value":1923},{"type":115,"tag":756,"props":8067,"children":8068},{"style":1382},[8069],{"type":121,"value":8070},"delta",{"type":115,"tag":756,"props":8072,"children":8073},{"style":1376},[8074],{"type":121,"value":352},{"type":115,"tag":756,"props":8076,"children":8077},{"style":1382},[8078],{"type":121,"value":6171},{"type":115,"tag":756,"props":8080,"children":8081},{"style":1376},[8082],{"type":121,"value":6235},{"type":115,"tag":756,"props":8084,"children":8085},{"style":1376},[8086],{"type":121,"value":1400},{"type":115,"tag":756,"props":8088,"children":8089},{"style":769},[8090],{"type":121,"value":8091},"text-delta",{"type":115,"tag":756,"props":8093,"children":8094},{"style":1376},[8095],{"type":121,"value":1409},{"type":115,"tag":756,"props":8097,"children":8098},{"style":1477},[8099],{"type":121,"value":6202},{"type":115,"tag":756,"props":8101,"children":8102},{"style":1382},[8103],{"type":121,"value":8104},"process",{"type":115,"tag":756,"props":8106,"children":8107},{"style":1376},[8108],{"type":121,"value":352},{"type":115,"tag":756,"props":8110,"children":8111},{"style":1382},[8112],{"type":121,"value":2323},{"type":115,"tag":756,"props":8114,"children":8115},{"style":1376},[8116],{"type":121,"value":352},{"type":115,"tag":756,"props":8118,"children":8119},{"style":1459},[8120],{"type":121,"value":2332},{"type":115,"tag":756,"props":8122,"children":8123},{"style":1477},[8124],{"type":121,"value":1466},{"type":115,"tag":756,"props":8126,"children":8127},{"style":1382},[8128],{"type":121,"value":8070},{"type":115,"tag":756,"props":8130,"children":8131},{"style":1376},[8132],{"type":121,"value":352},{"type":115,"tag":756,"props":8134,"children":8135},{"style":1382},[8136],{"type":121,"value":121},{"type":115,"tag":756,"props":8138,"children":8139},{"style":1477},[8140],{"type":121,"value":1550},{"type":115,"tag":756,"props":8142,"children":8143},{"style":1376},[8144],{"type":121,"value":1414},{"type":115,"tag":756,"props":8146,"children":8147},{"class":758,"line":2976},[8148],{"type":115,"tag":756,"props":8149,"children":8150},{"style":1376},[8151],{"type":121,"value":2358},{"type":115,"tag":756,"props":8153,"children":8154},{"class":758,"line":3698},[8155,8159,8164,8168,8172,8176],{"type":115,"tag":756,"props":8156,"children":8157},{"style":1429},[8158],{"type":121,"value":1432},{"type":115,"tag":756,"props":8160,"children":8161},{"style":1382},[8162],{"type":121,"value":8163}," finalResult ",{"type":115,"tag":756,"props":8165,"children":8166},{"style":1376},[8167],{"type":121,"value":2163},{"type":115,"tag":756,"props":8169,"children":8170},{"style":1370},[8171],{"type":121,"value":1456},{"type":115,"tag":756,"props":8173,"children":8174},{"style":1382},[8175],{"type":121,"value":8040},{"type":115,"tag":756,"props":8177,"children":8178},{"style":1376},[8179],{"type":121,"value":1414},{"type":115,"tag":756,"props":8181,"children":8182},{"class":758,"line":3707},[8183,8188,8192,8197,8201,8206,8211,8215,8220,8224,8228,8232,8237,8241,8246,8250,8254],{"type":115,"tag":756,"props":8184,"children":8185},{"style":1382},[8186],{"type":121,"value":8187},"console",{"type":115,"tag":756,"props":8189,"children":8190},{"style":1376},[8191],{"type":121,"value":352},{"type":115,"tag":756,"props":8193,"children":8194},{"style":1459},[8195],{"type":121,"value":8196},"log",{"type":115,"tag":756,"props":8198,"children":8199},{"style":1382},[8200],{"type":121,"value":1466},{"type":115,"tag":756,"props":8202,"children":8203},{"style":1376},[8204],{"type":121,"value":8205},"`",{"type":115,"tag":756,"props":8207,"children":8208},{"style":769},[8209],{"type":121,"value":8210},"Generated ",{"type":115,"tag":756,"props":8212,"children":8213},{"style":1376},[8214],{"type":121,"value":7802},{"type":115,"tag":756,"props":8216,"children":8217},{"style":1382},[8218],{"type":121,"value":8219},"finalResult",{"type":115,"tag":756,"props":8221,"children":8222},{"style":1376},[8223],{"type":121,"value":352},{"type":115,"tag":756,"props":8225,"children":8226},{"style":1382},[8227],{"type":121,"value":7644},{"type":115,"tag":756,"props":8229,"children":8230},{"style":1376},[8231],{"type":121,"value":352},{"type":115,"tag":756,"props":8233,"children":8234},{"style":1382},[8235],{"type":121,"value":8236},"length",{"type":115,"tag":756,"props":8238,"children":8239},{"style":1376},[8240],{"type":121,"value":1446},{"type":115,"tag":756,"props":8242,"children":8243},{"style":769},[8244],{"type":121,"value":8245}," image(s)",{"type":115,"tag":756,"props":8247,"children":8248},{"style":1376},[8249],{"type":121,"value":8205},{"type":115,"tag":756,"props":8251,"children":8252},{"style":1382},[8253],{"type":121,"value":1550},{"type":115,"tag":756,"props":8255,"children":8256},{"style":1376},[8257],{"type":121,"value":1414},{"type":115,"tag":128,"props":8259,"children":8260},{},[8261,8266,8267,8272],{"type":115,"tag":132,"props":8262,"children":8263},{},[8264],{"type":121,"value":8265},"Default image model",{"type":121,"value":1282},{"type":115,"tag":157,"props":8268,"children":8270},{"className":8269},[],[8271],{"type":121,"value":7380},{"type":121,"value":8273}," — fast, high-quality. This is the ONLY recommended model for image generation.",{"type":115,"tag":7428,"props":8275,"children":8277},{"id":8276},"image-only-models-use-experimental_generateimage",[8278,8280,8286],{"type":121,"value":8279},"Image-only models (use ",{"type":115,"tag":157,"props":8281,"children":8283},{"className":8282},[],[8284],{"type":121,"value":8285},"experimental_generateImage",{"type":121,"value":1550},{"type":115,"tag":745,"props":8288,"children":8290},{"className":1358,"code":8289,"language":1360,"meta":750,"style":750},"import { experimental_generateImage as generateImage } from \"ai\";\n\nconst { images } = await generateImage({\n  model: \"google\u002Fimagen-4.0-generate-001\",\n  prompt: \"A futuristic cityscape at sunset\",\n  aspectRatio: \"16:9\",\n});\n",[8291],{"type":115,"tag":157,"props":8292,"children":8293},{"__ignoreMap":750},[8294,8344,8351,8391,8419,8446,8475],{"type":115,"tag":756,"props":8295,"children":8296},{"class":758,"line":759},[8297,8301,8305,8310,8315,8320,8324,8328,8332,8336,8340],{"type":115,"tag":756,"props":8298,"children":8299},{"style":1370},[8300],{"type":121,"value":1373},{"type":115,"tag":756,"props":8302,"children":8303},{"style":1376},[8304],{"type":121,"value":1379},{"type":115,"tag":756,"props":8306,"children":8307},{"style":1382},[8308],{"type":121,"value":8309}," experimental_generateImage",{"type":115,"tag":756,"props":8311,"children":8312},{"style":1370},[8313],{"type":121,"value":8314}," as",{"type":115,"tag":756,"props":8316,"children":8317},{"style":1382},[8318],{"type":121,"value":8319}," generateImage",{"type":115,"tag":756,"props":8321,"children":8322},{"style":1376},[8323],{"type":121,"value":1390},{"type":115,"tag":756,"props":8325,"children":8326},{"style":1370},[8327],{"type":121,"value":1395},{"type":115,"tag":756,"props":8329,"children":8330},{"style":1376},[8331],{"type":121,"value":1400},{"type":115,"tag":756,"props":8333,"children":8334},{"style":769},[8335],{"type":121,"value":76},{"type":115,"tag":756,"props":8337,"children":8338},{"style":1376},[8339],{"type":121,"value":1409},{"type":115,"tag":756,"props":8341,"children":8342},{"style":1376},[8343],{"type":121,"value":1414},{"type":115,"tag":756,"props":8345,"children":8346},{"class":758,"line":785},[8347],{"type":115,"tag":756,"props":8348,"children":8349},{"emptyLinePlaceholder":1420},[8350],{"type":121,"value":1423},{"type":115,"tag":756,"props":8352,"children":8353},{"class":758,"line":808},[8354,8358,8362,8367,8371,8375,8379,8383,8387],{"type":115,"tag":756,"props":8355,"children":8356},{"style":1429},[8357],{"type":121,"value":1432},{"type":115,"tag":756,"props":8359,"children":8360},{"style":1376},[8361],{"type":121,"value":1379},{"type":115,"tag":756,"props":8363,"children":8364},{"style":1382},[8365],{"type":121,"value":8366}," images ",{"type":115,"tag":756,"props":8368,"children":8369},{"style":1376},[8370],{"type":121,"value":1446},{"type":115,"tag":756,"props":8372,"children":8373},{"style":1376},[8374],{"type":121,"value":1451},{"type":115,"tag":756,"props":8376,"children":8377},{"style":1370},[8378],{"type":121,"value":1456},{"type":115,"tag":756,"props":8380,"children":8381},{"style":1459},[8382],{"type":121,"value":8319},{"type":115,"tag":756,"props":8384,"children":8385},{"style":1382},[8386],{"type":121,"value":1466},{"type":115,"tag":756,"props":8388,"children":8389},{"style":1376},[8390],{"type":121,"value":1471},{"type":115,"tag":756,"props":8392,"children":8393},{"class":758,"line":830},[8394,8398,8402,8406,8411,8415],{"type":115,"tag":756,"props":8395,"children":8396},{"style":1477},[8397],{"type":121,"value":1480},{"type":115,"tag":756,"props":8399,"children":8400},{"style":1376},[8401],{"type":121,"value":1485},{"type":115,"tag":756,"props":8403,"children":8404},{"style":1376},[8405],{"type":121,"value":1400},{"type":115,"tag":756,"props":8407,"children":8408},{"style":769},[8409],{"type":121,"value":8410},"google\u002Fimagen-4.0-generate-001",{"type":115,"tag":756,"props":8412,"children":8413},{"style":1376},[8414],{"type":121,"value":1409},{"type":115,"tag":756,"props":8416,"children":8417},{"style":1376},[8418],{"type":121,"value":1538},{"type":115,"tag":756,"props":8420,"children":8421},{"class":758,"line":1251},[8422,8426,8430,8434,8438,8442],{"type":115,"tag":756,"props":8423,"children":8424},{"style":1477},[8425],{"type":121,"value":1516},{"type":115,"tag":756,"props":8427,"children":8428},{"style":1376},[8429],{"type":121,"value":1485},{"type":115,"tag":756,"props":8431,"children":8432},{"style":1376},[8433],{"type":121,"value":1400},{"type":115,"tag":756,"props":8435,"children":8436},{"style":769},[8437],{"type":121,"value":7592},{"type":115,"tag":756,"props":8439,"children":8440},{"style":1376},[8441],{"type":121,"value":1409},{"type":115,"tag":756,"props":8443,"children":8444},{"style":1376},[8445],{"type":121,"value":1538},{"type":115,"tag":756,"props":8447,"children":8448},{"class":758,"line":110},[8449,8454,8458,8462,8467,8471],{"type":115,"tag":756,"props":8450,"children":8451},{"style":1477},[8452],{"type":121,"value":8453},"  aspectRatio",{"type":115,"tag":756,"props":8455,"children":8456},{"style":1376},[8457],{"type":121,"value":1485},{"type":115,"tag":756,"props":8459,"children":8460},{"style":1376},[8461],{"type":121,"value":1400},{"type":115,"tag":756,"props":8463,"children":8464},{"style":769},[8465],{"type":121,"value":8466},"16:9",{"type":115,"tag":756,"props":8468,"children":8469},{"style":1376},[8470],{"type":121,"value":1409},{"type":115,"tag":756,"props":8472,"children":8473},{"style":1376},[8474],{"type":121,"value":1538},{"type":115,"tag":756,"props":8476,"children":8477},{"class":758,"line":1817},[8478,8482,8486],{"type":115,"tag":756,"props":8479,"children":8480},{"style":1376},[8481],{"type":121,"value":1446},{"type":115,"tag":756,"props":8483,"children":8484},{"style":1382},[8485],{"type":121,"value":1550},{"type":115,"tag":756,"props":8487,"children":8488},{"style":1376},[8489],{"type":121,"value":1414},{"type":115,"tag":128,"props":8491,"children":8492},{},[8493,8495,8501,8502,8508,8509,8515,8516,8522],{"type":121,"value":8494},"Other image-only models: ",{"type":115,"tag":157,"props":8496,"children":8498},{"className":8497},[],[8499],{"type":121,"value":8500},"google\u002Fimagen-4.0-ultra-generate-001",{"type":121,"value":1930},{"type":115,"tag":157,"props":8503,"children":8505},{"className":8504},[],[8506],{"type":121,"value":8507},"bfl\u002Fflux-2-pro",{"type":121,"value":1930},{"type":115,"tag":157,"props":8510,"children":8512},{"className":8511},[],[8513],{"type":121,"value":8514},"bfl\u002Fflux-kontext-max",{"type":121,"value":1930},{"type":115,"tag":157,"props":8517,"children":8519},{"className":8518},[],[8520],{"type":121,"value":8521},"xai\u002Fgrok-imagine-image-pro",{"type":121,"value":352},{"type":115,"tag":7428,"props":8524,"children":8526},{"id":8525},"saving-generated-images",[8527],{"type":121,"value":8528},"Saving generated images",{"type":115,"tag":745,"props":8530,"children":8532},{"className":1358,"code":8531,"language":1360,"meta":750,"style":750},"import fs from \"node:fs\";\n\n\u002F\u002F From multimodal LLMs (result.files)\nfor (const [i, file] of imageFiles.entries()) {\n  const ext = file.mediaType?.split(\"\u002F\")[1] || \"png\";\n  await fs.promises.writeFile(`output-${i}.${ext}`, file.uint8Array);\n}\n\n\u002F\u002F From image-only models (result.images)\nfor (const [i, image] of images.entries()) {\n  const buffer = Buffer.from(image.base64, \"base64\");\n  await fs.promises.writeFile(`output-${i}.png`, buffer);\n}\n",[8533],{"type":115,"tag":157,"props":8534,"children":8535},{"__ignoreMap":750},[8536,8569,8576,8584,8648,8737,8835,8842,8849,8857,8918,8988,9064],{"type":115,"tag":756,"props":8537,"children":8538},{"class":758,"line":759},[8539,8543,8548,8552,8556,8561,8565],{"type":115,"tag":756,"props":8540,"children":8541},{"style":1370},[8542],{"type":121,"value":1373},{"type":115,"tag":756,"props":8544,"children":8545},{"style":1382},[8546],{"type":121,"value":8547}," fs ",{"type":115,"tag":756,"props":8549,"children":8550},{"style":1370},[8551],{"type":121,"value":7842},{"type":115,"tag":756,"props":8553,"children":8554},{"style":1376},[8555],{"type":121,"value":1400},{"type":115,"tag":756,"props":8557,"children":8558},{"style":769},[8559],{"type":121,"value":8560},"node:fs",{"type":115,"tag":756,"props":8562,"children":8563},{"style":1376},[8564],{"type":121,"value":1409},{"type":115,"tag":756,"props":8566,"children":8567},{"style":1376},[8568],{"type":121,"value":1414},{"type":115,"tag":756,"props":8570,"children":8571},{"class":758,"line":785},[8572],{"type":115,"tag":756,"props":8573,"children":8574},{"emptyLinePlaceholder":1420},[8575],{"type":121,"value":1423},{"type":115,"tag":756,"props":8577,"children":8578},{"class":758,"line":808},[8579],{"type":115,"tag":756,"props":8580,"children":8581},{"style":802},[8582],{"type":121,"value":8583},"\u002F\u002F From multimodal LLMs (result.files)\n",{"type":115,"tag":756,"props":8585,"children":8586},{"class":758,"line":830},[8587,8591,8595,8599,8603,8607,8611,8616,8620,8625,8630,8634,8639,8644],{"type":115,"tag":756,"props":8588,"children":8589},{"style":1370},[8590],{"type":121,"value":2265},{"type":115,"tag":756,"props":8592,"children":8593},{"style":1382},[8594],{"type":121,"value":1923},{"type":115,"tag":756,"props":8596,"children":8597},{"style":1429},[8598],{"type":121,"value":1432},{"type":115,"tag":756,"props":8600,"children":8601},{"style":1376},[8602],{"type":121,"value":1771},{"type":115,"tag":756,"props":8604,"children":8605},{"style":1382},[8606],{"type":121,"value":6295},{"type":115,"tag":756,"props":8608,"children":8609},{"style":1376},[8610],{"type":121,"value":1503},{"type":115,"tag":756,"props":8612,"children":8613},{"style":1382},[8614],{"type":121,"value":8615}," file",{"type":115,"tag":756,"props":8617,"children":8618},{"style":1376},[8619],{"type":121,"value":7171},{"type":115,"tag":756,"props":8621,"children":8622},{"style":1376},[8623],{"type":121,"value":8624}," of",{"type":115,"tag":756,"props":8626,"children":8627},{"style":1382},[8628],{"type":121,"value":8629}," imageFiles",{"type":115,"tag":756,"props":8631,"children":8632},{"style":1376},[8633],{"type":121,"value":352},{"type":115,"tag":756,"props":8635,"children":8636},{"style":1459},[8637],{"type":121,"value":8638},"entries",{"type":115,"tag":756,"props":8640,"children":8641},{"style":1382},[8642],{"type":121,"value":8643},"()) ",{"type":115,"tag":756,"props":8645,"children":8646},{"style":1376},[8647],{"type":121,"value":1471},{"type":115,"tag":756,"props":8649,"children":8650},{"class":758,"line":1251},[8651,8655,8660,8664,8668,8672,8676,8680,8685,8689,8693,8697,8701,8706,8711,8715,8720,8724,8729,8733],{"type":115,"tag":756,"props":8652,"children":8653},{"style":1429},[8654],{"type":121,"value":5990},{"type":115,"tag":756,"props":8656,"children":8657},{"style":1382},[8658],{"type":121,"value":8659}," ext",{"type":115,"tag":756,"props":8661,"children":8662},{"style":1376},[8663],{"type":121,"value":1451},{"type":115,"tag":756,"props":8665,"children":8666},{"style":1382},[8667],{"type":121,"value":8615},{"type":115,"tag":756,"props":8669,"children":8670},{"style":1376},[8671],{"type":121,"value":352},{"type":115,"tag":756,"props":8673,"children":8674},{"style":1382},[8675],{"type":121,"value":7688},{"type":115,"tag":756,"props":8677,"children":8678},{"style":1376},[8679],{"type":121,"value":6100},{"type":115,"tag":756,"props":8681,"children":8682},{"style":1459},[8683],{"type":121,"value":8684},"split",{"type":115,"tag":756,"props":8686,"children":8687},{"style":1477},[8688],{"type":121,"value":1466},{"type":115,"tag":756,"props":8690,"children":8691},{"style":1376},[8692],{"type":121,"value":1409},{"type":115,"tag":756,"props":8694,"children":8695},{"style":769},[8696],{"type":121,"value":3022},{"type":115,"tag":756,"props":8698,"children":8699},{"style":1376},[8700],{"type":121,"value":1409},{"type":115,"tag":756,"props":8702,"children":8703},{"style":1477},[8704],{"type":121,"value":8705},")[",{"type":115,"tag":756,"props":8707,"children":8708},{"style":4406},[8709],{"type":121,"value":8710},"1",{"type":115,"tag":756,"props":8712,"children":8713},{"style":1477},[8714],{"type":121,"value":1805},{"type":115,"tag":756,"props":8716,"children":8717},{"style":1376},[8718],{"type":121,"value":8719},"||",{"type":115,"tag":756,"props":8721,"children":8722},{"style":1376},[8723],{"type":121,"value":1400},{"type":115,"tag":756,"props":8725,"children":8726},{"style":769},[8727],{"type":121,"value":8728},"png",{"type":115,"tag":756,"props":8730,"children":8731},{"style":1376},[8732],{"type":121,"value":1409},{"type":115,"tag":756,"props":8734,"children":8735},{"style":1376},[8736],{"type":121,"value":1414},{"type":115,"tag":756,"props":8738,"children":8739},{"class":758,"line":110},[8740,8745,8750,8754,8759,8763,8768,8772,8776,8781,8785,8789,8793,8797,8801,8806,8810,8814,8818,8822,8827,8831],{"type":115,"tag":756,"props":8741,"children":8742},{"style":1370},[8743],{"type":121,"value":8744},"  await",{"type":115,"tag":756,"props":8746,"children":8747},{"style":1382},[8748],{"type":121,"value":8749}," fs",{"type":115,"tag":756,"props":8751,"children":8752},{"style":1376},[8753],{"type":121,"value":352},{"type":115,"tag":756,"props":8755,"children":8756},{"style":1382},[8757],{"type":121,"value":8758},"promises",{"type":115,"tag":756,"props":8760,"children":8761},{"style":1376},[8762],{"type":121,"value":352},{"type":115,"tag":756,"props":8764,"children":8765},{"style":1459},[8766],{"type":121,"value":8767},"writeFile",{"type":115,"tag":756,"props":8769,"children":8770},{"style":1477},[8771],{"type":121,"value":1466},{"type":115,"tag":756,"props":8773,"children":8774},{"style":1376},[8775],{"type":121,"value":8205},{"type":115,"tag":756,"props":8777,"children":8778},{"style":769},[8779],{"type":121,"value":8780},"output-",{"type":115,"tag":756,"props":8782,"children":8783},{"style":1376},[8784],{"type":121,"value":7802},{"type":115,"tag":756,"props":8786,"children":8787},{"style":1382},[8788],{"type":121,"value":6295},{"type":115,"tag":756,"props":8790,"children":8791},{"style":1376},[8792],{"type":121,"value":1446},{"type":115,"tag":756,"props":8794,"children":8795},{"style":769},[8796],{"type":121,"value":352},{"type":115,"tag":756,"props":8798,"children":8799},{"style":1376},[8800],{"type":121,"value":7802},{"type":115,"tag":756,"props":8802,"children":8803},{"style":1382},[8804],{"type":121,"value":8805},"ext",{"type":115,"tag":756,"props":8807,"children":8808},{"style":1376},[8809],{"type":121,"value":7891},{"type":115,"tag":756,"props":8811,"children":8812},{"style":1376},[8813],{"type":121,"value":1503},{"type":115,"tag":756,"props":8815,"children":8816},{"style":1382},[8817],{"type":121,"value":8615},{"type":115,"tag":756,"props":8819,"children":8820},{"style":1376},[8821],{"type":121,"value":352},{"type":115,"tag":756,"props":8823,"children":8824},{"style":1382},[8825],{"type":121,"value":8826},"uint8Array",{"type":115,"tag":756,"props":8828,"children":8829},{"style":1477},[8830],{"type":121,"value":1550},{"type":115,"tag":756,"props":8832,"children":8833},{"style":1376},[8834],{"type":121,"value":1414},{"type":115,"tag":756,"props":8836,"children":8837},{"class":758,"line":1817},[8838],{"type":115,"tag":756,"props":8839,"children":8840},{"style":1376},[8841],{"type":121,"value":2358},{"type":115,"tag":756,"props":8843,"children":8844},{"class":758,"line":42},[8845],{"type":115,"tag":756,"props":8846,"children":8847},{"emptyLinePlaceholder":1420},[8848],{"type":121,"value":1423},{"type":115,"tag":756,"props":8850,"children":8851},{"class":758,"line":2139},[8852],{"type":115,"tag":756,"props":8853,"children":8854},{"style":802},[8855],{"type":121,"value":8856},"\u002F\u002F From image-only models (result.images)\n",{"type":115,"tag":756,"props":8858,"children":8859},{"class":758,"line":2148},[8860,8864,8868,8872,8876,8880,8884,8889,8893,8897,8902,8906,8910,8914],{"type":115,"tag":756,"props":8861,"children":8862},{"style":1370},[8863],{"type":121,"value":2265},{"type":115,"tag":756,"props":8865,"children":8866},{"style":1382},[8867],{"type":121,"value":1923},{"type":115,"tag":756,"props":8869,"children":8870},{"style":1429},[8871],{"type":121,"value":1432},{"type":115,"tag":756,"props":8873,"children":8874},{"style":1376},[8875],{"type":121,"value":1771},{"type":115,"tag":756,"props":8877,"children":8878},{"style":1382},[8879],{"type":121,"value":6295},{"type":115,"tag":756,"props":8881,"children":8882},{"style":1376},[8883],{"type":121,"value":1503},{"type":115,"tag":756,"props":8885,"children":8886},{"style":1382},[8887],{"type":121,"value":8888}," image",{"type":115,"tag":756,"props":8890,"children":8891},{"style":1376},[8892],{"type":121,"value":7171},{"type":115,"tag":756,"props":8894,"children":8895},{"style":1376},[8896],{"type":121,"value":8624},{"type":115,"tag":756,"props":8898,"children":8899},{"style":1382},[8900],{"type":121,"value":8901}," images",{"type":115,"tag":756,"props":8903,"children":8904},{"style":1376},[8905],{"type":121,"value":352},{"type":115,"tag":756,"props":8907,"children":8908},{"style":1459},[8909],{"type":121,"value":8638},{"type":115,"tag":756,"props":8911,"children":8912},{"style":1382},[8913],{"type":121,"value":8643},{"type":115,"tag":756,"props":8915,"children":8916},{"style":1376},[8917],{"type":121,"value":1471},{"type":115,"tag":756,"props":8919,"children":8920},{"class":758,"line":2178},[8921,8925,8930,8934,8939,8943,8947,8951,8956,8960,8964,8968,8972,8976,8980,8984],{"type":115,"tag":756,"props":8922,"children":8923},{"style":1429},[8924],{"type":121,"value":5990},{"type":115,"tag":756,"props":8926,"children":8927},{"style":1382},[8928],{"type":121,"value":8929}," buffer",{"type":115,"tag":756,"props":8931,"children":8932},{"style":1376},[8933],{"type":121,"value":1451},{"type":115,"tag":756,"props":8935,"children":8936},{"style":1382},[8937],{"type":121,"value":8938}," Buffer",{"type":115,"tag":756,"props":8940,"children":8941},{"style":1376},[8942],{"type":121,"value":352},{"type":115,"tag":756,"props":8944,"children":8945},{"style":1459},[8946],{"type":121,"value":7842},{"type":115,"tag":756,"props":8948,"children":8949},{"style":1477},[8950],{"type":121,"value":1466},{"type":115,"tag":756,"props":8952,"children":8953},{"style":1382},[8954],{"type":121,"value":8955},"image",{"type":115,"tag":756,"props":8957,"children":8958},{"style":1376},[8959],{"type":121,"value":352},{"type":115,"tag":756,"props":8961,"children":8962},{"style":1382},[8963],{"type":121,"value":7878},{"type":115,"tag":756,"props":8965,"children":8966},{"style":1376},[8967],{"type":121,"value":1503},{"type":115,"tag":756,"props":8969,"children":8970},{"style":1376},[8971],{"type":121,"value":1400},{"type":115,"tag":756,"props":8973,"children":8974},{"style":769},[8975],{"type":121,"value":7878},{"type":115,"tag":756,"props":8977,"children":8978},{"style":1376},[8979],{"type":121,"value":1409},{"type":115,"tag":756,"props":8981,"children":8982},{"style":1477},[8983],{"type":121,"value":1550},{"type":115,"tag":756,"props":8985,"children":8986},{"style":1376},[8987],{"type":121,"value":1414},{"type":115,"tag":756,"props":8989,"children":8990},{"class":758,"line":2206},[8991,8995,8999,9003,9007,9011,9015,9019,9023,9027,9031,9035,9039,9044,9048,9052,9056,9060],{"type":115,"tag":756,"props":8992,"children":8993},{"style":1370},[8994],{"type":121,"value":8744},{"type":115,"tag":756,"props":8996,"children":8997},{"style":1382},[8998],{"type":121,"value":8749},{"type":115,"tag":756,"props":9000,"children":9001},{"style":1376},[9002],{"type":121,"value":352},{"type":115,"tag":756,"props":9004,"children":9005},{"style":1382},[9006],{"type":121,"value":8758},{"type":115,"tag":756,"props":9008,"children":9009},{"style":1376},[9010],{"type":121,"value":352},{"type":115,"tag":756,"props":9012,"children":9013},{"style":1459},[9014],{"type":121,"value":8767},{"type":115,"tag":756,"props":9016,"children":9017},{"style":1477},[9018],{"type":121,"value":1466},{"type":115,"tag":756,"props":9020,"children":9021},{"style":1376},[9022],{"type":121,"value":8205},{"type":115,"tag":756,"props":9024,"children":9025},{"style":769},[9026],{"type":121,"value":8780},{"type":115,"tag":756,"props":9028,"children":9029},{"style":1376},[9030],{"type":121,"value":7802},{"type":115,"tag":756,"props":9032,"children":9033},{"style":1382},[9034],{"type":121,"value":6295},{"type":115,"tag":756,"props":9036,"children":9037},{"style":1376},[9038],{"type":121,"value":1446},{"type":115,"tag":756,"props":9040,"children":9041},{"style":769},[9042],{"type":121,"value":9043},".png",{"type":115,"tag":756,"props":9045,"children":9046},{"style":1376},[9047],{"type":121,"value":8205},{"type":115,"tag":756,"props":9049,"children":9050},{"style":1376},[9051],{"type":121,"value":1503},{"type":115,"tag":756,"props":9053,"children":9054},{"style":1382},[9055],{"type":121,"value":8929},{"type":115,"tag":756,"props":9057,"children":9058},{"style":1477},[9059],{"type":121,"value":1550},{"type":115,"tag":756,"props":9061,"children":9062},{"style":1376},[9063],{"type":121,"value":1414},{"type":115,"tag":756,"props":9065,"children":9066},{"class":758,"line":2235},[9067],{"type":115,"tag":756,"props":9068,"children":9069},{"style":1376},[9070],{"type":121,"value":2358},{"type":115,"tag":218,"props":9072,"children":9074},{"id":9073},"ui-hooks-react",[9075],{"type":121,"value":9076},"UI Hooks (React)",{"type":115,"tag":128,"props":9078,"children":9079},{},[9080,9085,9087,9093,9094,9100,9102,9108,9110,9116],{"type":115,"tag":132,"props":9081,"children":9082},{},[9083],{"type":121,"value":9084},"MANDATORY — Always use AI Elements for AI text",{"type":121,"value":9086},": AI SDK models always produce markdown — even short prose contains ",{"type":115,"tag":157,"props":9088,"children":9090},{"className":9089},[],[9091],{"type":121,"value":9092},"**bold**",{"type":121,"value":1930},{"type":115,"tag":157,"props":9095,"children":9097},{"className":9096},[],[9098],{"type":121,"value":9099},"##",{"type":121,"value":9101}," headings, ",{"type":115,"tag":157,"props":9103,"children":9105},{"className":9104},[],[9106],{"type":121,"value":9107},"`code`",{"type":121,"value":9109},", and ",{"type":115,"tag":157,"props":9111,"children":9113},{"className":9112},[],[9114],{"type":121,"value":9115},"---",{"type":121,"value":9117},". There is no \"plain text\" mode. Every AI-generated string displayed in a browser MUST be rendered through AI Elements.",{"type":115,"tag":225,"props":9119,"children":9120},{},[9121,9139,9164,9175,9208],{"type":115,"tag":229,"props":9122,"children":9123},{},[9124,9129,9131,9137],{"type":115,"tag":132,"props":9125,"children":9126},{},[9127],{"type":121,"value":9128},"Chat messages",{"type":121,"value":9130},": Use AI Elements ",{"type":115,"tag":157,"props":9132,"children":9134},{"className":9133},[],[9135],{"type":121,"value":9136},"\u003CMessage message={message} \u002F>",{"type":121,"value":9138}," — handles text, tool calls, code blocks, reasoning, streaming.",{"type":115,"tag":229,"props":9140,"children":9141},{},[9142,9147,9149,9155,9157,9163],{"type":115,"tag":132,"props":9143,"children":9144},{},[9145],{"type":121,"value":9146},"Any other AI text",{"type":121,"value":9148}," (streaming panels, workflow events, reports, briefings, narratives, summaries, perspectives): Use ",{"type":115,"tag":157,"props":9150,"children":9152},{"className":9151},[],[9153],{"type":121,"value":9154},"\u003CMessageResponse>{text}\u003C\u002FMessageResponse>",{"type":121,"value":9156}," from ",{"type":115,"tag":157,"props":9158,"children":9160},{"className":9159},[],[9161],{"type":121,"value":9162},"@\u002Fcomponents\u002Fai-elements\u002Fmessage",{"type":121,"value":352},{"type":115,"tag":229,"props":9165,"children":9166},{},[9167,9173],{"type":115,"tag":157,"props":9168,"children":9170},{"className":9169},[],[9171],{"type":121,"value":9172},"\u003CMessageResponse>",{"type":121,"value":9174}," wraps Streamdown with code highlighting, math, mermaid, and CJK plugins — works for any markdown string, including streamed text.",{"type":115,"tag":229,"props":9176,"children":9177},{},[9178,9183,9185,9191,9192,9198,9200,9206],{"type":115,"tag":132,"props":9179,"children":9180},{},[9181],{"type":121,"value":9182},"Never",{"type":121,"value":9184}," render AI output as raw ",{"type":115,"tag":157,"props":9186,"children":9188},{"className":9187},[],[9189],{"type":121,"value":9190},"{text}",{"type":121,"value":1930},{"type":115,"tag":157,"props":9193,"children":9195},{"className":9194},[],[9196],{"type":121,"value":9197},"\u003Cp>{content}\u003C\u002Fp>",{"type":121,"value":9199},", or ",{"type":115,"tag":157,"props":9201,"children":9203},{"className":9202},[],[9204],{"type":121,"value":9205},"\u003Cdiv>{stream}\u003C\u002Fdiv>",{"type":121,"value":9207}," — this always produces ugly unformatted output with visible markdown syntax.",{"type":115,"tag":229,"props":9209,"children":9210},{},[9211,9216],{"type":115,"tag":132,"props":9212,"children":9213},{},[9214],{"type":121,"value":9215},"No exceptions",{"type":121,"value":9217},": Even if you think the response will be \"simple prose\", models routinely add markdown formatting. Always use AI Elements.",{"type":115,"tag":128,"props":9219,"children":9220},{},[9221],{"type":121,"value":9222},"⤳ skill: ai-elements — Full component library, decision guidance, and troubleshooting for AI interfaces",{"type":115,"tag":1945,"props":9224,"children":9226},{"id":9225},"transport-options",[9227],{"type":121,"value":9228},"Transport Options",{"type":115,"tag":128,"props":9230,"children":9231},{},[9232,9237],{"type":115,"tag":157,"props":9233,"children":9235},{"className":9234},[],[9236],{"type":121,"value":209},{"type":121,"value":9238}," uses a transport-based architecture. Three built-in transports:",{"type":115,"tag":959,"props":9240,"children":9241},{},[9242,9258],{"type":115,"tag":963,"props":9243,"children":9244},{},[9245],{"type":115,"tag":967,"props":9246,"children":9247},{},[9248,9253],{"type":115,"tag":971,"props":9249,"children":9250},{},[9251],{"type":121,"value":9252},"Transport",{"type":115,"tag":971,"props":9254,"children":9255},{},[9256],{"type":121,"value":9257},"Use Case",{"type":115,"tag":982,"props":9259,"children":9260},{},[9261,9285,9301],{"type":115,"tag":967,"props":9262,"children":9263},{},[9264,9273],{"type":115,"tag":989,"props":9265,"children":9266},{},[9267],{"type":115,"tag":157,"props":9268,"children":9270},{"className":9269},[],[9271],{"type":121,"value":9272},"DefaultChatTransport",{"type":115,"tag":989,"props":9274,"children":9275},{},[9276,9278,9284],{"type":121,"value":9277},"HTTP POST to API routes (default — sends to ",{"type":115,"tag":157,"props":9279,"children":9281},{"className":9280},[],[9282],{"type":121,"value":9283},"\u002Fapi\u002Fchat",{"type":121,"value":1550},{"type":115,"tag":967,"props":9286,"children":9287},{},[9288,9296],{"type":115,"tag":989,"props":9289,"children":9290},{},[9291],{"type":115,"tag":157,"props":9292,"children":9294},{"className":9293},[],[9295],{"type":121,"value":555},{"type":115,"tag":989,"props":9297,"children":9298},{},[9299],{"type":121,"value":9300},"In-process agent communication without HTTP (SSR, testing)",{"type":115,"tag":967,"props":9302,"children":9303},{},[9304,9313],{"type":115,"tag":989,"props":9305,"children":9306},{},[9307],{"type":115,"tag":157,"props":9308,"children":9310},{"className":9309},[],[9311],{"type":121,"value":9312},"TextStreamChatTransport",{"type":115,"tag":989,"props":9314,"children":9315},{},[9316],{"type":121,"value":9317},"Plain text stream protocol",{"type":115,"tag":128,"props":9319,"children":9320},{},[9321,9326,9327,9332,9334,9339],{"type":115,"tag":132,"props":9322,"children":9323},{},[9324],{"type":121,"value":9325},"Default behavior:",{"type":121,"value":6694},{"type":115,"tag":157,"props":9328,"children":9330},{"className":9329},[],[9331],{"type":121,"value":539},{"type":121,"value":9333}," with no transport config defaults to ",{"type":115,"tag":157,"props":9335,"children":9337},{"className":9336},[],[9338],{"type":121,"value":547},{"type":121,"value":352},{"type":115,"tag":1945,"props":9341,"children":9343},{"id":9342},"with-ai-elements-recommended",[9344],{"type":121,"value":9345},"With AI Elements (Recommended)",{"type":115,"tag":745,"props":9347,"children":9349},{"className":5888,"code":9348,"language":5890,"meta":750,"style":750},"\"use client\";\nimport { useChat } from \"@ai-sdk\u002Freact\";\nimport { Conversation } from \"@\u002Fcomponents\u002Fai-elements\u002Fconversation\";\nimport { Message } from \"@\u002Fcomponents\u002Fai-elements\u002Fmessage\";\n\nfunction Chat() {\n  \u002F\u002F No transport needed — defaults to DefaultChatTransport({ api: '\u002Fapi\u002Fchat' })\n  const { messages, sendMessage, status } = useChat();\n\n  return (\n    \u003CConversation>\n      {messages.map((message) => (\n        \u003CMessage key={message.id} message={message} \u002F>\n      ))}\n    \u003C\u002FConversation>\n  );\n}\n",[9350],{"type":115,"tag":157,"props":9351,"children":9352},{"__ignoreMap":750},[9353,9372,9411,9452,9492,9499,9518,9526,9579,9586,9597,9614,9660,9715,9727,9743,9754],{"type":115,"tag":756,"props":9354,"children":9355},{"class":758,"line":759},[9356,9360,9364,9368],{"type":115,"tag":756,"props":9357,"children":9358},{"style":1376},[9359],{"type":121,"value":1409},{"type":115,"tag":756,"props":9361,"children":9362},{"style":769},[9363],{"type":121,"value":5906},{"type":115,"tag":756,"props":9365,"children":9366},{"style":1376},[9367],{"type":121,"value":1409},{"type":115,"tag":756,"props":9369,"children":9370},{"style":1376},[9371],{"type":121,"value":1414},{"type":115,"tag":756,"props":9373,"children":9374},{"class":758,"line":785},[9375,9379,9383,9387,9391,9395,9399,9403,9407],{"type":115,"tag":756,"props":9376,"children":9377},{"style":1370},[9378],{"type":121,"value":1373},{"type":115,"tag":756,"props":9380,"children":9381},{"style":1376},[9382],{"type":121,"value":1379},{"type":115,"tag":756,"props":9384,"children":9385},{"style":1382},[9386],{"type":121,"value":5930},{"type":115,"tag":756,"props":9388,"children":9389},{"style":1376},[9390],{"type":121,"value":1390},{"type":115,"tag":756,"props":9392,"children":9393},{"style":1370},[9394],{"type":121,"value":1395},{"type":115,"tag":756,"props":9396,"children":9397},{"style":1376},[9398],{"type":121,"value":1400},{"type":115,"tag":756,"props":9400,"children":9401},{"style":769},[9402],{"type":121,"value":248},{"type":115,"tag":756,"props":9404,"children":9405},{"style":1376},[9406],{"type":121,"value":1409},{"type":115,"tag":756,"props":9408,"children":9409},{"style":1376},[9410],{"type":121,"value":1414},{"type":115,"tag":756,"props":9412,"children":9413},{"class":758,"line":808},[9414,9418,9422,9427,9431,9435,9439,9444,9448],{"type":115,"tag":756,"props":9415,"children":9416},{"style":1370},[9417],{"type":121,"value":1373},{"type":115,"tag":756,"props":9419,"children":9420},{"style":1376},[9421],{"type":121,"value":1379},{"type":115,"tag":756,"props":9423,"children":9424},{"style":1382},[9425],{"type":121,"value":9426}," Conversation",{"type":115,"tag":756,"props":9428,"children":9429},{"style":1376},[9430],{"type":121,"value":1390},{"type":115,"tag":756,"props":9432,"children":9433},{"style":1370},[9434],{"type":121,"value":1395},{"type":115,"tag":756,"props":9436,"children":9437},{"style":1376},[9438],{"type":121,"value":1400},{"type":115,"tag":756,"props":9440,"children":9441},{"style":769},[9442],{"type":121,"value":9443},"@\u002Fcomponents\u002Fai-elements\u002Fconversation",{"type":115,"tag":756,"props":9445,"children":9446},{"style":1376},[9447],{"type":121,"value":1409},{"type":115,"tag":756,"props":9449,"children":9450},{"style":1376},[9451],{"type":121,"value":1414},{"type":115,"tag":756,"props":9453,"children":9454},{"class":758,"line":830},[9455,9459,9463,9468,9472,9476,9480,9484,9488],{"type":115,"tag":756,"props":9456,"children":9457},{"style":1370},[9458],{"type":121,"value":1373},{"type":115,"tag":756,"props":9460,"children":9461},{"style":1376},[9462],{"type":121,"value":1379},{"type":115,"tag":756,"props":9464,"children":9465},{"style":1382},[9466],{"type":121,"value":9467}," Message",{"type":115,"tag":756,"props":9469,"children":9470},{"style":1376},[9471],{"type":121,"value":1390},{"type":115,"tag":756,"props":9473,"children":9474},{"style":1370},[9475],{"type":121,"value":1395},{"type":115,"tag":756,"props":9477,"children":9478},{"style":1376},[9479],{"type":121,"value":1400},{"type":115,"tag":756,"props":9481,"children":9482},{"style":769},[9483],{"type":121,"value":9162},{"type":115,"tag":756,"props":9485,"children":9486},{"style":1376},[9487],{"type":121,"value":1409},{"type":115,"tag":756,"props":9489,"children":9490},{"style":1376},[9491],{"type":121,"value":1414},{"type":115,"tag":756,"props":9493,"children":9494},{"class":758,"line":1251},[9495],{"type":115,"tag":756,"props":9496,"children":9497},{"emptyLinePlaceholder":1420},[9498],{"type":121,"value":1423},{"type":115,"tag":756,"props":9500,"children":9501},{"class":758,"line":110},[9502,9506,9510,9514],{"type":115,"tag":756,"props":9503,"children":9504},{"style":1429},[9505],{"type":121,"value":5969},{"type":115,"tag":756,"props":9507,"children":9508},{"style":1459},[9509],{"type":121,"value":5974},{"type":115,"tag":756,"props":9511,"children":9512},{"style":1376},[9513],{"type":121,"value":2698},{"type":115,"tag":756,"props":9515,"children":9516},{"style":1376},[9517],{"type":121,"value":3221},{"type":115,"tag":756,"props":9519,"children":9520},{"class":758,"line":1817},[9521],{"type":115,"tag":756,"props":9522,"children":9523},{"style":802},[9524],{"type":121,"value":9525},"  \u002F\u002F No transport needed — defaults to DefaultChatTransport({ api: '\u002Fapi\u002Fchat' })\n",{"type":115,"tag":756,"props":9527,"children":9528},{"class":758,"line":42},[9529,9533,9537,9541,9545,9550,9554,9559,9563,9567,9571,9575],{"type":115,"tag":756,"props":9530,"children":9531},{"style":1429},[9532],{"type":121,"value":5990},{"type":115,"tag":756,"props":9534,"children":9535},{"style":1376},[9536],{"type":121,"value":1379},{"type":115,"tag":756,"props":9538,"children":9539},{"style":1382},[9540],{"type":121,"value":5999},{"type":115,"tag":756,"props":9542,"children":9543},{"style":1376},[9544],{"type":121,"value":1503},{"type":115,"tag":756,"props":9546,"children":9547},{"style":1382},[9548],{"type":121,"value":9549}," sendMessage",{"type":115,"tag":756,"props":9551,"children":9552},{"style":1376},[9553],{"type":121,"value":1503},{"type":115,"tag":756,"props":9555,"children":9556},{"style":1382},[9557],{"type":121,"value":9558}," status",{"type":115,"tag":756,"props":9560,"children":9561},{"style":1376},[9562],{"type":121,"value":1390},{"type":115,"tag":756,"props":9564,"children":9565},{"style":1376},[9566],{"type":121,"value":1451},{"type":115,"tag":756,"props":9568,"children":9569},{"style":1459},[9570],{"type":121,"value":5930},{"type":115,"tag":756,"props":9572,"children":9573},{"style":1477},[9574],{"type":121,"value":2698},{"type":115,"tag":756,"props":9576,"children":9577},{"style":1376},[9578],{"type":121,"value":1414},{"type":115,"tag":756,"props":9580,"children":9581},{"class":758,"line":2139},[9582],{"type":115,"tag":756,"props":9583,"children":9584},{"emptyLinePlaceholder":1420},[9585],{"type":121,"value":1423},{"type":115,"tag":756,"props":9587,"children":9588},{"class":758,"line":2148},[9589,9593],{"type":115,"tag":756,"props":9590,"children":9591},{"style":1370},[9592],{"type":121,"value":6043},{"type":115,"tag":756,"props":9594,"children":9595},{"style":1477},[9596],{"type":121,"value":6267},{"type":115,"tag":756,"props":9598,"children":9599},{"class":758,"line":2178},[9600,9605,9610],{"type":115,"tag":756,"props":9601,"children":9602},{"style":1376},[9603],{"type":121,"value":9604},"    \u003C",{"type":115,"tag":756,"props":9606,"children":9607},{"style":763},[9608],{"type":121,"value":9609},"Conversation",{"type":115,"tag":756,"props":9611,"children":9612},{"style":1376},[9613],{"type":121,"value":6367},{"type":115,"tag":756,"props":9615,"children":9616},{"class":758,"line":2206},[9617,9622,9627,9631,9635,9639,9643,9648,9652,9656],{"type":115,"tag":756,"props":9618,"children":9619},{"style":1376},[9620],{"type":121,"value":9621},"      {",{"type":115,"tag":756,"props":9623,"children":9624},{"style":1382},[9625],{"type":121,"value":9626},"messages",{"type":115,"tag":756,"props":9628,"children":9629},{"style":1376},[9630],{"type":121,"value":352},{"type":115,"tag":756,"props":9632,"children":9633},{"style":1459},[9634],{"type":121,"value":6056},{"type":115,"tag":756,"props":9636,"children":9637},{"style":1382},[9638],{"type":121,"value":1466},{"type":115,"tag":756,"props":9640,"children":9641},{"style":1376},[9642],{"type":121,"value":1466},{"type":115,"tag":756,"props":9644,"children":9645},{"style":3547},[9646],{"type":121,"value":9647},"message",{"type":115,"tag":756,"props":9649,"children":9650},{"style":1376},[9651],{"type":121,"value":1550},{"type":115,"tag":756,"props":9653,"children":9654},{"style":1429},[9655],{"type":121,"value":3560},{"type":115,"tag":756,"props":9657,"children":9658},{"style":1382},[9659],{"type":121,"value":6267},{"type":115,"tag":756,"props":9661,"children":9662},{"class":758,"line":2235},[9663,9668,9673,9677,9681,9685,9689,9693,9698,9702,9706,9710],{"type":115,"tag":756,"props":9664,"children":9665},{"style":1376},[9666],{"type":121,"value":9667},"        \u003C",{"type":115,"tag":756,"props":9669,"children":9670},{"style":763},[9671],{"type":121,"value":9672},"Message",{"type":115,"tag":756,"props":9674,"children":9675},{"style":1429},[9676],{"type":121,"value":6285},{"type":115,"tag":756,"props":9678,"children":9679},{"style":1376},[9680],{"type":121,"value":6290},{"type":115,"tag":756,"props":9682,"children":9683},{"style":1382},[9684],{"type":121,"value":9647},{"type":115,"tag":756,"props":9686,"children":9687},{"style":1376},[9688],{"type":121,"value":352},{"type":115,"tag":756,"props":9690,"children":9691},{"style":1382},[9692],{"type":121,"value":6435},{"type":115,"tag":756,"props":9694,"children":9695},{"style":1376},[9696],{"type":121,"value":9697},"} ",{"type":115,"tag":756,"props":9699,"children":9700},{"style":1429},[9701],{"type":121,"value":9647},{"type":115,"tag":756,"props":9703,"children":9704},{"style":1376},[9705],{"type":121,"value":6290},{"type":115,"tag":756,"props":9707,"children":9708},{"style":1382},[9709],{"type":121,"value":9647},{"type":115,"tag":756,"props":9711,"children":9712},{"style":1376},[9713],{"type":121,"value":9714},"} \u002F>\n",{"type":115,"tag":756,"props":9716,"children":9717},{"class":758,"line":2251},[9718,9723],{"type":115,"tag":756,"props":9719,"children":9720},{"style":1382},[9721],{"type":121,"value":9722},"      ))",{"type":115,"tag":756,"props":9724,"children":9725},{"style":1376},[9726],{"type":121,"value":2358},{"type":115,"tag":756,"props":9728,"children":9729},{"class":758,"line":2259},[9730,9735,9739],{"type":115,"tag":756,"props":9731,"children":9732},{"style":1376},[9733],{"type":121,"value":9734},"    \u003C\u002F",{"type":115,"tag":756,"props":9736,"children":9737},{"style":763},[9738],{"type":121,"value":9609},{"type":115,"tag":756,"props":9740,"children":9741},{"style":1376},[9742],{"type":121,"value":6367},{"type":115,"tag":756,"props":9744,"children":9745},{"class":758,"line":2308},[9746,9750],{"type":115,"tag":756,"props":9747,"children":9748},{"style":1477},[9749],{"type":121,"value":6673},{"type":115,"tag":756,"props":9751,"children":9752},{"style":1376},[9753],{"type":121,"value":1414},{"type":115,"tag":756,"props":9755,"children":9756},{"class":758,"line":2352},[9757],{"type":115,"tag":756,"props":9758,"children":9759},{"style":1376},[9760],{"type":121,"value":2358},{"type":115,"tag":128,"props":9762,"children":9763},{},[9764,9766,9772],{"type":121,"value":9765},"AI Elements handles UIMessage parts (text, tool calls, reasoning, images) automatically. Install with ",{"type":115,"tag":157,"props":9767,"children":9769},{"className":9768},[],[9770],{"type":121,"value":9771},"npx ai-elements",{"type":121,"value":352},{"type":115,"tag":128,"props":9774,"children":9775},{},[9776],{"type":121,"value":9777},"⤳ skill: ai-elements — Full component library for AI interfaces\n⤳ skill: json-render — Manual rendering patterns for custom UIs",{"type":115,"tag":1945,"props":9779,"children":9781},{"id":9780},"with-directchattransport-no-api-route-needed",[9782],{"type":121,"value":9783},"With DirectChatTransport (No API Route Needed)",{"type":115,"tag":745,"props":9785,"children":9787},{"className":5888,"code":9786,"language":5890,"meta":750,"style":750},"\"use client\";\nimport { useChat } from \"@ai-sdk\u002Freact\";\nimport { DirectChatTransport } from \"ai\";\nimport { myAgent } from \"@\u002Flib\u002Fagent\"; \u002F\u002F a ToolLoopAgent instance\n\nfunction Chat() {\n  const { messages, sendMessage, status } = useChat({\n    transport: new DirectChatTransport({ agent: myAgent }),\n  });\n  \u002F\u002F Same UI as above — no \u002Fapi\u002Fchat route required\n}\n",[9788],{"type":115,"tag":157,"props":9789,"children":9790},{"__ignoreMap":750},[9791,9810,9849,9889,9936,9943,9962,10013,10065,10080,10088],{"type":115,"tag":756,"props":9792,"children":9793},{"class":758,"line":759},[9794,9798,9802,9806],{"type":115,"tag":756,"props":9795,"children":9796},{"style":1376},[9797],{"type":121,"value":1409},{"type":115,"tag":756,"props":9799,"children":9800},{"style":769},[9801],{"type":121,"value":5906},{"type":115,"tag":756,"props":9803,"children":9804},{"style":1376},[9805],{"type":121,"value":1409},{"type":115,"tag":756,"props":9807,"children":9808},{"style":1376},[9809],{"type":121,"value":1414},{"type":115,"tag":756,"props":9811,"children":9812},{"class":758,"line":785},[9813,9817,9821,9825,9829,9833,9837,9841,9845],{"type":115,"tag":756,"props":9814,"children":9815},{"style":1370},[9816],{"type":121,"value":1373},{"type":115,"tag":756,"props":9818,"children":9819},{"style":1376},[9820],{"type":121,"value":1379},{"type":115,"tag":756,"props":9822,"children":9823},{"style":1382},[9824],{"type":121,"value":5930},{"type":115,"tag":756,"props":9826,"children":9827},{"style":1376},[9828],{"type":121,"value":1390},{"type":115,"tag":756,"props":9830,"children":9831},{"style":1370},[9832],{"type":121,"value":1395},{"type":115,"tag":756,"props":9834,"children":9835},{"style":1376},[9836],{"type":121,"value":1400},{"type":115,"tag":756,"props":9838,"children":9839},{"style":769},[9840],{"type":121,"value":248},{"type":115,"tag":756,"props":9842,"children":9843},{"style":1376},[9844],{"type":121,"value":1409},{"type":115,"tag":756,"props":9846,"children":9847},{"style":1376},[9848],{"type":121,"value":1414},{"type":115,"tag":756,"props":9850,"children":9851},{"class":758,"line":808},[9852,9856,9860,9865,9869,9873,9877,9881,9885],{"type":115,"tag":756,"props":9853,"children":9854},{"style":1370},[9855],{"type":121,"value":1373},{"type":115,"tag":756,"props":9857,"children":9858},{"style":1376},[9859],{"type":121,"value":1379},{"type":115,"tag":756,"props":9861,"children":9862},{"style":1382},[9863],{"type":121,"value":9864}," DirectChatTransport",{"type":115,"tag":756,"props":9866,"children":9867},{"style":1376},[9868],{"type":121,"value":1390},{"type":115,"tag":756,"props":9870,"children":9871},{"style":1370},[9872],{"type":121,"value":1395},{"type":115,"tag":756,"props":9874,"children":9875},{"style":1376},[9876],{"type":121,"value":1400},{"type":115,"tag":756,"props":9878,"children":9879},{"style":769},[9880],{"type":121,"value":76},{"type":115,"tag":756,"props":9882,"children":9883},{"style":1376},[9884],{"type":121,"value":1409},{"type":115,"tag":756,"props":9886,"children":9887},{"style":1376},[9888],{"type":121,"value":1414},{"type":115,"tag":756,"props":9890,"children":9891},{"class":758,"line":830},[9892,9896,9900,9905,9909,9913,9917,9922,9926,9931],{"type":115,"tag":756,"props":9893,"children":9894},{"style":1370},[9895],{"type":121,"value":1373},{"type":115,"tag":756,"props":9897,"children":9898},{"style":1376},[9899],{"type":121,"value":1379},{"type":115,"tag":756,"props":9901,"children":9902},{"style":1382},[9903],{"type":121,"value":9904}," myAgent",{"type":115,"tag":756,"props":9906,"children":9907},{"style":1376},[9908],{"type":121,"value":1390},{"type":115,"tag":756,"props":9910,"children":9911},{"style":1370},[9912],{"type":121,"value":1395},{"type":115,"tag":756,"props":9914,"children":9915},{"style":1376},[9916],{"type":121,"value":1400},{"type":115,"tag":756,"props":9918,"children":9919},{"style":769},[9920],{"type":121,"value":9921},"@\u002Flib\u002Fagent",{"type":115,"tag":756,"props":9923,"children":9924},{"style":1376},[9925],{"type":121,"value":1409},{"type":115,"tag":756,"props":9927,"children":9928},{"style":1376},[9929],{"type":121,"value":9930},";",{"type":115,"tag":756,"props":9932,"children":9933},{"style":802},[9934],{"type":121,"value":9935}," \u002F\u002F a ToolLoopAgent instance\n",{"type":115,"tag":756,"props":9937,"children":9938},{"class":758,"line":1251},[9939],{"type":115,"tag":756,"props":9940,"children":9941},{"emptyLinePlaceholder":1420},[9942],{"type":121,"value":1423},{"type":115,"tag":756,"props":9944,"children":9945},{"class":758,"line":110},[9946,9950,9954,9958],{"type":115,"tag":756,"props":9947,"children":9948},{"style":1429},[9949],{"type":121,"value":5969},{"type":115,"tag":756,"props":9951,"children":9952},{"style":1459},[9953],{"type":121,"value":5974},{"type":115,"tag":756,"props":9955,"children":9956},{"style":1376},[9957],{"type":121,"value":2698},{"type":115,"tag":756,"props":9959,"children":9960},{"style":1376},[9961],{"type":121,"value":3221},{"type":115,"tag":756,"props":9963,"children":9964},{"class":758,"line":1817},[9965,9969,9973,9977,9981,9985,9989,9993,9997,10001,10005,10009],{"type":115,"tag":756,"props":9966,"children":9967},{"style":1429},[9968],{"type":121,"value":5990},{"type":115,"tag":756,"props":9970,"children":9971},{"style":1376},[9972],{"type":121,"value":1379},{"type":115,"tag":756,"props":9974,"children":9975},{"style":1382},[9976],{"type":121,"value":5999},{"type":115,"tag":756,"props":9978,"children":9979},{"style":1376},[9980],{"type":121,"value":1503},{"type":115,"tag":756,"props":9982,"children":9983},{"style":1382},[9984],{"type":121,"value":9549},{"type":115,"tag":756,"props":9986,"children":9987},{"style":1376},[9988],{"type":121,"value":1503},{"type":115,"tag":756,"props":9990,"children":9991},{"style":1382},[9992],{"type":121,"value":9558},{"type":115,"tag":756,"props":9994,"children":9995},{"style":1376},[9996],{"type":121,"value":1390},{"type":115,"tag":756,"props":9998,"children":9999},{"style":1376},[10000],{"type":121,"value":1451},{"type":115,"tag":756,"props":10002,"children":10003},{"style":1459},[10004],{"type":121,"value":5930},{"type":115,"tag":756,"props":10006,"children":10007},{"style":1477},[10008],{"type":121,"value":1466},{"type":115,"tag":756,"props":10010,"children":10011},{"style":1376},[10012],{"type":121,"value":1471},{"type":115,"tag":756,"props":10014,"children":10015},{"class":758,"line":42},[10016,10021,10025,10029,10033,10037,10041,10045,10049,10053,10057,10061],{"type":115,"tag":756,"props":10017,"children":10018},{"style":1477},[10019],{"type":121,"value":10020},"    transport",{"type":115,"tag":756,"props":10022,"children":10023},{"style":1376},[10024],{"type":121,"value":1485},{"type":115,"tag":756,"props":10026,"children":10027},{"style":1376},[10028],{"type":121,"value":4149},{"type":115,"tag":756,"props":10030,"children":10031},{"style":1459},[10032],{"type":121,"value":9864},{"type":115,"tag":756,"props":10034,"children":10035},{"style":1477},[10036],{"type":121,"value":1466},{"type":115,"tag":756,"props":10038,"children":10039},{"style":1376},[10040],{"type":121,"value":5310},{"type":115,"tag":756,"props":10042,"children":10043},{"style":1477},[10044],{"type":121,"value":4518},{"type":115,"tag":756,"props":10046,"children":10047},{"style":1376},[10048],{"type":121,"value":1485},{"type":115,"tag":756,"props":10050,"children":10051},{"style":1382},[10052],{"type":121,"value":9904},{"type":115,"tag":756,"props":10054,"children":10055},{"style":1376},[10056],{"type":121,"value":1390},{"type":115,"tag":756,"props":10058,"children":10059},{"style":1477},[10060],{"type":121,"value":1550},{"type":115,"tag":756,"props":10062,"children":10063},{"style":1376},[10064],{"type":121,"value":1538},{"type":115,"tag":756,"props":10066,"children":10067},{"class":758,"line":2139},[10068,10072,10076],{"type":115,"tag":756,"props":10069,"children":10070},{"style":1376},[10071],{"type":121,"value":2936},{"type":115,"tag":756,"props":10073,"children":10074},{"style":1477},[10075],{"type":121,"value":1550},{"type":115,"tag":756,"props":10077,"children":10078},{"style":1376},[10079],{"type":121,"value":1414},{"type":115,"tag":756,"props":10081,"children":10082},{"class":758,"line":2148},[10083],{"type":115,"tag":756,"props":10084,"children":10085},{"style":802},[10086],{"type":121,"value":10087},"  \u002F\u002F Same UI as above — no \u002Fapi\u002Fchat route required\n",{"type":115,"tag":756,"props":10089,"children":10090},{"class":758,"line":2178},[10091],{"type":115,"tag":756,"props":10092,"children":10093},{"style":1376},[10094],{"type":121,"value":2358},{"type":115,"tag":128,"props":10096,"children":10097},{},[10098],{"type":121,"value":10099},"Useful for SSR scenarios, testing without network, and single-process apps.",{"type":115,"tag":128,"props":10101,"children":10102},{},[10103],{"type":115,"tag":132,"props":10104,"children":10105},{},[10106],{"type":121,"value":10107},"v6 changes from v5:",{"type":115,"tag":225,"props":10109,"children":10110},{},[10111,10127,10143,10166,10196,10212],{"type":115,"tag":229,"props":10112,"children":10113},{},[10114,10120,10121],{"type":115,"tag":157,"props":10115,"children":10117},{"className":10116},[],[10118],{"type":121,"value":10119},"useChat({ api })",{"type":121,"value":6702},{"type":115,"tag":157,"props":10122,"children":10124},{"className":10123},[],[10125],{"type":121,"value":10126},"useChat({ transport: new DefaultChatTransport({ api }) })",{"type":115,"tag":229,"props":10128,"children":10129},{},[10130,10136,10137],{"type":115,"tag":157,"props":10131,"children":10133},{"className":10132},[],[10134],{"type":121,"value":10135},"handleSubmit",{"type":121,"value":6702},{"type":115,"tag":157,"props":10138,"children":10140},{"className":10139},[],[10141],{"type":121,"value":10142},"sendMessage({ text })",{"type":115,"tag":229,"props":10144,"children":10145},{},[10146,10151,10152,10158,10160],{"type":115,"tag":157,"props":10147,"children":10149},{"className":10148},[],[10150],{"type":121,"value":3912},{"type":121,"value":1128},{"type":115,"tag":157,"props":10153,"children":10155},{"className":10154},[],[10156],{"type":121,"value":10157},"handleInputChange",{"type":121,"value":10159}," → manage your own ",{"type":115,"tag":157,"props":10161,"children":10163},{"className":10162},[],[10164],{"type":121,"value":10165},"useState",{"type":115,"tag":229,"props":10167,"children":10168},{},[10169,10174,10175,10180,10182,10187,10189,10194],{"type":115,"tag":157,"props":10170,"children":10172},{"className":10171},[],[10173],{"type":121,"value":334},{"type":121,"value":1128},{"type":115,"tag":157,"props":10176,"children":10178},{"className":10177},[],[10179],{"type":121,"value":342},{"type":121,"value":10181}," options were removed from ",{"type":115,"tag":157,"props":10183,"children":10185},{"className":10184},[],[10186],{"type":121,"value":209},{"type":121,"value":10188},"; use ",{"type":115,"tag":157,"props":10190,"children":10192},{"className":10191},[],[10193],{"type":121,"value":350},{"type":121,"value":10195}," to configure requests\u002Fresponses",{"type":115,"tag":229,"props":10197,"children":10198},{},[10199,10205,10206],{"type":115,"tag":157,"props":10200,"children":10202},{"className":10201},[],[10203],{"type":121,"value":10204},"isLoading",{"type":121,"value":6702},{"type":115,"tag":157,"props":10207,"children":10209},{"className":10208},[],[10210],{"type":121,"value":10211},"status === 'streaming' || status === 'submitted'",{"type":115,"tag":229,"props":10213,"children":10214},{},[10215,10221,10223,10229],{"type":115,"tag":157,"props":10216,"children":10218},{"className":10217},[],[10219],{"type":121,"value":10220},"message.content",{"type":121,"value":10222}," → iterate ",{"type":115,"tag":157,"props":10224,"children":10226},{"className":10225},[],[10227],{"type":121,"value":10228},"message.parts",{"type":121,"value":10230}," (UIMessage format)",{"type":115,"tag":1945,"props":10232,"children":10234},{"id":10233},"choose-the-correct-streaming-response-helper",[10235],{"type":121,"value":10236},"Choose the correct streaming response helper",{"type":115,"tag":225,"props":10238,"children":10239},{},[10240,10263,10287,10314],{"type":115,"tag":229,"props":10241,"children":10242},{},[10243,10248,10250,10255,10256,10261],{"type":115,"tag":157,"props":10244,"children":10246},{"className":10245},[],[10247],{"type":121,"value":623},{"type":121,"value":10249}," is for ",{"type":115,"tag":157,"props":10251,"children":10253},{"className":10252},[],[10254],{"type":121,"value":209},{"type":121,"value":617},{"type":115,"tag":157,"props":10257,"children":10259},{"className":10258},[],[10260],{"type":121,"value":9272},{"type":121,"value":10262}," UIMessage-based chat UIs. Use it when you need tool calls, metadata, reasoning, and other rich message parts.",{"type":115,"tag":229,"props":10264,"children":10265},{},[10266,10272,10273,10278,10280,10285],{"type":115,"tag":157,"props":10267,"children":10269},{"className":10268},[],[10270],{"type":121,"value":10271},"toTextStreamResponse()",{"type":121,"value":10249},{"type":115,"tag":132,"props":10274,"children":10275},{},[10276],{"type":121,"value":10277},"non-browser clients only",{"type":121,"value":10279}," — CLI tools, server-to-server pipes, or programmatic consumers that process raw text without rendering it in a UI. If the text will be displayed in a browser, use ",{"type":115,"tag":157,"props":10281,"children":10283},{"className":10282},[],[10284],{"type":121,"value":623},{"type":121,"value":10286}," + AI Elements instead.",{"type":115,"tag":229,"props":10288,"children":10289},{},[10290,10292,10297,10299,10304,10306,10312],{"type":121,"value":10291},"Warning: Do ",{"type":115,"tag":132,"props":10293,"children":10294},{},[10295],{"type":121,"value":10296},"not",{"type":121,"value":10298}," return ",{"type":115,"tag":157,"props":10300,"children":10302},{"className":10301},[],[10303],{"type":121,"value":623},{"type":121,"value":10305}," to a plain ",{"type":115,"tag":157,"props":10307,"children":10309},{"className":10308},[],[10310],{"type":121,"value":10311},"fetch()",{"type":121,"value":10313}," client unless that client intentionally parses the AI SDK UI message stream protocol.",{"type":115,"tag":229,"props":10315,"children":10316},{},[10317,10318,10322,10324,10329,10331,10336,10338,10343,10344,10349,10350,10356],{"type":121,"value":10291},{"type":115,"tag":132,"props":10319,"children":10320},{},[10321],{"type":121,"value":10296},{"type":121,"value":10323}," use ",{"type":115,"tag":157,"props":10325,"children":10327},{"className":10326},[],[10328],{"type":121,"value":10271},{"type":121,"value":10330}," + manual ",{"type":115,"tag":157,"props":10332,"children":10334},{"className":10333},[],[10335],{"type":121,"value":10311},{"type":121,"value":10337}," stream reading as a way to skip AI Elements. If the output goes to a browser, use ",{"type":115,"tag":157,"props":10339,"children":10341},{"className":10340},[],[10342],{"type":121,"value":209},{"type":121,"value":617},{"type":115,"tag":157,"props":10345,"children":10347},{"className":10346},[],[10348],{"type":121,"value":9172},{"type":121,"value":336},{"type":115,"tag":157,"props":10351,"children":10353},{"className":10352},[],[10354],{"type":121,"value":10355},"\u003CMessage>",{"type":121,"value":352},{"type":115,"tag":1945,"props":10358,"children":10360},{"id":10359},"server-side-for-usechat-api-route",[10361],{"type":121,"value":10362},"Server-side for useChat (API Route)",{"type":115,"tag":745,"props":10364,"children":10366},{"className":1358,"code":10365,"language":1360,"meta":750,"style":750},"\u002F\u002F app\u002Fapi\u002Fchat\u002Froute.ts\nimport { streamText, convertToModelMessages, stepCountIs } from \"ai\";\nimport type { UIMessage } from \"ai\";\n\nexport async function POST(req: Request) {\n  const { messages }: { messages: UIMessage[] } = await req.json();\n  \u002F\u002F IMPORTANT: convertToModelMessages is async in v6\n  const modelMessages = await convertToModelMessages(messages);\n  const result = streamText({\n    model: \"openai\u002Fgpt-5.4\",\n    messages: modelMessages,\n    tools: {\n      \u002F* your tools *\u002F\n    },\n    \u002F\u002F IMPORTANT: use stopWhen with stepCountIs for multi-step tool calling\n    \u002F\u002F maxSteps was removed in v6 — use this instead\n    stopWhen: stepCountIs(5),\n  });\n  \u002F\u002F Use toUIMessageStreamResponse (not toDataStreamResponse) for chat UIs\n  return result.toUIMessageStreamResponse();\n}\n",[10367],{"type":115,"tag":157,"props":10368,"children":10369},{"__ignoreMap":750},[10370,10378,10434,10479,10486,10534,10609,10617,10657,10684,10712,10732,10748,10756,10763,10771,10779,10812,10827,10835,10863],{"type":115,"tag":756,"props":10371,"children":10372},{"class":758,"line":759},[10373],{"type":115,"tag":756,"props":10374,"children":10375},{"style":802},[10376],{"type":121,"value":10377},"\u002F\u002F app\u002Fapi\u002Fchat\u002Froute.ts\n",{"type":115,"tag":756,"props":10379,"children":10380},{"class":758,"line":785},[10381,10385,10389,10393,10397,10402,10406,10410,10414,10418,10422,10426,10430],{"type":115,"tag":756,"props":10382,"children":10383},{"style":1370},[10384],{"type":121,"value":1373},{"type":115,"tag":756,"props":10386,"children":10387},{"style":1376},[10388],{"type":121,"value":1379},{"type":115,"tag":756,"props":10390,"children":10391},{"style":1382},[10392],{"type":121,"value":1981},{"type":115,"tag":756,"props":10394,"children":10395},{"style":1376},[10396],{"type":121,"value":1503},{"type":115,"tag":756,"props":10398,"children":10399},{"style":1382},[10400],{"type":121,"value":10401}," convertToModelMessages",{"type":115,"tag":756,"props":10403,"children":10404},{"style":1376},[10405],{"type":121,"value":1503},{"type":115,"tag":756,"props":10407,"children":10408},{"style":1382},[10409],{"type":121,"value":4088},{"type":115,"tag":756,"props":10411,"children":10412},{"style":1376},[10413],{"type":121,"value":1390},{"type":115,"tag":756,"props":10415,"children":10416},{"style":1370},[10417],{"type":121,"value":1395},{"type":115,"tag":756,"props":10419,"children":10420},{"style":1376},[10421],{"type":121,"value":1400},{"type":115,"tag":756,"props":10423,"children":10424},{"style":769},[10425],{"type":121,"value":76},{"type":115,"tag":756,"props":10427,"children":10428},{"style":1376},[10429],{"type":121,"value":1409},{"type":115,"tag":756,"props":10431,"children":10432},{"style":1376},[10433],{"type":121,"value":1414},{"type":115,"tag":756,"props":10435,"children":10436},{"class":758,"line":808},[10437,10441,10446,10450,10455,10459,10463,10467,10471,10475],{"type":115,"tag":756,"props":10438,"children":10439},{"style":1370},[10440],{"type":121,"value":1373},{"type":115,"tag":756,"props":10442,"children":10443},{"style":1370},[10444],{"type":121,"value":10445}," type",{"type":115,"tag":756,"props":10447,"children":10448},{"style":1376},[10449],{"type":121,"value":1379},{"type":115,"tag":756,"props":10451,"children":10452},{"style":1382},[10453],{"type":121,"value":10454}," UIMessage",{"type":115,"tag":756,"props":10456,"children":10457},{"style":1376},[10458],{"type":121,"value":1390},{"type":115,"tag":756,"props":10460,"children":10461},{"style":1370},[10462],{"type":121,"value":1395},{"type":115,"tag":756,"props":10464,"children":10465},{"style":1376},[10466],{"type":121,"value":1400},{"type":115,"tag":756,"props":10468,"children":10469},{"style":769},[10470],{"type":121,"value":76},{"type":115,"tag":756,"props":10472,"children":10473},{"style":1376},[10474],{"type":121,"value":1409},{"type":115,"tag":756,"props":10476,"children":10477},{"style":1376},[10478],{"type":121,"value":1414},{"type":115,"tag":756,"props":10480,"children":10481},{"class":758,"line":830},[10482],{"type":115,"tag":756,"props":10483,"children":10484},{"emptyLinePlaceholder":1420},[10485],{"type":121,"value":1423},{"type":115,"tag":756,"props":10487,"children":10488},{"class":758,"line":1251},[10489,10494,10498,10503,10508,10512,10517,10521,10526,10530],{"type":115,"tag":756,"props":10490,"children":10491},{"style":1370},[10492],{"type":121,"value":10493},"export",{"type":115,"tag":756,"props":10495,"children":10496},{"style":1429},[10497],{"type":121,"value":3539},{"type":115,"tag":756,"props":10499,"children":10500},{"style":1429},[10501],{"type":121,"value":10502}," function",{"type":115,"tag":756,"props":10504,"children":10505},{"style":1459},[10506],{"type":121,"value":10507}," POST",{"type":115,"tag":756,"props":10509,"children":10510},{"style":1376},[10511],{"type":121,"value":1466},{"type":115,"tag":756,"props":10513,"children":10514},{"style":3547},[10515],{"type":121,"value":10516},"req",{"type":115,"tag":756,"props":10518,"children":10519},{"style":1376},[10520],{"type":121,"value":1485},{"type":115,"tag":756,"props":10522,"children":10523},{"style":763},[10524],{"type":121,"value":10525}," Request",{"type":115,"tag":756,"props":10527,"children":10528},{"style":1376},[10529],{"type":121,"value":1550},{"type":115,"tag":756,"props":10531,"children":10532},{"style":1376},[10533],{"type":121,"value":3221},{"type":115,"tag":756,"props":10535,"children":10536},{"class":758,"line":110},[10537,10541,10545,10549,10554,10558,10562,10566,10570,10575,10579,10583,10587,10592,10596,10601,10605],{"type":115,"tag":756,"props":10538,"children":10539},{"style":1429},[10540],{"type":121,"value":5990},{"type":115,"tag":756,"props":10542,"children":10543},{"style":1376},[10544],{"type":121,"value":1379},{"type":115,"tag":756,"props":10546,"children":10547},{"style":1382},[10548],{"type":121,"value":5999},{"type":115,"tag":756,"props":10550,"children":10551},{"style":1376},[10552],{"type":121,"value":10553}," }:",{"type":115,"tag":756,"props":10555,"children":10556},{"style":1376},[10557],{"type":121,"value":1379},{"type":115,"tag":756,"props":10559,"children":10560},{"style":1477},[10561],{"type":121,"value":5999},{"type":115,"tag":756,"props":10563,"children":10564},{"style":1376},[10565],{"type":121,"value":1485},{"type":115,"tag":756,"props":10567,"children":10568},{"style":763},[10569],{"type":121,"value":10454},{"type":115,"tag":756,"props":10571,"children":10572},{"style":1477},[10573],{"type":121,"value":10574},"[] ",{"type":115,"tag":756,"props":10576,"children":10577},{"style":1376},[10578],{"type":121,"value":1446},{"type":115,"tag":756,"props":10580,"children":10581},{"style":1376},[10582],{"type":121,"value":1451},{"type":115,"tag":756,"props":10584,"children":10585},{"style":1370},[10586],{"type":121,"value":1456},{"type":115,"tag":756,"props":10588,"children":10589},{"style":1382},[10590],{"type":121,"value":10591}," req",{"type":115,"tag":756,"props":10593,"children":10594},{"style":1376},[10595],{"type":121,"value":352},{"type":115,"tag":756,"props":10597,"children":10598},{"style":1459},[10599],{"type":121,"value":10600},"json",{"type":115,"tag":756,"props":10602,"children":10603},{"style":1477},[10604],{"type":121,"value":2698},{"type":115,"tag":756,"props":10606,"children":10607},{"style":1376},[10608],{"type":121,"value":1414},{"type":115,"tag":756,"props":10610,"children":10611},{"class":758,"line":1817},[10612],{"type":115,"tag":756,"props":10613,"children":10614},{"style":802},[10615],{"type":121,"value":10616},"  \u002F\u002F IMPORTANT: convertToModelMessages is async in v6\n",{"type":115,"tag":756,"props":10618,"children":10619},{"class":758,"line":42},[10620,10624,10629,10633,10637,10641,10645,10649,10653],{"type":115,"tag":756,"props":10621,"children":10622},{"style":1429},[10623],{"type":121,"value":5990},{"type":115,"tag":756,"props":10625,"children":10626},{"style":1382},[10627],{"type":121,"value":10628}," modelMessages",{"type":115,"tag":756,"props":10630,"children":10631},{"style":1376},[10632],{"type":121,"value":1451},{"type":115,"tag":756,"props":10634,"children":10635},{"style":1370},[10636],{"type":121,"value":1456},{"type":115,"tag":756,"props":10638,"children":10639},{"style":1459},[10640],{"type":121,"value":10401},{"type":115,"tag":756,"props":10642,"children":10643},{"style":1477},[10644],{"type":121,"value":1466},{"type":115,"tag":756,"props":10646,"children":10647},{"style":1382},[10648],{"type":121,"value":9626},{"type":115,"tag":756,"props":10650,"children":10651},{"style":1477},[10652],{"type":121,"value":1550},{"type":115,"tag":756,"props":10654,"children":10655},{"style":1376},[10656],{"type":121,"value":1414},{"type":115,"tag":756,"props":10658,"children":10659},{"class":758,"line":2139},[10660,10664,10668,10672,10676,10680],{"type":115,"tag":756,"props":10661,"children":10662},{"style":1429},[10663],{"type":121,"value":5990},{"type":115,"tag":756,"props":10665,"children":10666},{"style":1382},[10667],{"type":121,"value":2292},{"type":115,"tag":756,"props":10669,"children":10670},{"style":1376},[10671],{"type":121,"value":1451},{"type":115,"tag":756,"props":10673,"children":10674},{"style":1459},[10675],{"type":121,"value":1981},{"type":115,"tag":756,"props":10677,"children":10678},{"style":1477},[10679],{"type":121,"value":1466},{"type":115,"tag":756,"props":10681,"children":10682},{"style":1376},[10683],{"type":121,"value":1471},{"type":115,"tag":756,"props":10685,"children":10686},{"class":758,"line":2148},[10687,10692,10696,10700,10704,10708],{"type":115,"tag":756,"props":10688,"children":10689},{"style":1477},[10690],{"type":121,"value":10691},"    model",{"type":115,"tag":756,"props":10693,"children":10694},{"style":1376},[10695],{"type":121,"value":1485},{"type":115,"tag":756,"props":10697,"children":10698},{"style":1376},[10699],{"type":121,"value":1400},{"type":115,"tag":756,"props":10701,"children":10702},{"style":769},[10703],{"type":121,"value":1494},{"type":115,"tag":756,"props":10705,"children":10706},{"style":1376},[10707],{"type":121,"value":1409},{"type":115,"tag":756,"props":10709,"children":10710},{"style":1376},[10711],{"type":121,"value":1538},{"type":115,"tag":756,"props":10713,"children":10714},{"class":758,"line":2178},[10715,10720,10724,10728],{"type":115,"tag":756,"props":10716,"children":10717},{"style":1477},[10718],{"type":121,"value":10719},"    messages",{"type":115,"tag":756,"props":10721,"children":10722},{"style":1376},[10723],{"type":121,"value":1485},{"type":115,"tag":756,"props":10725,"children":10726},{"style":1382},[10727],{"type":121,"value":10628},{"type":115,"tag":756,"props":10729,"children":10730},{"style":1376},[10731],{"type":121,"value":1538},{"type":115,"tag":756,"props":10733,"children":10734},{"class":758,"line":2206},[10735,10740,10744],{"type":115,"tag":756,"props":10736,"children":10737},{"style":1477},[10738],{"type":121,"value":10739},"    tools",{"type":115,"tag":756,"props":10741,"children":10742},{"style":1376},[10743],{"type":121,"value":1485},{"type":115,"tag":756,"props":10745,"children":10746},{"style":1376},[10747],{"type":121,"value":3221},{"type":115,"tag":756,"props":10749,"children":10750},{"class":758,"line":2235},[10751],{"type":115,"tag":756,"props":10752,"children":10753},{"style":802},[10754],{"type":121,"value":10755},"      \u002F* your tools *\u002F\n",{"type":115,"tag":756,"props":10757,"children":10758},{"class":758,"line":2251},[10759],{"type":115,"tag":756,"props":10760,"children":10761},{"style":1376},[10762],{"type":121,"value":3977},{"type":115,"tag":756,"props":10764,"children":10765},{"class":758,"line":2259},[10766],{"type":115,"tag":756,"props":10767,"children":10768},{"style":802},[10769],{"type":121,"value":10770},"    \u002F\u002F IMPORTANT: use stopWhen with stepCountIs for multi-step tool calling\n",{"type":115,"tag":756,"props":10772,"children":10773},{"class":758,"line":2308},[10774],{"type":115,"tag":756,"props":10775,"children":10776},{"style":802},[10777],{"type":121,"value":10778},"    \u002F\u002F maxSteps was removed in v6 — use this instead\n",{"type":115,"tag":756,"props":10780,"children":10781},{"class":758,"line":2352},[10782,10787,10791,10795,10799,10804,10808],{"type":115,"tag":756,"props":10783,"children":10784},{"style":1477},[10785],{"type":121,"value":10786},"    stopWhen",{"type":115,"tag":756,"props":10788,"children":10789},{"style":1376},[10790],{"type":121,"value":1485},{"type":115,"tag":756,"props":10792,"children":10793},{"style":1459},[10794],{"type":121,"value":4088},{"type":115,"tag":756,"props":10796,"children":10797},{"style":1477},[10798],{"type":121,"value":1466},{"type":115,"tag":756,"props":10800,"children":10801},{"style":4406},[10802],{"type":121,"value":10803},"5",{"type":115,"tag":756,"props":10805,"children":10806},{"style":1477},[10807],{"type":121,"value":1550},{"type":115,"tag":756,"props":10809,"children":10810},{"style":1376},[10811],{"type":121,"value":1538},{"type":115,"tag":756,"props":10813,"children":10814},{"class":758,"line":2913},[10815,10819,10823],{"type":115,"tag":756,"props":10816,"children":10817},{"style":1376},[10818],{"type":121,"value":2936},{"type":115,"tag":756,"props":10820,"children":10821},{"style":1477},[10822],{"type":121,"value":1550},{"type":115,"tag":756,"props":10824,"children":10825},{"style":1376},[10826],{"type":121,"value":1414},{"type":115,"tag":756,"props":10828,"children":10829},{"class":758,"line":2930},[10830],{"type":115,"tag":756,"props":10831,"children":10832},{"style":802},[10833],{"type":121,"value":10834},"  \u002F\u002F Use toUIMessageStreamResponse (not toDataStreamResponse) for chat UIs\n",{"type":115,"tag":756,"props":10836,"children":10837},{"class":758,"line":2947},[10838,10842,10846,10850,10855,10859],{"type":115,"tag":756,"props":10839,"children":10840},{"style":1370},[10841],{"type":121,"value":6043},{"type":115,"tag":756,"props":10843,"children":10844},{"style":1382},[10845],{"type":121,"value":2292},{"type":115,"tag":756,"props":10847,"children":10848},{"style":1376},[10849],{"type":121,"value":352},{"type":115,"tag":756,"props":10851,"children":10852},{"style":1459},[10853],{"type":121,"value":10854},"toUIMessageStreamResponse",{"type":115,"tag":756,"props":10856,"children":10857},{"style":1477},[10858],{"type":121,"value":2698},{"type":115,"tag":756,"props":10860,"children":10861},{"style":1376},[10862],{"type":121,"value":1414},{"type":115,"tag":756,"props":10864,"children":10865},{"class":758,"line":2976},[10866],{"type":115,"tag":756,"props":10867,"children":10868},{"style":1376},[10869],{"type":121,"value":2358},{"type":115,"tag":1945,"props":10871,"children":10873},{"id":10872},"server-side-with-toolloopagent-agent-api-route",[10874],{"type":121,"value":10875},"Server-side with ToolLoopAgent (Agent API Route)",{"type":115,"tag":128,"props":10877,"children":10878},{},[10879,10881,10886,10888,10894],{"type":121,"value":10880},"Define a ",{"type":115,"tag":157,"props":10882,"children":10884},{"className":10883},[],[10885],{"type":121,"value":193},{"type":121,"value":10887}," and use ",{"type":115,"tag":157,"props":10889,"children":10891},{"className":10890},[],[10892],{"type":121,"value":10893},"createAgentUIStreamResponse",{"type":121,"value":10895}," for the API route:",{"type":115,"tag":745,"props":10897,"children":10899},{"className":1358,"code":10898,"language":1360,"meta":750,"style":750},"\u002F\u002F lib\u002Fagent.ts\nimport { ToolLoopAgent, stepCountIs } from \"ai\";\n\nexport const myAgent = new ToolLoopAgent({\n  model: \"openai\u002Fgpt-5.4\",\n  instructions: \"You are a helpful assistant.\",\n  tools: { \u002F* your tools *\u002F },\n  stopWhen: stepCountIs(5),\n});\n",[10900],{"type":115,"tag":157,"props":10901,"children":10902},{"__ignoreMap":750},[10903,10911,10958,10965,11002,11029,11056,11080,11111],{"type":115,"tag":756,"props":10904,"children":10905},{"class":758,"line":759},[10906],{"type":115,"tag":756,"props":10907,"children":10908},{"style":802},[10909],{"type":121,"value":10910},"\u002F\u002F lib\u002Fagent.ts\n",{"type":115,"tag":756,"props":10912,"children":10913},{"class":758,"line":785},[10914,10918,10922,10926,10930,10934,10938,10942,10946,10950,10954],{"type":115,"tag":756,"props":10915,"children":10916},{"style":1370},[10917],{"type":121,"value":1373},{"type":115,"tag":756,"props":10919,"children":10920},{"style":1376},[10921],{"type":121,"value":1379},{"type":115,"tag":756,"props":10923,"children":10924},{"style":1382},[10925],{"type":121,"value":4079},{"type":115,"tag":756,"props":10927,"children":10928},{"style":1376},[10929],{"type":121,"value":1503},{"type":115,"tag":756,"props":10931,"children":10932},{"style":1382},[10933],{"type":121,"value":4088},{"type":115,"tag":756,"props":10935,"children":10936},{"style":1376},[10937],{"type":121,"value":1390},{"type":115,"tag":756,"props":10939,"children":10940},{"style":1370},[10941],{"type":121,"value":1395},{"type":115,"tag":756,"props":10943,"children":10944},{"style":1376},[10945],{"type":121,"value":1400},{"type":115,"tag":756,"props":10947,"children":10948},{"style":769},[10949],{"type":121,"value":76},{"type":115,"tag":756,"props":10951,"children":10952},{"style":1376},[10953],{"type":121,"value":1409},{"type":115,"tag":756,"props":10955,"children":10956},{"style":1376},[10957],{"type":121,"value":1414},{"type":115,"tag":756,"props":10959,"children":10960},{"class":758,"line":808},[10961],{"type":115,"tag":756,"props":10962,"children":10963},{"emptyLinePlaceholder":1420},[10964],{"type":121,"value":1423},{"type":115,"tag":756,"props":10966,"children":10967},{"class":758,"line":830},[10968,10972,10977,10982,10986,10990,10994,10998],{"type":115,"tag":756,"props":10969,"children":10970},{"style":1370},[10971],{"type":121,"value":10493},{"type":115,"tag":756,"props":10973,"children":10974},{"style":1429},[10975],{"type":121,"value":10976}," const",{"type":115,"tag":756,"props":10978,"children":10979},{"style":1382},[10980],{"type":121,"value":10981}," myAgent ",{"type":115,"tag":756,"props":10983,"children":10984},{"style":1376},[10985],{"type":121,"value":2163},{"type":115,"tag":756,"props":10987,"children":10988},{"style":1376},[10989],{"type":121,"value":4149},{"type":115,"tag":756,"props":10991,"children":10992},{"style":1459},[10993],{"type":121,"value":4079},{"type":115,"tag":756,"props":10995,"children":10996},{"style":1382},[10997],{"type":121,"value":1466},{"type":115,"tag":756,"props":10999,"children":11000},{"style":1376},[11001],{"type":121,"value":1471},{"type":115,"tag":756,"props":11003,"children":11004},{"class":758,"line":1251},[11005,11009,11013,11017,11021,11025],{"type":115,"tag":756,"props":11006,"children":11007},{"style":1477},[11008],{"type":121,"value":1480},{"type":115,"tag":756,"props":11010,"children":11011},{"style":1376},[11012],{"type":121,"value":1485},{"type":115,"tag":756,"props":11014,"children":11015},{"style":1376},[11016],{"type":121,"value":1400},{"type":115,"tag":756,"props":11018,"children":11019},{"style":769},[11020],{"type":121,"value":1494},{"type":115,"tag":756,"props":11022,"children":11023},{"style":1376},[11024],{"type":121,"value":1409},{"type":115,"tag":756,"props":11026,"children":11027},{"style":1376},[11028],{"type":121,"value":1538},{"type":115,"tag":756,"props":11030,"children":11031},{"class":758,"line":110},[11032,11036,11040,11044,11048,11052],{"type":115,"tag":756,"props":11033,"children":11034},{"style":1477},[11035],{"type":121,"value":4248},{"type":115,"tag":756,"props":11037,"children":11038},{"style":1376},[11039],{"type":121,"value":1485},{"type":115,"tag":756,"props":11041,"children":11042},{"style":1376},[11043],{"type":121,"value":1400},{"type":115,"tag":756,"props":11045,"children":11046},{"style":769},[11047],{"type":121,"value":4261},{"type":115,"tag":756,"props":11049,"children":11050},{"style":1376},[11051],{"type":121,"value":1409},{"type":115,"tag":756,"props":11053,"children":11054},{"style":1376},[11055],{"type":121,"value":1538},{"type":115,"tag":756,"props":11057,"children":11058},{"class":758,"line":1817},[11059,11063,11067,11071,11076],{"type":115,"tag":756,"props":11060,"children":11061},{"style":1477},[11062],{"type":121,"value":3212},{"type":115,"tag":756,"props":11064,"children":11065},{"style":1376},[11066],{"type":121,"value":1485},{"type":115,"tag":756,"props":11068,"children":11069},{"style":1376},[11070],{"type":121,"value":1379},{"type":115,"tag":756,"props":11072,"children":11073},{"style":802},[11074],{"type":121,"value":11075}," \u002F* your tools *\u002F",{"type":115,"tag":756,"props":11077,"children":11078},{"style":1376},[11079],{"type":121,"value":1814},{"type":115,"tag":756,"props":11081,"children":11082},{"class":758,"line":42},[11083,11087,11091,11095,11099,11103,11107],{"type":115,"tag":756,"props":11084,"children":11085},{"style":1477},[11086],{"type":121,"value":4285},{"type":115,"tag":756,"props":11088,"children":11089},{"style":1376},[11090],{"type":121,"value":1485},{"type":115,"tag":756,"props":11092,"children":11093},{"style":1459},[11094],{"type":121,"value":4088},{"type":115,"tag":756,"props":11096,"children":11097},{"style":1382},[11098],{"type":121,"value":1466},{"type":115,"tag":756,"props":11100,"children":11101},{"style":4406},[11102],{"type":121,"value":10803},{"type":115,"tag":756,"props":11104,"children":11105},{"style":1382},[11106],{"type":121,"value":1550},{"type":115,"tag":756,"props":11108,"children":11109},{"style":1376},[11110],{"type":121,"value":1538},{"type":115,"tag":756,"props":11112,"children":11113},{"class":758,"line":2139},[11114,11118,11122],{"type":115,"tag":756,"props":11115,"children":11116},{"style":1376},[11117],{"type":121,"value":1446},{"type":115,"tag":756,"props":11119,"children":11120},{"style":1382},[11121],{"type":121,"value":1550},{"type":115,"tag":756,"props":11123,"children":11124},{"style":1376},[11125],{"type":121,"value":1414},{"type":115,"tag":745,"props":11127,"children":11129},{"className":1358,"code":11128,"language":1360,"meta":750,"style":750},"\u002F\u002F app\u002Fapi\u002Fchat\u002Froute.ts — agent API route\nimport { createAgentUIStreamResponse } from \"ai\";\nimport { myAgent } from \"@\u002Flib\u002Fagent\";\n\nexport async function POST(req: Request) {\n  const { messages } = await req.json();\n  return createAgentUIStreamResponse({ agent: myAgent, uiMessages: messages });\n}\n",[11130],{"type":115,"tag":157,"props":11131,"children":11132},{"__ignoreMap":750},[11133,11141,11181,11220,11227,11270,11317,11377],{"type":115,"tag":756,"props":11134,"children":11135},{"class":758,"line":759},[11136],{"type":115,"tag":756,"props":11137,"children":11138},{"style":802},[11139],{"type":121,"value":11140},"\u002F\u002F app\u002Fapi\u002Fchat\u002Froute.ts — agent API route\n",{"type":115,"tag":756,"props":11142,"children":11143},{"class":758,"line":785},[11144,11148,11152,11157,11161,11165,11169,11173,11177],{"type":115,"tag":756,"props":11145,"children":11146},{"style":1370},[11147],{"type":121,"value":1373},{"type":115,"tag":756,"props":11149,"children":11150},{"style":1376},[11151],{"type":121,"value":1379},{"type":115,"tag":756,"props":11153,"children":11154},{"style":1382},[11155],{"type":121,"value":11156}," createAgentUIStreamResponse",{"type":115,"tag":756,"props":11158,"children":11159},{"style":1376},[11160],{"type":121,"value":1390},{"type":115,"tag":756,"props":11162,"children":11163},{"style":1370},[11164],{"type":121,"value":1395},{"type":115,"tag":756,"props":11166,"children":11167},{"style":1376},[11168],{"type":121,"value":1400},{"type":115,"tag":756,"props":11170,"children":11171},{"style":769},[11172],{"type":121,"value":76},{"type":115,"tag":756,"props":11174,"children":11175},{"style":1376},[11176],{"type":121,"value":1409},{"type":115,"tag":756,"props":11178,"children":11179},{"style":1376},[11180],{"type":121,"value":1414},{"type":115,"tag":756,"props":11182,"children":11183},{"class":758,"line":808},[11184,11188,11192,11196,11200,11204,11208,11212,11216],{"type":115,"tag":756,"props":11185,"children":11186},{"style":1370},[11187],{"type":121,"value":1373},{"type":115,"tag":756,"props":11189,"children":11190},{"style":1376},[11191],{"type":121,"value":1379},{"type":115,"tag":756,"props":11193,"children":11194},{"style":1382},[11195],{"type":121,"value":9904},{"type":115,"tag":756,"props":11197,"children":11198},{"style":1376},[11199],{"type":121,"value":1390},{"type":115,"tag":756,"props":11201,"children":11202},{"style":1370},[11203],{"type":121,"value":1395},{"type":115,"tag":756,"props":11205,"children":11206},{"style":1376},[11207],{"type":121,"value":1400},{"type":115,"tag":756,"props":11209,"children":11210},{"style":769},[11211],{"type":121,"value":9921},{"type":115,"tag":756,"props":11213,"children":11214},{"style":1376},[11215],{"type":121,"value":1409},{"type":115,"tag":756,"props":11217,"children":11218},{"style":1376},[11219],{"type":121,"value":1414},{"type":115,"tag":756,"props":11221,"children":11222},{"class":758,"line":830},[11223],{"type":115,"tag":756,"props":11224,"children":11225},{"emptyLinePlaceholder":1420},[11226],{"type":121,"value":1423},{"type":115,"tag":756,"props":11228,"children":11229},{"class":758,"line":1251},[11230,11234,11238,11242,11246,11250,11254,11258,11262,11266],{"type":115,"tag":756,"props":11231,"children":11232},{"style":1370},[11233],{"type":121,"value":10493},{"type":115,"tag":756,"props":11235,"children":11236},{"style":1429},[11237],{"type":121,"value":3539},{"type":115,"tag":756,"props":11239,"children":11240},{"style":1429},[11241],{"type":121,"value":10502},{"type":115,"tag":756,"props":11243,"children":11244},{"style":1459},[11245],{"type":121,"value":10507},{"type":115,"tag":756,"props":11247,"children":11248},{"style":1376},[11249],{"type":121,"value":1466},{"type":115,"tag":756,"props":11251,"children":11252},{"style":3547},[11253],{"type":121,"value":10516},{"type":115,"tag":756,"props":11255,"children":11256},{"style":1376},[11257],{"type":121,"value":1485},{"type":115,"tag":756,"props":11259,"children":11260},{"style":763},[11261],{"type":121,"value":10525},{"type":115,"tag":756,"props":11263,"children":11264},{"style":1376},[11265],{"type":121,"value":1550},{"type":115,"tag":756,"props":11267,"children":11268},{"style":1376},[11269],{"type":121,"value":3221},{"type":115,"tag":756,"props":11271,"children":11272},{"class":758,"line":110},[11273,11277,11281,11285,11289,11293,11297,11301,11305,11309,11313],{"type":115,"tag":756,"props":11274,"children":11275},{"style":1429},[11276],{"type":121,"value":5990},{"type":115,"tag":756,"props":11278,"children":11279},{"style":1376},[11280],{"type":121,"value":1379},{"type":115,"tag":756,"props":11282,"children":11283},{"style":1382},[11284],{"type":121,"value":5999},{"type":115,"tag":756,"props":11286,"children":11287},{"style":1376},[11288],{"type":121,"value":1390},{"type":115,"tag":756,"props":11290,"children":11291},{"style":1376},[11292],{"type":121,"value":1451},{"type":115,"tag":756,"props":11294,"children":11295},{"style":1370},[11296],{"type":121,"value":1456},{"type":115,"tag":756,"props":11298,"children":11299},{"style":1382},[11300],{"type":121,"value":10591},{"type":115,"tag":756,"props":11302,"children":11303},{"style":1376},[11304],{"type":121,"value":352},{"type":115,"tag":756,"props":11306,"children":11307},{"style":1459},[11308],{"type":121,"value":10600},{"type":115,"tag":756,"props":11310,"children":11311},{"style":1477},[11312],{"type":121,"value":2698},{"type":115,"tag":756,"props":11314,"children":11315},{"style":1376},[11316],{"type":121,"value":1414},{"type":115,"tag":756,"props":11318,"children":11319},{"class":758,"line":1817},[11320,11324,11328,11332,11336,11340,11344,11348,11352,11357,11361,11365,11369,11373],{"type":115,"tag":756,"props":11321,"children":11322},{"style":1370},[11323],{"type":121,"value":6043},{"type":115,"tag":756,"props":11325,"children":11326},{"style":1459},[11327],{"type":121,"value":11156},{"type":115,"tag":756,"props":11329,"children":11330},{"style":1477},[11331],{"type":121,"value":1466},{"type":115,"tag":756,"props":11333,"children":11334},{"style":1376},[11335],{"type":121,"value":5310},{"type":115,"tag":756,"props":11337,"children":11338},{"style":1477},[11339],{"type":121,"value":4518},{"type":115,"tag":756,"props":11341,"children":11342},{"style":1376},[11343],{"type":121,"value":1485},{"type":115,"tag":756,"props":11345,"children":11346},{"style":1382},[11347],{"type":121,"value":9904},{"type":115,"tag":756,"props":11349,"children":11350},{"style":1376},[11351],{"type":121,"value":1503},{"type":115,"tag":756,"props":11353,"children":11354},{"style":1477},[11355],{"type":121,"value":11356}," uiMessages",{"type":115,"tag":756,"props":11358,"children":11359},{"style":1376},[11360],{"type":121,"value":1485},{"type":115,"tag":756,"props":11362,"children":11363},{"style":1382},[11364],{"type":121,"value":5999},{"type":115,"tag":756,"props":11366,"children":11367},{"style":1376},[11368],{"type":121,"value":1390},{"type":115,"tag":756,"props":11370,"children":11371},{"style":1477},[11372],{"type":121,"value":1550},{"type":115,"tag":756,"props":11374,"children":11375},{"style":1376},[11376],{"type":121,"value":1414},{"type":115,"tag":756,"props":11378,"children":11379},{"class":758,"line":42},[11380],{"type":115,"tag":756,"props":11381,"children":11382},{"style":1376},[11383],{"type":121,"value":2358},{"type":115,"tag":128,"props":11385,"children":11386},{},[11387,11389,11394],{"type":121,"value":11388},"Or use ",{"type":115,"tag":157,"props":11390,"children":11392},{"className":11391},[],[11393],{"type":121,"value":555},{"type":121,"value":11395}," on the client to skip the API route entirely.",{"type":115,"tag":1945,"props":11397,"children":11399},{"id":11398},"server-side-for-text-only-clients-non-browser-only",[11400],{"type":121,"value":11401},"Server-side for text-only clients (non-browser only)",{"type":115,"tag":124,"props":11403,"children":11404},{},[11405],{"type":115,"tag":128,"props":11406,"children":11407},{},[11408,11413,11415,11420],{"type":115,"tag":132,"props":11409,"children":11410},{},[11411],{"type":121,"value":11412},"This pattern is for CLI tools, server-to-server pipes, and programmatic consumers.",{"type":121,"value":11414}," If the response will be displayed in a browser UI, use ",{"type":115,"tag":157,"props":11416,"children":11418},{"className":11417},[],[11419],{"type":121,"value":623},{"type":121,"value":11421}," + AI Elements instead — even for \"simple\" streaming text panels.",{"type":115,"tag":745,"props":11423,"children":11425},{"className":1358,"code":11424,"language":1360,"meta":750,"style":750},"\u002F\u002F app\u002Fapi\u002Fgenerate\u002Froute.ts — for CLI or server consumers, NOT browser UIs\nimport { streamText } from \"ai\";\n\nexport async function POST(req: Request) {\n  const { prompt }: { prompt: string } = await req.json();\n  const result = streamText({\n    model: \"openai\u002Fgpt-5.4\",\n    prompt,\n  });\n\n  return result.toTextStreamResponse();\n}\n",[11426],{"type":115,"tag":157,"props":11427,"children":11428},{"__ignoreMap":750},[11429,11437,11476,11483,11526,11595,11622,11649,11661,11676,11683,11711],{"type":115,"tag":756,"props":11430,"children":11431},{"class":758,"line":759},[11432],{"type":115,"tag":756,"props":11433,"children":11434},{"style":802},[11435],{"type":121,"value":11436},"\u002F\u002F app\u002Fapi\u002Fgenerate\u002Froute.ts — for CLI or server consumers, NOT browser UIs\n",{"type":115,"tag":756,"props":11438,"children":11439},{"class":758,"line":785},[11440,11444,11448,11452,11456,11460,11464,11468,11472],{"type":115,"tag":756,"props":11441,"children":11442},{"style":1370},[11443],{"type":121,"value":1373},{"type":115,"tag":756,"props":11445,"children":11446},{"style":1376},[11447],{"type":121,"value":1379},{"type":115,"tag":756,"props":11449,"children":11450},{"style":1382},[11451],{"type":121,"value":1981},{"type":115,"tag":756,"props":11453,"children":11454},{"style":1376},[11455],{"type":121,"value":1390},{"type":115,"tag":756,"props":11457,"children":11458},{"style":1370},[11459],{"type":121,"value":1395},{"type":115,"tag":756,"props":11461,"children":11462},{"style":1376},[11463],{"type":121,"value":1400},{"type":115,"tag":756,"props":11465,"children":11466},{"style":769},[11467],{"type":121,"value":76},{"type":115,"tag":756,"props":11469,"children":11470},{"style":1376},[11471],{"type":121,"value":1409},{"type":115,"tag":756,"props":11473,"children":11474},{"style":1376},[11475],{"type":121,"value":1414},{"type":115,"tag":756,"props":11477,"children":11478},{"class":758,"line":808},[11479],{"type":115,"tag":756,"props":11480,"children":11481},{"emptyLinePlaceholder":1420},[11482],{"type":121,"value":1423},{"type":115,"tag":756,"props":11484,"children":11485},{"class":758,"line":830},[11486,11490,11494,11498,11502,11506,11510,11514,11518,11522],{"type":115,"tag":756,"props":11487,"children":11488},{"style":1370},[11489],{"type":121,"value":10493},{"type":115,"tag":756,"props":11491,"children":11492},{"style":1429},[11493],{"type":121,"value":3539},{"type":115,"tag":756,"props":11495,"children":11496},{"style":1429},[11497],{"type":121,"value":10502},{"type":115,"tag":756,"props":11499,"children":11500},{"style":1459},[11501],{"type":121,"value":10507},{"type":115,"tag":756,"props":11503,"children":11504},{"style":1376},[11505],{"type":121,"value":1466},{"type":115,"tag":756,"props":11507,"children":11508},{"style":3547},[11509],{"type":121,"value":10516},{"type":115,"tag":756,"props":11511,"children":11512},{"style":1376},[11513],{"type":121,"value":1485},{"type":115,"tag":756,"props":11515,"children":11516},{"style":763},[11517],{"type":121,"value":10525},{"type":115,"tag":756,"props":11519,"children":11520},{"style":1376},[11521],{"type":121,"value":1550},{"type":115,"tag":756,"props":11523,"children":11524},{"style":1376},[11525],{"type":121,"value":3221},{"type":115,"tag":756,"props":11527,"children":11528},{"class":758,"line":1251},[11529,11533,11537,11542,11546,11550,11554,11558,11563,11567,11571,11575,11579,11583,11587,11591],{"type":115,"tag":756,"props":11530,"children":11531},{"style":1429},[11532],{"type":121,"value":5990},{"type":115,"tag":756,"props":11534,"children":11535},{"style":1376},[11536],{"type":121,"value":1379},{"type":115,"tag":756,"props":11538,"children":11539},{"style":1382},[11540],{"type":121,"value":11541}," prompt",{"type":115,"tag":756,"props":11543,"children":11544},{"style":1376},[11545],{"type":121,"value":10553},{"type":115,"tag":756,"props":11547,"children":11548},{"style":1376},[11549],{"type":121,"value":1379},{"type":115,"tag":756,"props":11551,"children":11552},{"style":1477},[11553],{"type":121,"value":11541},{"type":115,"tag":756,"props":11555,"children":11556},{"style":1376},[11557],{"type":121,"value":1485},{"type":115,"tag":756,"props":11559,"children":11560},{"style":763},[11561],{"type":121,"value":11562}," string",{"type":115,"tag":756,"props":11564,"children":11565},{"style":1376},[11566],{"type":121,"value":1390},{"type":115,"tag":756,"props":11568,"children":11569},{"style":1376},[11570],{"type":121,"value":1451},{"type":115,"tag":756,"props":11572,"children":11573},{"style":1370},[11574],{"type":121,"value":1456},{"type":115,"tag":756,"props":11576,"children":11577},{"style":1382},[11578],{"type":121,"value":10591},{"type":115,"tag":756,"props":11580,"children":11581},{"style":1376},[11582],{"type":121,"value":352},{"type":115,"tag":756,"props":11584,"children":11585},{"style":1459},[11586],{"type":121,"value":10600},{"type":115,"tag":756,"props":11588,"children":11589},{"style":1477},[11590],{"type":121,"value":2698},{"type":115,"tag":756,"props":11592,"children":11593},{"style":1376},[11594],{"type":121,"value":1414},{"type":115,"tag":756,"props":11596,"children":11597},{"class":758,"line":110},[11598,11602,11606,11610,11614,11618],{"type":115,"tag":756,"props":11599,"children":11600},{"style":1429},[11601],{"type":121,"value":5990},{"type":115,"tag":756,"props":11603,"children":11604},{"style":1382},[11605],{"type":121,"value":2292},{"type":115,"tag":756,"props":11607,"children":11608},{"style":1376},[11609],{"type":121,"value":1451},{"type":115,"tag":756,"props":11611,"children":11612},{"style":1459},[11613],{"type":121,"value":1981},{"type":115,"tag":756,"props":11615,"children":11616},{"style":1477},[11617],{"type":121,"value":1466},{"type":115,"tag":756,"props":11619,"children":11620},{"style":1376},[11621],{"type":121,"value":1471},{"type":115,"tag":756,"props":11623,"children":11624},{"class":758,"line":1817},[11625,11629,11633,11637,11641,11645],{"type":115,"tag":756,"props":11626,"children":11627},{"style":1477},[11628],{"type":121,"value":10691},{"type":115,"tag":756,"props":11630,"children":11631},{"style":1376},[11632],{"type":121,"value":1485},{"type":115,"tag":756,"props":11634,"children":11635},{"style":1376},[11636],{"type":121,"value":1400},{"type":115,"tag":756,"props":11638,"children":11639},{"style":769},[11640],{"type":121,"value":1494},{"type":115,"tag":756,"props":11642,"children":11643},{"style":1376},[11644],{"type":121,"value":1409},{"type":115,"tag":756,"props":11646,"children":11647},{"style":1376},[11648],{"type":121,"value":1538},{"type":115,"tag":756,"props":11650,"children":11651},{"class":758,"line":42},[11652,11657],{"type":115,"tag":756,"props":11653,"children":11654},{"style":1382},[11655],{"type":121,"value":11656},"    prompt",{"type":115,"tag":756,"props":11658,"children":11659},{"style":1376},[11660],{"type":121,"value":1538},{"type":115,"tag":756,"props":11662,"children":11663},{"class":758,"line":2139},[11664,11668,11672],{"type":115,"tag":756,"props":11665,"children":11666},{"style":1376},[11667],{"type":121,"value":2936},{"type":115,"tag":756,"props":11669,"children":11670},{"style":1477},[11671],{"type":121,"value":1550},{"type":115,"tag":756,"props":11673,"children":11674},{"style":1376},[11675],{"type":121,"value":1414},{"type":115,"tag":756,"props":11677,"children":11678},{"class":758,"line":2148},[11679],{"type":115,"tag":756,"props":11680,"children":11681},{"emptyLinePlaceholder":1420},[11682],{"type":121,"value":1423},{"type":115,"tag":756,"props":11684,"children":11685},{"class":758,"line":2178},[11686,11690,11694,11698,11703,11707],{"type":115,"tag":756,"props":11687,"children":11688},{"style":1370},[11689],{"type":121,"value":6043},{"type":115,"tag":756,"props":11691,"children":11692},{"style":1382},[11693],{"type":121,"value":2292},{"type":115,"tag":756,"props":11695,"children":11696},{"style":1376},[11697],{"type":121,"value":352},{"type":115,"tag":756,"props":11699,"children":11700},{"style":1459},[11701],{"type":121,"value":11702},"toTextStreamResponse",{"type":115,"tag":756,"props":11704,"children":11705},{"style":1477},[11706],{"type":121,"value":2698},{"type":115,"tag":756,"props":11708,"children":11709},{"style":1376},[11710],{"type":121,"value":1414},{"type":115,"tag":756,"props":11712,"children":11713},{"class":758,"line":2206},[11714],{"type":115,"tag":756,"props":11715,"children":11716},{"style":1376},[11717],{"type":121,"value":2358},{"type":115,"tag":218,"props":11719,"children":11721},{"id":11720},"language-model-middleware",[11722],{"type":121,"value":11723},"Language Model Middleware",{"type":115,"tag":128,"props":11725,"children":11726},{},[11727],{"type":121,"value":11728},"Intercept and transform model calls for RAG, guardrails, logging:",{"type":115,"tag":745,"props":11730,"children":11732},{"className":1358,"code":11731,"language":1360,"meta":750,"style":750},"import { wrapLanguageModel } from \"ai\";\n\nconst wrappedModel = wrapLanguageModel({\n  model: \"openai\u002Fgpt-5.4\",\n  middleware: {\n    transformParams: async ({ params }) => {\n      \u002F\u002F Inject RAG context, modify system prompt, etc.\n      return { ...params, system: params.system + \"\\n\\nContext: ...\" };\n    },\n    wrapGenerate: async ({ doGenerate }) => {\n      const result = await doGenerate();\n      \u002F\u002F Post-process, log, validate guardrails\n      return result;\n    },\n  },\n});\n",[11733],{"type":115,"tag":157,"props":11734,"children":11735},{"__ignoreMap":750},[11736,11776,11783,11811,11838,11854,11891,11899,11972,11979,12016,12048,12056,12071,12078,12085],{"type":115,"tag":756,"props":11737,"children":11738},{"class":758,"line":759},[11739,11743,11747,11752,11756,11760,11764,11768,11772],{"type":115,"tag":756,"props":11740,"children":11741},{"style":1370},[11742],{"type":121,"value":1373},{"type":115,"tag":756,"props":11744,"children":11745},{"style":1376},[11746],{"type":121,"value":1379},{"type":115,"tag":756,"props":11748,"children":11749},{"style":1382},[11750],{"type":121,"value":11751}," wrapLanguageModel",{"type":115,"tag":756,"props":11753,"children":11754},{"style":1376},[11755],{"type":121,"value":1390},{"type":115,"tag":756,"props":11757,"children":11758},{"style":1370},[11759],{"type":121,"value":1395},{"type":115,"tag":756,"props":11761,"children":11762},{"style":1376},[11763],{"type":121,"value":1400},{"type":115,"tag":756,"props":11765,"children":11766},{"style":769},[11767],{"type":121,"value":76},{"type":115,"tag":756,"props":11769,"children":11770},{"style":1376},[11771],{"type":121,"value":1409},{"type":115,"tag":756,"props":11773,"children":11774},{"style":1376},[11775],{"type":121,"value":1414},{"type":115,"tag":756,"props":11777,"children":11778},{"class":758,"line":785},[11779],{"type":115,"tag":756,"props":11780,"children":11781},{"emptyLinePlaceholder":1420},[11782],{"type":121,"value":1423},{"type":115,"tag":756,"props":11784,"children":11785},{"class":758,"line":808},[11786,11790,11795,11799,11803,11807],{"type":115,"tag":756,"props":11787,"children":11788},{"style":1429},[11789],{"type":121,"value":1432},{"type":115,"tag":756,"props":11791,"children":11792},{"style":1382},[11793],{"type":121,"value":11794}," wrappedModel ",{"type":115,"tag":756,"props":11796,"children":11797},{"style":1376},[11798],{"type":121,"value":2163},{"type":115,"tag":756,"props":11800,"children":11801},{"style":1459},[11802],{"type":121,"value":11751},{"type":115,"tag":756,"props":11804,"children":11805},{"style":1382},[11806],{"type":121,"value":1466},{"type":115,"tag":756,"props":11808,"children":11809},{"style":1376},[11810],{"type":121,"value":1471},{"type":115,"tag":756,"props":11812,"children":11813},{"class":758,"line":830},[11814,11818,11822,11826,11830,11834],{"type":115,"tag":756,"props":11815,"children":11816},{"style":1477},[11817],{"type":121,"value":1480},{"type":115,"tag":756,"props":11819,"children":11820},{"style":1376},[11821],{"type":121,"value":1485},{"type":115,"tag":756,"props":11823,"children":11824},{"style":1376},[11825],{"type":121,"value":1400},{"type":115,"tag":756,"props":11827,"children":11828},{"style":769},[11829],{"type":121,"value":1494},{"type":115,"tag":756,"props":11831,"children":11832},{"style":1376},[11833],{"type":121,"value":1409},{"type":115,"tag":756,"props":11835,"children":11836},{"style":1376},[11837],{"type":121,"value":1538},{"type":115,"tag":756,"props":11839,"children":11840},{"class":758,"line":1251},[11841,11846,11850],{"type":115,"tag":756,"props":11842,"children":11843},{"style":1477},[11844],{"type":121,"value":11845},"  middleware",{"type":115,"tag":756,"props":11847,"children":11848},{"style":1376},[11849],{"type":121,"value":1485},{"type":115,"tag":756,"props":11851,"children":11852},{"style":1376},[11853],{"type":121,"value":3221},{"type":115,"tag":756,"props":11855,"children":11856},{"class":758,"line":110},[11857,11862,11866,11870,11874,11879,11883,11887],{"type":115,"tag":756,"props":11858,"children":11859},{"style":1459},[11860],{"type":121,"value":11861},"    transformParams",{"type":115,"tag":756,"props":11863,"children":11864},{"style":1376},[11865],{"type":121,"value":1485},{"type":115,"tag":756,"props":11867,"children":11868},{"style":1429},[11869],{"type":121,"value":3539},{"type":115,"tag":756,"props":11871,"children":11872},{"style":1376},[11873],{"type":121,"value":3544},{"type":115,"tag":756,"props":11875,"children":11876},{"style":3547},[11877],{"type":121,"value":11878}," params",{"type":115,"tag":756,"props":11880,"children":11881},{"style":1376},[11882],{"type":121,"value":3555},{"type":115,"tag":756,"props":11884,"children":11885},{"style":1429},[11886],{"type":121,"value":3560},{"type":115,"tag":756,"props":11888,"children":11889},{"style":1376},[11890],{"type":121,"value":3221},{"type":115,"tag":756,"props":11892,"children":11893},{"class":758,"line":1817},[11894],{"type":115,"tag":756,"props":11895,"children":11896},{"style":802},[11897],{"type":121,"value":11898},"      \u002F\u002F Inject RAG context, modify system prompt, etc.\n",{"type":115,"tag":756,"props":11900,"children":11901},{"class":758,"line":42},[11902,11906,11910,11915,11920,11924,11929,11933,11937,11941,11945,11950,11954,11959,11964,11968],{"type":115,"tag":756,"props":11903,"children":11904},{"style":1370},[11905],{"type":121,"value":3940},{"type":115,"tag":756,"props":11907,"children":11908},{"style":1376},[11909],{"type":121,"value":1379},{"type":115,"tag":756,"props":11911,"children":11912},{"style":1376},[11913],{"type":121,"value":11914}," ...",{"type":115,"tag":756,"props":11916,"children":11917},{"style":1382},[11918],{"type":121,"value":11919},"params",{"type":115,"tag":756,"props":11921,"children":11922},{"style":1376},[11923],{"type":121,"value":1503},{"type":115,"tag":756,"props":11925,"children":11926},{"style":1477},[11927],{"type":121,"value":11928}," system",{"type":115,"tag":756,"props":11930,"children":11931},{"style":1376},[11932],{"type":121,"value":1485},{"type":115,"tag":756,"props":11934,"children":11935},{"style":1382},[11936],{"type":121,"value":11878},{"type":115,"tag":756,"props":11938,"children":11939},{"style":1376},[11940],{"type":121,"value":352},{"type":115,"tag":756,"props":11942,"children":11943},{"style":1382},[11944],{"type":121,"value":475},{"type":115,"tag":756,"props":11946,"children":11947},{"style":1376},[11948],{"type":121,"value":11949}," +",{"type":115,"tag":756,"props":11951,"children":11952},{"style":1376},[11953],{"type":121,"value":1400},{"type":115,"tag":756,"props":11955,"children":11956},{"style":1382},[11957],{"type":121,"value":11958},"\\n\\n",{"type":115,"tag":756,"props":11960,"children":11961},{"style":769},[11962],{"type":121,"value":11963},"Context: ...",{"type":115,"tag":756,"props":11965,"children":11966},{"style":1376},[11967],{"type":121,"value":1409},{"type":115,"tag":756,"props":11969,"children":11970},{"style":1376},[11971],{"type":121,"value":3672},{"type":115,"tag":756,"props":11973,"children":11974},{"class":758,"line":2139},[11975],{"type":115,"tag":756,"props":11976,"children":11977},{"style":1376},[11978],{"type":121,"value":3977},{"type":115,"tag":756,"props":11980,"children":11981},{"class":758,"line":2148},[11982,11987,11991,11995,11999,12004,12008,12012],{"type":115,"tag":756,"props":11983,"children":11984},{"style":1459},[11985],{"type":121,"value":11986},"    wrapGenerate",{"type":115,"tag":756,"props":11988,"children":11989},{"style":1376},[11990],{"type":121,"value":1485},{"type":115,"tag":756,"props":11992,"children":11993},{"style":1429},[11994],{"type":121,"value":3539},{"type":115,"tag":756,"props":11996,"children":11997},{"style":1376},[11998],{"type":121,"value":3544},{"type":115,"tag":756,"props":12000,"children":12001},{"style":3547},[12002],{"type":121,"value":12003}," doGenerate",{"type":115,"tag":756,"props":12005,"children":12006},{"style":1376},[12007],{"type":121,"value":3555},{"type":115,"tag":756,"props":12009,"children":12010},{"style":1429},[12011],{"type":121,"value":3560},{"type":115,"tag":756,"props":12013,"children":12014},{"style":1376},[12015],{"type":121,"value":3221},{"type":115,"tag":756,"props":12017,"children":12018},{"class":758,"line":2178},[12019,12024,12028,12032,12036,12040,12044],{"type":115,"tag":756,"props":12020,"children":12021},{"style":1429},[12022],{"type":121,"value":12023},"      const",{"type":115,"tag":756,"props":12025,"children":12026},{"style":1382},[12027],{"type":121,"value":2292},{"type":115,"tag":756,"props":12029,"children":12030},{"style":1376},[12031],{"type":121,"value":1451},{"type":115,"tag":756,"props":12033,"children":12034},{"style":1370},[12035],{"type":121,"value":1456},{"type":115,"tag":756,"props":12037,"children":12038},{"style":1459},[12039],{"type":121,"value":12003},{"type":115,"tag":756,"props":12041,"children":12042},{"style":1477},[12043],{"type":121,"value":2698},{"type":115,"tag":756,"props":12045,"children":12046},{"style":1376},[12047],{"type":121,"value":1414},{"type":115,"tag":756,"props":12049,"children":12050},{"class":758,"line":2206},[12051],{"type":115,"tag":756,"props":12052,"children":12053},{"style":802},[12054],{"type":121,"value":12055},"      \u002F\u002F Post-process, log, validate guardrails\n",{"type":115,"tag":756,"props":12057,"children":12058},{"class":758,"line":2235},[12059,12063,12067],{"type":115,"tag":756,"props":12060,"children":12061},{"style":1370},[12062],{"type":121,"value":3940},{"type":115,"tag":756,"props":12064,"children":12065},{"style":1382},[12066],{"type":121,"value":2292},{"type":115,"tag":756,"props":12068,"children":12069},{"style":1376},[12070],{"type":121,"value":1414},{"type":115,"tag":756,"props":12072,"children":12073},{"class":758,"line":2251},[12074],{"type":115,"tag":756,"props":12075,"children":12076},{"style":1376},[12077],{"type":121,"value":3977},{"type":115,"tag":756,"props":12079,"children":12080},{"class":758,"line":2259},[12081],{"type":115,"tag":756,"props":12082,"children":12083},{"style":1376},[12084],{"type":121,"value":3704},{"type":115,"tag":756,"props":12086,"children":12087},{"class":758,"line":2308},[12088,12092,12096],{"type":115,"tag":756,"props":12089,"children":12090},{"style":1376},[12091],{"type":121,"value":1446},{"type":115,"tag":756,"props":12093,"children":12094},{"style":1382},[12095],{"type":121,"value":1550},{"type":115,"tag":756,"props":12097,"children":12098},{"style":1376},[12099],{"type":121,"value":1414},{"type":115,"tag":218,"props":12101,"children":12103},{"id":12102},"provider-routing-via-ai-gateway",[12104],{"type":121,"value":12105},"Provider Routing via AI Gateway",{"type":115,"tag":745,"props":12107,"children":12109},{"className":1358,"code":12108,"language":1360,"meta":750,"style":750},"import { generateText } from \"ai\";\nimport { gateway } from \"ai\";\n\nconst result = await generateText({\n  model: gateway(\"anthropic\u002Fclaude-sonnet-4.6\"),\n  prompt: \"Hello!\",\n  providerOptions: {\n    gateway: {\n      order: [\"bedrock\", \"anthropic\"], \u002F\u002F Try Bedrock first\n      models: [\"openai\u002Fgpt-5.4\"], \u002F\u002F Fallback model\n      only: [\"anthropic\", \"bedrock\"], \u002F\u002F Restrict providers\n      user: \"user-123\", \u002F\u002F Usage tracking\n      tags: [\"feature:chat\", \"env:production\"], \u002F\u002F Cost attribution\n    },\n  },\n});\n",[12110],{"type":115,"tag":157,"props":12111,"children":12112},{"__ignoreMap":750},[12113,12152,12191,12198,12229,12268,12295,12310,12326,12385,12426,12483,12517,12576,12583,12590],{"type":115,"tag":756,"props":12114,"children":12115},{"class":758,"line":759},[12116,12120,12124,12128,12132,12136,12140,12144,12148],{"type":115,"tag":756,"props":12117,"children":12118},{"style":1370},[12119],{"type":121,"value":1373},{"type":115,"tag":756,"props":12121,"children":12122},{"style":1376},[12123],{"type":121,"value":1379},{"type":115,"tag":756,"props":12125,"children":12126},{"style":1382},[12127],{"type":121,"value":1385},{"type":115,"tag":756,"props":12129,"children":12130},{"style":1376},[12131],{"type":121,"value":1390},{"type":115,"tag":756,"props":12133,"children":12134},{"style":1370},[12135],{"type":121,"value":1395},{"type":115,"tag":756,"props":12137,"children":12138},{"style":1376},[12139],{"type":121,"value":1400},{"type":115,"tag":756,"props":12141,"children":12142},{"style":769},[12143],{"type":121,"value":76},{"type":115,"tag":756,"props":12145,"children":12146},{"style":1376},[12147],{"type":121,"value":1409},{"type":115,"tag":756,"props":12149,"children":12150},{"style":1376},[12151],{"type":121,"value":1414},{"type":115,"tag":756,"props":12153,"children":12154},{"class":758,"line":785},[12155,12159,12163,12167,12171,12175,12179,12183,12187],{"type":115,"tag":756,"props":12156,"children":12157},{"style":1370},[12158],{"type":121,"value":1373},{"type":115,"tag":756,"props":12160,"children":12161},{"style":1376},[12162],{"type":121,"value":1379},{"type":115,"tag":756,"props":12164,"children":12165},{"style":1382},[12166],{"type":121,"value":1612},{"type":115,"tag":756,"props":12168,"children":12169},{"style":1376},[12170],{"type":121,"value":1390},{"type":115,"tag":756,"props":12172,"children":12173},{"style":1370},[12174],{"type":121,"value":1395},{"type":115,"tag":756,"props":12176,"children":12177},{"style":1376},[12178],{"type":121,"value":1400},{"type":115,"tag":756,"props":12180,"children":12181},{"style":769},[12182],{"type":121,"value":76},{"type":115,"tag":756,"props":12184,"children":12185},{"style":1376},[12186],{"type":121,"value":1409},{"type":115,"tag":756,"props":12188,"children":12189},{"style":1376},[12190],{"type":121,"value":1414},{"type":115,"tag":756,"props":12192,"children":12193},{"class":758,"line":808},[12194],{"type":115,"tag":756,"props":12195,"children":12196},{"emptyLinePlaceholder":1420},[12197],{"type":121,"value":1423},{"type":115,"tag":756,"props":12199,"children":12200},{"class":758,"line":830},[12201,12205,12209,12213,12217,12221,12225],{"type":115,"tag":756,"props":12202,"children":12203},{"style":1429},[12204],{"type":121,"value":1432},{"type":115,"tag":756,"props":12206,"children":12207},{"style":1382},[12208],{"type":121,"value":2158},{"type":115,"tag":756,"props":12210,"children":12211},{"style":1376},[12212],{"type":121,"value":2163},{"type":115,"tag":756,"props":12214,"children":12215},{"style":1370},[12216],{"type":121,"value":1456},{"type":115,"tag":756,"props":12218,"children":12219},{"style":1459},[12220],{"type":121,"value":1385},{"type":115,"tag":756,"props":12222,"children":12223},{"style":1382},[12224],{"type":121,"value":1466},{"type":115,"tag":756,"props":12226,"children":12227},{"style":1376},[12228],{"type":121,"value":1471},{"type":115,"tag":756,"props":12230,"children":12231},{"class":758,"line":1251},[12232,12236,12240,12244,12248,12252,12256,12260,12264],{"type":115,"tag":756,"props":12233,"children":12234},{"style":1477},[12235],{"type":121,"value":1480},{"type":115,"tag":756,"props":12237,"children":12238},{"style":1376},[12239],{"type":121,"value":1485},{"type":115,"tag":756,"props":12241,"children":12242},{"style":1459},[12243],{"type":121,"value":1612},{"type":115,"tag":756,"props":12245,"children":12246},{"style":1382},[12247],{"type":121,"value":1466},{"type":115,"tag":756,"props":12249,"children":12250},{"style":1376},[12251],{"type":121,"value":1409},{"type":115,"tag":756,"props":12253,"children":12254},{"style":769},[12255],{"type":121,"value":1866},{"type":115,"tag":756,"props":12257,"children":12258},{"style":1376},[12259],{"type":121,"value":1409},{"type":115,"tag":756,"props":12261,"children":12262},{"style":1382},[12263],{"type":121,"value":1550},{"type":115,"tag":756,"props":12265,"children":12266},{"style":1376},[12267],{"type":121,"value":1538},{"type":115,"tag":756,"props":12269,"children":12270},{"class":758,"line":110},[12271,12275,12279,12283,12287,12291],{"type":115,"tag":756,"props":12272,"children":12273},{"style":1477},[12274],{"type":121,"value":1516},{"type":115,"tag":756,"props":12276,"children":12277},{"style":1376},[12278],{"type":121,"value":1485},{"type":115,"tag":756,"props":12280,"children":12281},{"style":1376},[12282],{"type":121,"value":1400},{"type":115,"tag":756,"props":12284,"children":12285},{"style":769},[12286],{"type":121,"value":1529},{"type":115,"tag":756,"props":12288,"children":12289},{"style":1376},[12290],{"type":121,"value":1409},{"type":115,"tag":756,"props":12292,"children":12293},{"style":1376},[12294],{"type":121,"value":1538},{"type":115,"tag":756,"props":12296,"children":12297},{"class":758,"line":1817},[12298,12302,12306],{"type":115,"tag":756,"props":12299,"children":12300},{"style":1477},[12301],{"type":121,"value":1737},{"type":115,"tag":756,"props":12303,"children":12304},{"style":1376},[12305],{"type":121,"value":1485},{"type":115,"tag":756,"props":12307,"children":12308},{"style":1376},[12309],{"type":121,"value":3221},{"type":115,"tag":756,"props":12311,"children":12312},{"class":758,"line":42},[12313,12318,12322],{"type":115,"tag":756,"props":12314,"children":12315},{"style":1477},[12316],{"type":121,"value":12317},"    gateway",{"type":115,"tag":756,"props":12319,"children":12320},{"style":1376},[12321],{"type":121,"value":1485},{"type":115,"tag":756,"props":12323,"children":12324},{"style":1376},[12325],{"type":121,"value":3221},{"type":115,"tag":756,"props":12327,"children":12328},{"class":758,"line":2139},[12329,12334,12338,12342,12346,12351,12355,12359,12363,12368,12372,12376,12380],{"type":115,"tag":756,"props":12330,"children":12331},{"style":1477},[12332],{"type":121,"value":12333},"      order",{"type":115,"tag":756,"props":12335,"children":12336},{"style":1376},[12337],{"type":121,"value":1485},{"type":115,"tag":756,"props":12339,"children":12340},{"style":1382},[12341],{"type":121,"value":1771},{"type":115,"tag":756,"props":12343,"children":12344},{"style":1376},[12345],{"type":121,"value":1409},{"type":115,"tag":756,"props":12347,"children":12348},{"style":769},[12349],{"type":121,"value":12350},"bedrock",{"type":115,"tag":756,"props":12352,"children":12353},{"style":1376},[12354],{"type":121,"value":1409},{"type":115,"tag":756,"props":12356,"children":12357},{"style":1376},[12358],{"type":121,"value":1503},{"type":115,"tag":756,"props":12360,"children":12361},{"style":1376},[12362],{"type":121,"value":1400},{"type":115,"tag":756,"props":12364,"children":12365},{"style":769},[12366],{"type":121,"value":12367},"anthropic",{"type":115,"tag":756,"props":12369,"children":12370},{"style":1376},[12371],{"type":121,"value":1409},{"type":115,"tag":756,"props":12373,"children":12374},{"style":1382},[12375],{"type":121,"value":7171},{"type":115,"tag":756,"props":12377,"children":12378},{"style":1376},[12379],{"type":121,"value":1503},{"type":115,"tag":756,"props":12381,"children":12382},{"style":802},[12383],{"type":121,"value":12384}," \u002F\u002F Try Bedrock first\n",{"type":115,"tag":756,"props":12386,"children":12387},{"class":758,"line":2148},[12388,12393,12397,12401,12405,12409,12413,12417,12421],{"type":115,"tag":756,"props":12389,"children":12390},{"style":1477},[12391],{"type":121,"value":12392},"      models",{"type":115,"tag":756,"props":12394,"children":12395},{"style":1376},[12396],{"type":121,"value":1485},{"type":115,"tag":756,"props":12398,"children":12399},{"style":1382},[12400],{"type":121,"value":1771},{"type":115,"tag":756,"props":12402,"children":12403},{"style":1376},[12404],{"type":121,"value":1409},{"type":115,"tag":756,"props":12406,"children":12407},{"style":769},[12408],{"type":121,"value":1494},{"type":115,"tag":756,"props":12410,"children":12411},{"style":1376},[12412],{"type":121,"value":1409},{"type":115,"tag":756,"props":12414,"children":12415},{"style":1382},[12416],{"type":121,"value":7171},{"type":115,"tag":756,"props":12418,"children":12419},{"style":1376},[12420],{"type":121,"value":1503},{"type":115,"tag":756,"props":12422,"children":12423},{"style":802},[12424],{"type":121,"value":12425}," \u002F\u002F Fallback model\n",{"type":115,"tag":756,"props":12427,"children":12428},{"class":758,"line":2178},[12429,12434,12438,12442,12446,12450,12454,12458,12462,12466,12470,12474,12478],{"type":115,"tag":756,"props":12430,"children":12431},{"style":1477},[12432],{"type":121,"value":12433},"      only",{"type":115,"tag":756,"props":12435,"children":12436},{"style":1376},[12437],{"type":121,"value":1485},{"type":115,"tag":756,"props":12439,"children":12440},{"style":1382},[12441],{"type":121,"value":1771},{"type":115,"tag":756,"props":12443,"children":12444},{"style":1376},[12445],{"type":121,"value":1409},{"type":115,"tag":756,"props":12447,"children":12448},{"style":769},[12449],{"type":121,"value":12367},{"type":115,"tag":756,"props":12451,"children":12452},{"style":1376},[12453],{"type":121,"value":1409},{"type":115,"tag":756,"props":12455,"children":12456},{"style":1376},[12457],{"type":121,"value":1503},{"type":115,"tag":756,"props":12459,"children":12460},{"style":1376},[12461],{"type":121,"value":1400},{"type":115,"tag":756,"props":12463,"children":12464},{"style":769},[12465],{"type":121,"value":12350},{"type":115,"tag":756,"props":12467,"children":12468},{"style":1376},[12469],{"type":121,"value":1409},{"type":115,"tag":756,"props":12471,"children":12472},{"style":1382},[12473],{"type":121,"value":7171},{"type":115,"tag":756,"props":12475,"children":12476},{"style":1376},[12477],{"type":121,"value":1503},{"type":115,"tag":756,"props":12479,"children":12480},{"style":802},[12481],{"type":121,"value":12482}," \u002F\u002F Restrict providers\n",{"type":115,"tag":756,"props":12484,"children":12485},{"class":758,"line":2206},[12486,12491,12495,12499,12504,12508,12512],{"type":115,"tag":756,"props":12487,"children":12488},{"style":1477},[12489],{"type":121,"value":12490},"      user",{"type":115,"tag":756,"props":12492,"children":12493},{"style":1376},[12494],{"type":121,"value":1485},{"type":115,"tag":756,"props":12496,"children":12497},{"style":1376},[12498],{"type":121,"value":1400},{"type":115,"tag":756,"props":12500,"children":12501},{"style":769},[12502],{"type":121,"value":12503},"user-123",{"type":115,"tag":756,"props":12505,"children":12506},{"style":1376},[12507],{"type":121,"value":1409},{"type":115,"tag":756,"props":12509,"children":12510},{"style":1376},[12511],{"type":121,"value":1503},{"type":115,"tag":756,"props":12513,"children":12514},{"style":802},[12515],{"type":121,"value":12516}," \u002F\u002F Usage tracking\n",{"type":115,"tag":756,"props":12518,"children":12519},{"class":758,"line":2235},[12520,12525,12529,12533,12537,12542,12546,12550,12554,12559,12563,12567,12571],{"type":115,"tag":756,"props":12521,"children":12522},{"style":1477},[12523],{"type":121,"value":12524},"      tags",{"type":115,"tag":756,"props":12526,"children":12527},{"style":1376},[12528],{"type":121,"value":1485},{"type":115,"tag":756,"props":12530,"children":12531},{"style":1382},[12532],{"type":121,"value":1771},{"type":115,"tag":756,"props":12534,"children":12535},{"style":1376},[12536],{"type":121,"value":1409},{"type":115,"tag":756,"props":12538,"children":12539},{"style":769},[12540],{"type":121,"value":12541},"feature:chat",{"type":115,"tag":756,"props":12543,"children":12544},{"style":1376},[12545],{"type":121,"value":1409},{"type":115,"tag":756,"props":12547,"children":12548},{"style":1376},[12549],{"type":121,"value":1503},{"type":115,"tag":756,"props":12551,"children":12552},{"style":1376},[12553],{"type":121,"value":1400},{"type":115,"tag":756,"props":12555,"children":12556},{"style":769},[12557],{"type":121,"value":12558},"env:production",{"type":115,"tag":756,"props":12560,"children":12561},{"style":1376},[12562],{"type":121,"value":1409},{"type":115,"tag":756,"props":12564,"children":12565},{"style":1382},[12566],{"type":121,"value":7171},{"type":115,"tag":756,"props":12568,"children":12569},{"style":1376},[12570],{"type":121,"value":1503},{"type":115,"tag":756,"props":12572,"children":12573},{"style":802},[12574],{"type":121,"value":12575}," \u002F\u002F Cost attribution\n",{"type":115,"tag":756,"props":12577,"children":12578},{"class":758,"line":2251},[12579],{"type":115,"tag":756,"props":12580,"children":12581},{"style":1376},[12582],{"type":121,"value":3977},{"type":115,"tag":756,"props":12584,"children":12585},{"class":758,"line":2259},[12586],{"type":115,"tag":756,"props":12587,"children":12588},{"style":1376},[12589],{"type":121,"value":3704},{"type":115,"tag":756,"props":12591,"children":12592},{"class":758,"line":2308},[12593,12597,12601],{"type":115,"tag":756,"props":12594,"children":12595},{"style":1376},[12596],{"type":121,"value":1446},{"type":115,"tag":756,"props":12598,"children":12599},{"style":1382},[12600],{"type":121,"value":1550},{"type":115,"tag":756,"props":12602,"children":12603},{"style":1376},[12604],{"type":121,"value":1414},{"type":115,"tag":218,"props":12606,"children":12608},{"id":12607},"devtools",[12609],{"type":121,"value":12610},"DevTools",{"type":115,"tag":745,"props":12612,"children":12614},{"className":747,"code":12613,"language":749,"meta":750,"style":750},"npx @ai-sdk\u002Fdevtools\n# Opens http:\u002F\u002Flocalhost:4983 — inspect LLM calls, agents, token usage, timing\n",[12615],{"type":115,"tag":157,"props":12616,"children":12617},{"__ignoreMap":750},[12618,12630],{"type":115,"tag":756,"props":12619,"children":12620},{"class":758,"line":759},[12621,12625],{"type":115,"tag":756,"props":12622,"children":12623},{"style":763},[12624],{"type":121,"value":1257},{"type":115,"tag":756,"props":12626,"children":12627},{"style":769},[12628],{"type":121,"value":12629}," @ai-sdk\u002Fdevtools\n",{"type":115,"tag":756,"props":12631,"children":12632},{"class":758,"line":785},[12633],{"type":115,"tag":756,"props":12634,"children":12635},{"style":802},[12636],{"type":121,"value":12637},"# Opens http:\u002F\u002Flocalhost:4983 — inspect LLM calls, agents, token usage, timing\n",{"type":115,"tag":218,"props":12639,"children":12641},{"id":12640},"key-patterns",[12642],{"type":121,"value":12643},"Key Patterns",{"type":115,"tag":12645,"props":12646,"children":12647},"ol",{},[12648,12692,12737,12774,12801,12845,12868,12891,12926,12936,12951,12965],{"type":115,"tag":229,"props":12649,"children":12650},{},[12651,12656,12658,12663,12665,12670,12672,12677,12679,12684,12686,12691],{"type":115,"tag":132,"props":12652,"children":12653},{},[12654],{"type":121,"value":12655},"Default to AI Gateway with OIDC",{"type":121,"value":12657}," — pass ",{"type":115,"tag":157,"props":12659,"children":12661},{"className":12660},[],[12662],{"type":121,"value":1345},{"type":121,"value":12664}," strings (e.g., ",{"type":115,"tag":157,"props":12666,"children":12668},{"className":12667},[],[12669],{"type":121,"value":1017},{"type":121,"value":12671},") to route through the gateway automatically. ",{"type":115,"tag":157,"props":12673,"children":12675},{"className":12674},[],[12676],{"type":121,"value":1288},{"type":121,"value":12678}," provisions OIDC tokens. No manual API keys needed. The ",{"type":115,"tag":157,"props":12680,"children":12682},{"className":12681},[],[12683],{"type":121,"value":1565},{"type":121,"value":12685}," wrapper is optional (only needed for ",{"type":115,"tag":157,"props":12687,"children":12689},{"className":12688},[],[12690],{"type":121,"value":1587},{"type":121,"value":266},{"type":115,"tag":229,"props":12693,"children":12694},{},[12695,12700,12701,12707,12709,12715,12716,12721,12722,12727,12729,12735],{"type":115,"tag":132,"props":12696,"children":12697},{},[12698],{"type":121,"value":12699},"Set up a Vercel project for AI",{"type":121,"value":450},{"type":115,"tag":157,"props":12702,"children":12704},{"className":12703},[],[12705],{"type":121,"value":12706},"vercel link",{"type":121,"value":12708}," → enable AI Gateway at ",{"type":115,"tag":157,"props":12710,"children":12712},{"className":12711},[],[12713],{"type":121,"value":12714},"https:\u002F\u002Fvercel.com\u002F{team}\u002F{project}\u002Fsettings",{"type":121,"value":6702},{"type":115,"tag":132,"props":12717,"children":12718},{},[12719],{"type":121,"value":12720},"AI Gateway",{"type":121,"value":6702},{"type":115,"tag":157,"props":12723,"children":12725},{"className":12724},[],[12726],{"type":121,"value":1288},{"type":121,"value":12728}," to get OIDC credentials. Never manually create ",{"type":115,"tag":157,"props":12730,"children":12732},{"className":12731},[],[12733],{"type":121,"value":12734},".env.local",{"type":121,"value":12736}," with provider-specific API keys.",{"type":115,"tag":229,"props":12738,"children":12739},{},[12740,12745,12746,12751,12753,12758,12760,12765,12767,12772],{"type":115,"tag":132,"props":12741,"children":12742},{},[12743],{"type":121,"value":12744},"Always use AI Elements for any AI text in a browser",{"type":121,"value":450},{"type":115,"tag":157,"props":12747,"children":12749},{"className":12748},[],[12750],{"type":121,"value":9771},{"type":121,"value":12752}," installs production-ready Message, Conversation, and Tool components. Use ",{"type":115,"tag":157,"props":12754,"children":12756},{"className":12755},[],[12757],{"type":121,"value":10355},{"type":121,"value":12759}," for chat and ",{"type":115,"tag":157,"props":12761,"children":12763},{"className":12762},[],[12764],{"type":121,"value":9172},{"type":121,"value":12766}," for any other AI-generated text (streaming panels, summaries, reports). AI models always produce markdown — there is no scenario where raw ",{"type":115,"tag":157,"props":12768,"children":12770},{"className":12769},[],[12771],{"type":121,"value":9190},{"type":121,"value":12773}," rendering is correct. ⤳ skill: ai-elements",{"type":115,"tag":229,"props":12775,"children":12776},{},[12777,12782,12784,12789,12790,12795,12796],{"type":115,"tag":132,"props":12778,"children":12779},{},[12780],{"type":121,"value":12781},"Always stream for user-facing AI",{"type":121,"value":12783}," — use ",{"type":115,"tag":157,"props":12785,"children":12787},{"className":12786},[],[12788],{"type":121,"value":615},{"type":121,"value":617},{"type":115,"tag":157,"props":12791,"children":12793},{"className":12792},[],[12794],{"type":121,"value":209},{"type":121,"value":577},{"type":115,"tag":157,"props":12797,"children":12799},{"className":12798},[],[12800],{"type":121,"value":1156},{"type":115,"tag":229,"props":12802,"children":12803},{},[12804,12809,12810,12815,12817,12822,12824,12830,12831,12836,12838,12843],{"type":115,"tag":132,"props":12805,"children":12806},{},[12807],{"type":121,"value":12808},"UIMessage chat UIs",{"type":121,"value":450},{"type":115,"tag":157,"props":12811,"children":12813},{"className":12812},[],[12814],{"type":121,"value":539},{"type":121,"value":12816}," defaults to ",{"type":115,"tag":157,"props":12818,"children":12820},{"className":12819},[],[12821],{"type":121,"value":547},{"type":121,"value":12823},". On the server: ",{"type":115,"tag":157,"props":12825,"children":12827},{"className":12826},[],[12828],{"type":121,"value":12829},"convertToModelMessages()",{"type":121,"value":617},{"type":115,"tag":157,"props":12832,"children":12834},{"className":12833},[],[12835],{"type":121,"value":623},{"type":121,"value":12837},". For no-API-route setups: ",{"type":115,"tag":157,"props":12839,"children":12841},{"className":12840},[],[12842],{"type":121,"value":555},{"type":121,"value":12844}," + Agent.",{"type":115,"tag":229,"props":12846,"children":12847},{},[12848,12853,12854,12859,12861,12866],{"type":115,"tag":132,"props":12849,"children":12850},{},[12851],{"type":121,"value":12852},"Text-only clients (non-browser)",{"type":121,"value":450},{"type":115,"tag":157,"props":12855,"children":12857},{"className":12856},[],[12858],{"type":121,"value":10271},{"type":121,"value":12860}," is only for CLI tools, server pipes, and programmatic consumers. If the text is displayed in a browser, use ",{"type":115,"tag":157,"props":12862,"children":12864},{"className":12863},[],[12865],{"type":121,"value":623},{"type":121,"value":12867}," + AI Elements",{"type":115,"tag":229,"props":12869,"children":12870},{},[12871,12876,12878,12883,12884,12889],{"type":115,"tag":132,"props":12872,"children":12873},{},[12874],{"type":121,"value":12875},"Use structured output",{"type":121,"value":12877}," for extracting data — ",{"type":115,"tag":157,"props":12879,"children":12881},{"className":12880},[],[12882],{"type":121,"value":1156},{"type":121,"value":1011},{"type":115,"tag":157,"props":12885,"children":12887},{"className":12886},[],[12888],{"type":121,"value":185},{"type":121,"value":12890}," and Zod schemas",{"type":115,"tag":229,"props":12892,"children":12893},{},[12894,12904,12906,12911,12912,12917,12919,12924],{"type":115,"tag":132,"props":12895,"children":12896},{},[12897,12899],{"type":121,"value":12898},"Use ",{"type":115,"tag":157,"props":12900,"children":12902},{"className":12901},[],[12903],{"type":121,"value":193},{"type":121,"value":12905}," for multi-step reasoning — not manual loops. Default ",{"type":115,"tag":157,"props":12907,"children":12909},{"className":12908},[],[12910],{"type":121,"value":567},{"type":121,"value":250},{"type":115,"tag":157,"props":12913,"children":12915},{"className":12914},[],[12916],{"type":121,"value":575},{"type":121,"value":12918},". Use ",{"type":115,"tag":157,"props":12920,"children":12922},{"className":12921},[],[12923],{"type":121,"value":10893},{"type":121,"value":12925}," for agent API routes.",{"type":115,"tag":229,"props":12927,"children":12928},{},[12929,12934],{"type":115,"tag":132,"props":12930,"children":12931},{},[12932],{"type":121,"value":12933},"Use DurableAgent",{"type":121,"value":12935}," (from Workflow DevKit) for production agents that must survive crashes",{"type":115,"tag":229,"props":12937,"children":12938},{},[12939,12949],{"type":115,"tag":132,"props":12940,"children":12941},{},[12942,12943],{"type":121,"value":12898},{"type":115,"tag":157,"props":12944,"children":12946},{"className":12945},[],[12947],{"type":121,"value":12948},"mcp-to-ai-sdk",{"type":121,"value":12950}," to generate static tool definitions from MCP servers for security",{"type":115,"tag":229,"props":12952,"children":12953},{},[12954,12963],{"type":115,"tag":132,"props":12955,"children":12956},{},[12957,12958],{"type":121,"value":12898},{"type":115,"tag":157,"props":12959,"children":12961},{"className":12960},[],[12962],{"type":121,"value":5047},{"type":121,"value":12964}," for human-in-the-loop — set on any tool to pause execution until user approves; supports conditional approval via async function",{"type":115,"tag":229,"props":12966,"children":12967},{},[12968,12977],{"type":115,"tag":132,"props":12969,"children":12970},{},[12971,12972],{"type":121,"value":12898},{"type":115,"tag":157,"props":12973,"children":12975},{"className":12974},[],[12976],{"type":121,"value":594},{"type":121,"value":12978}," per tool — opt-in strict mode ensures providers only generate schema-valid tool calls; set on individual tools, not globally",{"type":115,"tag":218,"props":12980,"children":12982},{"id":12981},"common-pitfall-structured-output-property-name",[12983],{"type":121,"value":12984},"Common Pitfall: Structured Output Property Name",{"type":115,"tag":128,"props":12986,"children":12987},{},[12988,12990,12995,12996,13001,13003,13011,13013,13018],{"type":121,"value":12989},"In v6, ",{"type":115,"tag":157,"props":12991,"children":12993},{"className":12992},[],[12994],{"type":121,"value":1156},{"type":121,"value":1011},{"type":115,"tag":157,"props":12997,"children":12999},{"className":12998},[],[13000],{"type":121,"value":185},{"type":121,"value":13002}," returns the parsed result on the ",{"type":115,"tag":132,"props":13004,"children":13005},{},[13006],{"type":115,"tag":157,"props":13007,"children":13009},{"className":13008},[],[13010],{"type":121,"value":102},{"type":121,"value":13012}," property (NOT ",{"type":115,"tag":157,"props":13014,"children":13016},{"className":13015},[],[13017],{"type":121,"value":2596},{"type":121,"value":13019},"):",{"type":115,"tag":745,"props":13021,"children":13023},{"className":1358,"code":13022,"language":1360,"meta":750,"style":750},"\u002F\u002F CORRECT — v6\nconst { output } = await generateText({\n  model: 'openai\u002Fgpt-5.4',\n  output: Output.object({ schema: mySchema }),\n  prompt: '...',\n})\nconsole.log(output) \u002F\u002F ✅ parsed object\n\n\u002F\u002F WRONG — v5 habit\nconst { object } = await generateText({ ... }) \u002F\u002F ❌ undefined — `object` doesn't exist in v6\n",[13024],{"type":115,"tag":157,"props":13025,"children":13026},{"__ignoreMap":750},[13027,13035,13074,13103,13160,13188,13200,13225,13232,13240],{"type":115,"tag":756,"props":13028,"children":13029},{"class":758,"line":759},[13030],{"type":115,"tag":756,"props":13031,"children":13032},{"style":802},[13033],{"type":121,"value":13034},"\u002F\u002F CORRECT — v6\n",{"type":115,"tag":756,"props":13036,"children":13037},{"class":758,"line":785},[13038,13042,13046,13050,13054,13058,13062,13066,13070],{"type":115,"tag":756,"props":13039,"children":13040},{"style":1429},[13041],{"type":121,"value":1432},{"type":115,"tag":756,"props":13043,"children":13044},{"style":1376},[13045],{"type":121,"value":1379},{"type":115,"tag":756,"props":13047,"children":13048},{"style":1382},[13049],{"type":121,"value":2520},{"type":115,"tag":756,"props":13051,"children":13052},{"style":1376},[13053],{"type":121,"value":1446},{"type":115,"tag":756,"props":13055,"children":13056},{"style":1376},[13057],{"type":121,"value":1451},{"type":115,"tag":756,"props":13059,"children":13060},{"style":1370},[13061],{"type":121,"value":1456},{"type":115,"tag":756,"props":13063,"children":13064},{"style":1459},[13065],{"type":121,"value":1385},{"type":115,"tag":756,"props":13067,"children":13068},{"style":1382},[13069],{"type":121,"value":1466},{"type":115,"tag":756,"props":13071,"children":13072},{"style":1376},[13073],{"type":121,"value":1471},{"type":115,"tag":756,"props":13075,"children":13076},{"class":758,"line":808},[13077,13081,13085,13090,13094,13099],{"type":115,"tag":756,"props":13078,"children":13079},{"style":1477},[13080],{"type":121,"value":1480},{"type":115,"tag":756,"props":13082,"children":13083},{"style":1376},[13084],{"type":121,"value":1485},{"type":115,"tag":756,"props":13086,"children":13087},{"style":1376},[13088],{"type":121,"value":13089}," '",{"type":115,"tag":756,"props":13091,"children":13092},{"style":769},[13093],{"type":121,"value":1494},{"type":115,"tag":756,"props":13095,"children":13096},{"style":1376},[13097],{"type":121,"value":13098},"'",{"type":115,"tag":756,"props":13100,"children":13101},{"style":1376},[13102],{"type":121,"value":1538},{"type":115,"tag":756,"props":13104,"children":13105},{"class":758,"line":830},[13106,13110,13114,13118,13122,13126,13130,13134,13139,13143,13148,13152,13156],{"type":115,"tag":756,"props":13107,"children":13108},{"style":1477},[13109],{"type":121,"value":2579},{"type":115,"tag":756,"props":13111,"children":13112},{"style":1376},[13113],{"type":121,"value":1485},{"type":115,"tag":756,"props":13115,"children":13116},{"style":1382},[13117],{"type":121,"value":2432},{"type":115,"tag":756,"props":13119,"children":13120},{"style":1376},[13121],{"type":121,"value":352},{"type":115,"tag":756,"props":13123,"children":13124},{"style":1459},[13125],{"type":121,"value":2596},{"type":115,"tag":756,"props":13127,"children":13128},{"style":1382},[13129],{"type":121,"value":1466},{"type":115,"tag":756,"props":13131,"children":13132},{"style":1376},[13133],{"type":121,"value":5310},{"type":115,"tag":756,"props":13135,"children":13136},{"style":1477},[13137],{"type":121,"value":13138}," schema",{"type":115,"tag":756,"props":13140,"children":13141},{"style":1376},[13142],{"type":121,"value":1485},{"type":115,"tag":756,"props":13144,"children":13145},{"style":1382},[13146],{"type":121,"value":13147}," mySchema ",{"type":115,"tag":756,"props":13149,"children":13150},{"style":1376},[13151],{"type":121,"value":1446},{"type":115,"tag":756,"props":13153,"children":13154},{"style":1382},[13155],{"type":121,"value":1550},{"type":115,"tag":756,"props":13157,"children":13158},{"style":1376},[13159],{"type":121,"value":1538},{"type":115,"tag":756,"props":13161,"children":13162},{"class":758,"line":1251},[13163,13167,13171,13175,13180,13184],{"type":115,"tag":756,"props":13164,"children":13165},{"style":1477},[13166],{"type":121,"value":1516},{"type":115,"tag":756,"props":13168,"children":13169},{"style":1376},[13170],{"type":121,"value":1485},{"type":115,"tag":756,"props":13172,"children":13173},{"style":1376},[13174],{"type":121,"value":13089},{"type":115,"tag":756,"props":13176,"children":13177},{"style":769},[13178],{"type":121,"value":13179},"...",{"type":115,"tag":756,"props":13181,"children":13182},{"style":1376},[13183],{"type":121,"value":13098},{"type":115,"tag":756,"props":13185,"children":13186},{"style":1376},[13187],{"type":121,"value":1538},{"type":115,"tag":756,"props":13189,"children":13190},{"class":758,"line":110},[13191,13195],{"type":115,"tag":756,"props":13192,"children":13193},{"style":1376},[13194],{"type":121,"value":1446},{"type":115,"tag":756,"props":13196,"children":13197},{"style":1382},[13198],{"type":121,"value":13199},")\n",{"type":115,"tag":756,"props":13201,"children":13202},{"class":758,"line":1817},[13203,13207,13211,13215,13220],{"type":115,"tag":756,"props":13204,"children":13205},{"style":1382},[13206],{"type":121,"value":8187},{"type":115,"tag":756,"props":13208,"children":13209},{"style":1376},[13210],{"type":121,"value":352},{"type":115,"tag":756,"props":13212,"children":13213},{"style":1459},[13214],{"type":121,"value":8196},{"type":115,"tag":756,"props":13216,"children":13217},{"style":1382},[13218],{"type":121,"value":13219},"(output) ",{"type":115,"tag":756,"props":13221,"children":13222},{"style":802},[13223],{"type":121,"value":13224},"\u002F\u002F ✅ parsed object\n",{"type":115,"tag":756,"props":13226,"children":13227},{"class":758,"line":42},[13228],{"type":115,"tag":756,"props":13229,"children":13230},{"emptyLinePlaceholder":1420},[13231],{"type":121,"value":1423},{"type":115,"tag":756,"props":13233,"children":13234},{"class":758,"line":2139},[13235],{"type":115,"tag":756,"props":13236,"children":13237},{"style":802},[13238],{"type":121,"value":13239},"\u002F\u002F WRONG — v5 habit\n",{"type":115,"tag":756,"props":13241,"children":13242},{"class":758,"line":2148},[13243,13247,13251,13256,13260,13264,13268,13272,13276,13280,13284,13288,13292],{"type":115,"tag":756,"props":13244,"children":13245},{"style":1429},[13246],{"type":121,"value":1432},{"type":115,"tag":756,"props":13248,"children":13249},{"style":1376},[13250],{"type":121,"value":1379},{"type":115,"tag":756,"props":13252,"children":13253},{"style":1382},[13254],{"type":121,"value":13255}," object ",{"type":115,"tag":756,"props":13257,"children":13258},{"style":1376},[13259],{"type":121,"value":1446},{"type":115,"tag":756,"props":13261,"children":13262},{"style":1376},[13263],{"type":121,"value":1451},{"type":115,"tag":756,"props":13265,"children":13266},{"style":1370},[13267],{"type":121,"value":1456},{"type":115,"tag":756,"props":13269,"children":13270},{"style":1459},[13271],{"type":121,"value":1385},{"type":115,"tag":756,"props":13273,"children":13274},{"style":1382},[13275],{"type":121,"value":1466},{"type":115,"tag":756,"props":13277,"children":13278},{"style":1376},[13279],{"type":121,"value":5310},{"type":115,"tag":756,"props":13281,"children":13282},{"style":1376},[13283],{"type":121,"value":11914},{"type":115,"tag":756,"props":13285,"children":13286},{"style":1376},[13287],{"type":121,"value":1390},{"type":115,"tag":756,"props":13289,"children":13290},{"style":1382},[13291],{"type":121,"value":6202},{"type":115,"tag":756,"props":13293,"children":13294},{"style":802},[13295],{"type":121,"value":13296},"\u002F\u002F ❌ undefined — `object` doesn't exist in v6\n",{"type":115,"tag":128,"props":13298,"children":13299},{},[13300,13302,13307,13309,13314],{"type":121,"value":13301},"This is one of the most common v5→v6 migration mistakes. The config key is ",{"type":115,"tag":157,"props":13303,"children":13305},{"className":13304},[],[13306],{"type":121,"value":102},{"type":121,"value":13308}," and the result key is also ",{"type":115,"tag":157,"props":13310,"children":13312},{"className":13311},[],[13313],{"type":121,"value":102},{"type":121,"value":352},{"type":115,"tag":218,"props":13316,"children":13318},{"id":13317},"migration-from-ai-sdk-5",[13319],{"type":121,"value":13320},"Migration from AI SDK 5",{"type":115,"tag":128,"props":13322,"children":13323},{},[13324,13326,13332,13334,13340,13342,13348],{"type":121,"value":13325},"Run ",{"type":115,"tag":157,"props":13327,"children":13329},{"className":13328},[],[13330],{"type":121,"value":13331},"npx @ai-sdk\u002Fcodemod upgrade",{"type":121,"value":13333}," (or ",{"type":115,"tag":157,"props":13335,"children":13337},{"className":13336},[],[13338],{"type":121,"value":13339},"npx @ai-sdk\u002Fcodemod v6",{"type":121,"value":13341},") to auto-migrate. Preview with ",{"type":115,"tag":157,"props":13343,"children":13345},{"className":13344},[],[13346],{"type":121,"value":13347},"npx @ai-sdk\u002Fcodemod --dry upgrade",{"type":121,"value":13349},". Key changes:",{"type":115,"tag":225,"props":13351,"children":13352},{},[13353,13386,13400,13414,13445,13470,13486,13510,13532,13546,13560,13578,13590,13609,13623,13645,13667,13684,13706,13716,13744,13749,13767,13783,13793,13808,13829,13840,13851,13869,13888,13918,13934,13959,13990,14020,14038,14055,14087,14092,14108],{"type":115,"tag":229,"props":13354,"children":13355},{},[13356,13361,13362,13368,13369,13374,13375,13380,13381],{"type":115,"tag":157,"props":13357,"children":13359},{"className":13358},[],[13360],{"type":121,"value":2376},{"type":121,"value":1128},{"type":115,"tag":157,"props":13363,"children":13365},{"className":13364},[],[13366],{"type":121,"value":13367},"streamObject",{"type":121,"value":6702},{"type":115,"tag":157,"props":13370,"children":13372},{"className":13371},[],[13373],{"type":121,"value":1156},{"type":121,"value":1128},{"type":115,"tag":157,"props":13376,"children":13378},{"className":13377},[],[13379],{"type":121,"value":615},{"type":121,"value":1011},{"type":115,"tag":157,"props":13382,"children":13384},{"className":13383},[],[13385],{"type":121,"value":185},{"type":115,"tag":229,"props":13387,"children":13388},{},[13389,13394,13395],{"type":115,"tag":157,"props":13390,"children":13392},{"className":13391},[],[13393],{"type":121,"value":3013},{"type":121,"value":6702},{"type":115,"tag":157,"props":13396,"children":13398},{"className":13397},[],[13399],{"type":121,"value":3006},{"type":115,"tag":229,"props":13401,"children":13402},{},[13403,13408,13409],{"type":115,"tag":157,"props":13404,"children":13406},{"className":13405},[],[13407],{"type":121,"value":3035},{"type":121,"value":6702},{"type":115,"tag":157,"props":13410,"children":13412},{"className":13411},[],[13413],{"type":121,"value":102},{"type":115,"tag":229,"props":13415,"children":13416},{},[13417,13423,13424,13430,13432,13438,13439,13444],{"type":115,"tag":157,"props":13418,"children":13420},{"className":13419},[],[13421],{"type":121,"value":13422},"maxSteps",{"type":121,"value":6702},{"type":115,"tag":157,"props":13425,"children":13427},{"className":13426},[],[13428],{"type":121,"value":13429},"stopWhen: stepCountIs(N)",{"type":121,"value":13431}," (import ",{"type":115,"tag":157,"props":13433,"children":13435},{"className":13434},[],[13436],{"type":121,"value":13437},"stepCountIs",{"type":121,"value":9156},{"type":115,"tag":157,"props":13440,"children":13442},{"className":13441},[],[13443],{"type":121,"value":76},{"type":121,"value":1550},{"type":115,"tag":229,"props":13446,"children":13447},{},[13448,13454,13455,13461,13463,13468],{"type":115,"tag":157,"props":13449,"children":13451},{"className":13450},[],[13452],{"type":121,"value":13453},"CoreMessage",{"type":121,"value":6702},{"type":115,"tag":157,"props":13456,"children":13458},{"className":13457},[],[13459],{"type":121,"value":13460},"ModelMessage",{"type":121,"value":13462}," (use ",{"type":115,"tag":157,"props":13464,"children":13466},{"className":13465},[],[13467],{"type":121,"value":12829},{"type":121,"value":13469}," — now async)",{"type":115,"tag":229,"props":13471,"children":13472},{},[13473,13479,13480],{"type":115,"tag":157,"props":13474,"children":13476},{"className":13475},[],[13477],{"type":121,"value":13478},"ToolCallOptions",{"type":121,"value":6702},{"type":115,"tag":157,"props":13481,"children":13483},{"className":13482},[],[13484],{"type":121,"value":13485},"ToolExecutionOptions",{"type":115,"tag":229,"props":13487,"children":13488},{},[13489,13495,13496,13501,13503,13508],{"type":115,"tag":157,"props":13490,"children":13492},{"className":13491},[],[13493],{"type":121,"value":13494},"Experimental_Agent",{"type":121,"value":6702},{"type":115,"tag":157,"props":13497,"children":13499},{"className":13498},[],[13500],{"type":121,"value":193},{"type":121,"value":13502}," (concrete class; ",{"type":115,"tag":157,"props":13504,"children":13506},{"className":13505},[],[13507],{"type":121,"value":201},{"type":121,"value":13509}," is just an interface)",{"type":115,"tag":229,"props":13511,"children":13512},{},[13513,13518,13519,13524,13526,13531],{"type":115,"tag":157,"props":13514,"children":13516},{"className":13515},[],[13517],{"type":121,"value":475},{"type":121,"value":6702},{"type":115,"tag":157,"props":13520,"children":13522},{"className":13521},[],[13523],{"type":121,"value":468},{"type":121,"value":13525}," (on ",{"type":115,"tag":157,"props":13527,"children":13529},{"className":13528},[],[13530],{"type":121,"value":193},{"type":121,"value":1550},{"type":115,"tag":229,"props":13533,"children":13534},{},[13535,13540,13541],{"type":115,"tag":157,"props":13536,"children":13538},{"className":13537},[],[13539],{"type":121,"value":502},{"type":121,"value":6702},{"type":115,"tag":157,"props":13542,"children":13544},{"className":13543},[],[13545],{"type":121,"value":487},{"type":115,"tag":229,"props":13547,"children":13548},{},[13549,13554,13555],{"type":115,"tag":157,"props":13550,"children":13552},{"className":13551},[],[13553],{"type":121,"value":509},{"type":121,"value":6702},{"type":115,"tag":157,"props":13556,"children":13558},{"className":13557},[],[13559],{"type":121,"value":495},{"type":115,"tag":229,"props":13561,"children":13562},{},[13563,13569,13570,13576],{"type":115,"tag":157,"props":13564,"children":13566},{"className":13565},[],[13567],{"type":121,"value":13568},"experimental_createMCPClient",{"type":121,"value":6702},{"type":115,"tag":157,"props":13571,"children":13573},{"className":13572},[],[13574],{"type":121,"value":13575},"createMCPClient",{"type":121,"value":13577}," (stable)",{"type":115,"tag":229,"props":13579,"children":13580},{},[13581,13583,13588],{"type":121,"value":13582},"New: ",{"type":115,"tag":157,"props":13584,"children":13586},{"className":13585},[],[13587],{"type":121,"value":607},{"type":121,"value":13589}," for agent API routes",{"type":115,"tag":229,"props":13591,"children":13592},{},[13593,13594,13600,13601,13607],{"type":121,"value":13582},{"type":115,"tag":157,"props":13595,"children":13597},{"className":13596},[],[13598],{"type":121,"value":13599},"callOptionsSchema",{"type":121,"value":617},{"type":115,"tag":157,"props":13602,"children":13604},{"className":13603},[],[13605],{"type":121,"value":13606},"prepareCall",{"type":121,"value":13608}," for per-call agent configuration",{"type":115,"tag":229,"props":13610,"children":13611},{},[13612,13617,13618],{"type":115,"tag":157,"props":13613,"children":13615},{"className":13614},[],[13616],{"type":121,"value":10119},{"type":121,"value":6702},{"type":115,"tag":157,"props":13619,"children":13621},{"className":13620},[],[13622],{"type":121,"value":10126},{"type":115,"tag":229,"props":13624,"children":13625},{},[13626,13631,13632,13637,13638,13643],{"type":115,"tag":157,"props":13627,"children":13629},{"className":13628},[],[13630],{"type":121,"value":209},{"type":121,"value":6694},{"type":115,"tag":157,"props":13633,"children":13635},{"className":13634},[],[13636],{"type":121,"value":334},{"type":121,"value":1128},{"type":115,"tag":157,"props":13639,"children":13641},{"className":13640},[],[13642],{"type":121,"value":342},{"type":121,"value":13644}," options removed → configure with transport",{"type":115,"tag":229,"props":13646,"children":13647},{},[13648,13653,13654,13659,13660,13665],{"type":115,"tag":157,"props":13649,"children":13651},{"className":13650},[],[13652],{"type":121,"value":10135},{"type":121,"value":1128},{"type":115,"tag":157,"props":13655,"children":13657},{"className":13656},[],[13658],{"type":121,"value":3912},{"type":121,"value":6702},{"type":115,"tag":157,"props":13661,"children":13663},{"className":13662},[],[13664],{"type":121,"value":10142},{"type":121,"value":13666}," \u002F manage own state",{"type":115,"tag":229,"props":13668,"children":13669},{},[13670,13676,13677,13682],{"type":115,"tag":157,"props":13671,"children":13673},{"className":13672},[],[13674],{"type":121,"value":13675},"toDataStreamResponse()",{"type":121,"value":6702},{"type":115,"tag":157,"props":13678,"children":13680},{"className":13679},[],[13681],{"type":121,"value":623},{"type":121,"value":13683}," (for chat UIs)",{"type":115,"tag":229,"props":13685,"children":13686},{},[13687,13692,13694,13699,13700,13705],{"type":115,"tag":157,"props":13688,"children":13690},{"className":13689},[],[13691],{"type":121,"value":301},{"type":121,"value":13693},": use ",{"type":115,"tag":157,"props":13695,"children":13697},{"className":13696},[],[13698],{"type":121,"value":309},{"type":121,"value":661},{"type":115,"tag":157,"props":13701,"children":13703},{"className":13702},[],[13704],{"type":121,"value":317},{"type":121,"value":1550},{"type":115,"tag":229,"props":13707,"children":13708},{},[13709,13711],{"type":121,"value":13710},"text-only clients \u002F text stream protocol → ",{"type":115,"tag":157,"props":13712,"children":13714},{"className":13713},[],[13715],{"type":121,"value":10271},{"type":115,"tag":229,"props":13717,"children":13718},{},[13719,13724,13725,13730,13732,13737,13738,13743],{"type":115,"tag":157,"props":13720,"children":13722},{"className":13721},[],[13723],{"type":121,"value":10220},{"type":121,"value":6702},{"type":115,"tag":157,"props":13726,"children":13728},{"className":13727},[],[13729],{"type":121,"value":10228},{"type":121,"value":13731}," (tool parts use ",{"type":115,"tag":157,"props":13733,"children":13735},{"className":13734},[],[13736],{"type":121,"value":363},{"type":121,"value":577},{"type":115,"tag":157,"props":13739,"children":13741},{"className":13740},[],[13742],{"type":121,"value":379},{"type":121,"value":1550},{"type":115,"tag":229,"props":13745,"children":13746},{},[13747],{"type":121,"value":13748},"UIMessage \u002F ModelMessage types introduced",{"type":115,"tag":229,"props":13750,"children":13751},{},[13752,13758,13760,13765],{"type":115,"tag":157,"props":13753,"children":13755},{"className":13754},[],[13756],{"type":121,"value":13757},"DynamicToolCall.args",{"type":121,"value":13759}," is not strongly typed; cast via ",{"type":115,"tag":157,"props":13761,"children":13763},{"className":13762},[],[13764],{"type":121,"value":405},{"type":121,"value":13766}," first",{"type":115,"tag":229,"props":13768,"children":13769},{},[13770,13776,13777],{"type":115,"tag":157,"props":13771,"children":13773},{"className":13772},[],[13774],{"type":121,"value":13775},"TypedToolResult.result",{"type":121,"value":6702},{"type":115,"tag":157,"props":13778,"children":13780},{"className":13779},[],[13781],{"type":121,"value":13782},"TypedToolResult.output",{"type":115,"tag":229,"props":13784,"children":13785},{},[13786,13791],{"type":115,"tag":157,"props":13787,"children":13789},{"className":13788},[],[13790],{"type":121,"value":237},{"type":121,"value":13792}," is the umbrella package",{"type":115,"tag":229,"props":13794,"children":13795},{},[13796,13801,13803],{"type":115,"tag":157,"props":13797,"children":13799},{"className":13798},[],[13800],{"type":121,"value":248},{"type":121,"value":13802}," must be installed separately at ",{"type":115,"tag":157,"props":13804,"children":13806},{"className":13805},[],[13807],{"type":121,"value":256},{"type":115,"tag":229,"props":13809,"children":13810},{},[13811,13816,13818,13823,13824],{"type":115,"tag":157,"props":13812,"children":13814},{"className":13813},[],[13815],{"type":121,"value":275},{"type":121,"value":13817}," (if installed directly) is ",{"type":115,"tag":157,"props":13819,"children":13821},{"className":13820},[],[13822],{"type":121,"value":282},{"type":121,"value":577},{"type":115,"tag":157,"props":13825,"children":13827},{"className":13826},[],[13828],{"type":121,"value":289},{"type":115,"tag":229,"props":13830,"children":13831},{},[13832,13833,13838],{"type":121,"value":13582},{"type":115,"tag":157,"props":13834,"children":13836},{"className":13835},[],[13837],{"type":121,"value":5047},{"type":121,"value":13839}," on tools (boolean or async function) for human-in-the-loop approval",{"type":115,"tag":229,"props":13841,"children":13842},{},[13843,13844,13849],{"type":121,"value":13582},{"type":115,"tag":157,"props":13845,"children":13847},{"className":13846},[],[13848],{"type":121,"value":594},{"type":121,"value":13850}," per-tool opt-in for strict schema validation",{"type":115,"tag":229,"props":13852,"children":13853},{},[13854,13855,13860,13862,13867],{"type":121,"value":13582},{"type":115,"tag":157,"props":13856,"children":13858},{"className":13857},[],[13859],{"type":121,"value":555},{"type":121,"value":13861}," — connect ",{"type":115,"tag":157,"props":13863,"children":13865},{"className":13864},[],[13866],{"type":121,"value":209},{"type":121,"value":13868}," to an Agent in-process, no API route needed",{"type":115,"tag":229,"props":13870,"children":13871},{},[13872,13873,13879,13881,13886],{"type":121,"value":13582},{"type":115,"tag":157,"props":13874,"children":13876},{"className":13875},[],[13877],{"type":121,"value":13878},"addToolApprovalResponse",{"type":121,"value":13880}," on ",{"type":115,"tag":157,"props":13882,"children":13884},{"className":13883},[],[13885],{"type":121,"value":209},{"type":121,"value":13887}," for client-side approval UI",{"type":115,"tag":229,"props":13889,"children":13890},{},[13891,13892,13897,13899,13904,13906,13911,13913],{"type":121,"value":561},{"type":115,"tag":157,"props":13893,"children":13895},{"className":13894},[],[13896],{"type":121,"value":567},{"type":121,"value":13898}," changed from ",{"type":115,"tag":157,"props":13900,"children":13902},{"className":13901},[],[13903],{"type":121,"value":583},{"type":121,"value":13905}," to ",{"type":115,"tag":157,"props":13907,"children":13909},{"className":13908},[],[13910],{"type":121,"value":575},{"type":121,"value":13912}," for ",{"type":115,"tag":157,"props":13914,"children":13916},{"className":13915},[],[13917],{"type":121,"value":193},{"type":115,"tag":229,"props":13919,"children":13920},{},[13921,13922,13927,13929],{"type":121,"value":13582},{"type":115,"tag":157,"props":13923,"children":13925},{"className":13924},[],[13926],{"type":121,"value":13478},{"type":121,"value":13928}," type renamed to ",{"type":115,"tag":157,"props":13930,"children":13932},{"className":13931},[],[13933],{"type":121,"value":13485},{"type":115,"tag":229,"props":13935,"children":13936},{},[13937,13938,13944,13946,13952,13954],{"type":121,"value":13582},{"type":115,"tag":157,"props":13939,"children":13941},{"className":13940},[],[13942],{"type":121,"value":13943},"Tool.toModelOutput",{"type":121,"value":13945}," now receives ",{"type":115,"tag":157,"props":13947,"children":13949},{"className":13948},[],[13950],{"type":121,"value":13951},"({ output })",{"type":121,"value":13953}," object, not bare ",{"type":115,"tag":157,"props":13955,"children":13957},{"className":13956},[],[13958],{"type":121,"value":102},{"type":115,"tag":229,"props":13960,"children":13961},{},[13962,13963,13969,13970,13976,13978,13984,13985],{"type":121,"value":13582},{"type":115,"tag":157,"props":13964,"children":13966},{"className":13965},[],[13967],{"type":121,"value":13968},"isToolUIPart",{"type":121,"value":6702},{"type":115,"tag":157,"props":13971,"children":13973},{"className":13972},[],[13974],{"type":121,"value":13975},"isStaticToolUIPart",{"type":121,"value":13977},"; ",{"type":115,"tag":157,"props":13979,"children":13981},{"className":13980},[],[13982],{"type":121,"value":13983},"isToolOrDynamicToolUIPart",{"type":121,"value":6702},{"type":115,"tag":157,"props":13986,"children":13988},{"className":13987},[],[13989],{"type":121,"value":13968},{"type":115,"tag":229,"props":13991,"children":13992},{},[13993,13994,14000,14001,14007,14008,14014,14015],{"type":121,"value":13582},{"type":115,"tag":157,"props":13995,"children":13997},{"className":13996},[],[13998],{"type":121,"value":13999},"getToolName",{"type":121,"value":6702},{"type":115,"tag":157,"props":14002,"children":14004},{"className":14003},[],[14005],{"type":121,"value":14006},"getStaticToolName",{"type":121,"value":13977},{"type":115,"tag":157,"props":14009,"children":14011},{"className":14010},[],[14012],{"type":121,"value":14013},"getToolOrDynamicToolName",{"type":121,"value":6702},{"type":115,"tag":157,"props":14016,"children":14018},{"className":14017},[],[14019],{"type":121,"value":13999},{"type":115,"tag":229,"props":14021,"children":14022},{},[14023,14024,14029,14031,14036],{"type":121,"value":13582},{"type":115,"tag":157,"props":14025,"children":14027},{"className":14026},[],[14028],{"type":121,"value":633},{"type":121,"value":14030}," defaults to Responses API; use ",{"type":115,"tag":157,"props":14032,"children":14034},{"className":14033},[],[14035],{"type":121,"value":641},{"type":121,"value":14037}," for Chat Completions",{"type":115,"tag":229,"props":14039,"children":14040},{},[14041,14042,14047,14048,14053],{"type":121,"value":13582},{"type":115,"tag":157,"props":14043,"children":14045},{"className":14044},[],[14046],{"type":121,"value":727},{"type":121,"value":6694},{"type":115,"tag":157,"props":14049,"children":14051},{"className":14050},[],[14052],{"type":121,"value":735},{"type":121,"value":14054}," for native structured outputs (Anthropic Sonnet 4.5+)",{"type":115,"tag":229,"props":14056,"children":14057},{},[14058,14059,14065,14067,14073,14074,14080,14081],{"type":121,"value":13582},{"type":115,"tag":157,"props":14060,"children":14062},{"className":14061},[],[14063],{"type":121,"value":14064},"@ai-sdk\u002Flangchain",{"type":121,"value":14066}," rewritten — ",{"type":115,"tag":157,"props":14068,"children":14070},{"className":14069},[],[14071],{"type":121,"value":14072},"toBaseMessages()",{"type":121,"value":1930},{"type":115,"tag":157,"props":14075,"children":14077},{"className":14076},[],[14078],{"type":121,"value":14079},"toUIMessageStream()",{"type":121,"value":1930},{"type":115,"tag":157,"props":14082,"children":14084},{"className":14083},[],[14085],{"type":121,"value":14086},"LangSmithDeploymentTransport",{"type":115,"tag":229,"props":14088,"children":14089},{},[14090],{"type":121,"value":14091},"New: Provider-specific tools — Anthropic (memory, code execution), OpenAI (shell, patch), Google (maps, RAG), xAI (search, code)",{"type":115,"tag":229,"props":14093,"children":14094},{},[14095,14100,14102],{"type":115,"tag":157,"props":14096,"children":14098},{"className":14097},[],[14099],{"type":121,"value":405},{"type":121,"value":14101}," finish reason removed → now returned as ",{"type":115,"tag":157,"props":14103,"children":14105},{"className":14104},[],[14106],{"type":121,"value":14107},"other",{"type":115,"tag":229,"props":14109,"children":14110},{},[14111,14113,14119,14121],{"type":121,"value":14112},"Warning types consolidated into single ",{"type":115,"tag":157,"props":14114,"children":14116},{"className":14115},[],[14117],{"type":121,"value":14118},"Warning",{"type":121,"value":14120}," type exported from ",{"type":115,"tag":157,"props":14122,"children":14124},{"className":14123},[],[14125],{"type":121,"value":76},{"type":115,"tag":218,"props":14127,"children":14129},{"id":14128},"official-documentation",[14130],{"type":121,"value":14131},"Official Documentation",{"type":115,"tag":225,"props":14133,"children":14134},{},[14135,14144,14154,14164,14174,14184,14194,14203,14213,14223],{"type":115,"tag":229,"props":14136,"children":14137},{},[14138],{"type":115,"tag":147,"props":14139,"children":14141},{"href":149,"rel":14140},[151],[14142],{"type":121,"value":14143},"AI SDK Documentation",{"type":115,"tag":229,"props":14145,"children":14146},{},[14147],{"type":115,"tag":147,"props":14148,"children":14151},{"href":14149,"rel":14150},"https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-core",[151],[14152],{"type":121,"value":14153},"AI SDK Core",{"type":115,"tag":229,"props":14155,"children":14156},{},[14157],{"type":115,"tag":147,"props":14158,"children":14161},{"href":14159,"rel":14160},"https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-ui",[151],[14162],{"type":121,"value":14163},"AI SDK UI",{"type":115,"tag":229,"props":14165,"children":14166},{},[14167],{"type":115,"tag":147,"props":14168,"children":14171},{"href":14169,"rel":14170},"https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-core\u002Fgenerating-text",[151],[14172],{"type":121,"value":14173},"Generating Text",{"type":115,"tag":229,"props":14175,"children":14176},{},[14177],{"type":115,"tag":147,"props":14178,"children":14181},{"href":14179,"rel":14180},"https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-core\u002Fgenerating-structured-data",[151],[14182],{"type":121,"value":14183},"Structured Data",{"type":115,"tag":229,"props":14185,"children":14186},{},[14187],{"type":115,"tag":147,"props":14188,"children":14191},{"href":14189,"rel":14190},"https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-core\u002Ftools-and-tool-calling",[151],[14192],{"type":121,"value":14193},"Tools and Tool Calling",{"type":115,"tag":229,"props":14195,"children":14196},{},[14197],{"type":115,"tag":147,"props":14198,"children":14201},{"href":14199,"rel":14200},"https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-core\u002Fagents",[151],[14202],{"type":121,"value":20},{"type":115,"tag":229,"props":14204,"children":14205},{},[14206],{"type":115,"tag":147,"props":14207,"children":14210},{"href":14208,"rel":14209},"https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Ffoundations\u002Fproviders-and-models",[151],[14211],{"type":121,"value":14212},"Providers and Models",{"type":115,"tag":229,"props":14214,"children":14215},{},[14216],{"type":115,"tag":147,"props":14217,"children":14220},{"href":14218,"rel":14219},"https:\u002F\u002Fai-sdk.dev\u002Fproviders",[151],[14221],{"type":121,"value":14222},"Provider Directory",{"type":115,"tag":229,"props":14224,"children":14225},{},[14226],{"type":115,"tag":147,"props":14227,"children":14230},{"href":14228,"rel":14229},"https:\u002F\u002Fgithub.com\u002Fvercel\u002Fai",[151],[14231],{"type":121,"value":14232},"GitHub: AI SDK",{"type":115,"tag":14234,"props":14235,"children":14236},"style",{},[14237],{"type":121,"value":14238},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":14240,"total":14352},[14241,14260,14274,14286,14304,14322,14340],{"slug":14242,"name":14242,"fn":14243,"description":14244,"org":14245,"tags":14246,"stars":28,"repoUrl":29,"updatedAt":14259},"accessibility-and-inclusive-visualization","make data visualizations accessible","Make data visualizations accessible and inclusive. Use when the user needs chart or diagram accessibility guidance, text alternatives for complex visuals, color and contrast review, keyboard support, reduced-motion behavior for animation or parallax, or an accessibility QA workflow for exported figures, UML-like diagrams, and dashboards.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14247,14250,14253,14256],{"name":14248,"slug":14249,"type":15},"Accessibility","accessibility",{"name":14251,"slug":14252,"type":15},"Charts","charts",{"name":14254,"slug":14255,"type":15},"Data Visualization","data-visualization",{"name":14257,"slug":14258,"type":15},"Design","design","2026-06-30T19:00:57.102",{"slug":14261,"name":14261,"fn":14262,"description":14263,"org":14264,"tags":14265,"stars":28,"repoUrl":29,"updatedAt":14273},"agent-browser","automate browser interactions for agents","Browser automation CLI for AI agents. Use when the user needs to interact with websites, verify dev server output, test web apps, navigate pages, fill forms, click buttons, take screenshots, extract data, or automate any browser task. Also triggers when a dev server starts so you can verify it visually.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14266,14267,14270],{"name":20,"slug":21,"type":15},{"name":14268,"slug":14269,"type":15},"Browser Automation","browser-automation",{"name":14271,"slug":14272,"type":15},"Testing","testing","2026-04-06T18:41:03.44016",{"slug":14275,"name":14275,"fn":14276,"description":14277,"org":14278,"tags":14279,"stars":28,"repoUrl":29,"updatedAt":14285},"agent-browser-verify","verify dev server output with automated browser","Automated browser verification for dev servers. Triggers when a dev server starts to run a visual gut-check with agent-browser — verifies the page loads, checks for console errors, validates key UI elements, and reports pass\u002Ffail before continuing.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14280,14281,14284],{"name":14268,"slug":14269,"type":15},{"name":14282,"slug":14283,"type":15},"Local Development","local-development",{"name":14271,"slug":14272,"type":15},"2026-04-06T18:41:17.526867",{"slug":14287,"name":14287,"fn":14288,"description":14289,"org":14290,"tags":14291,"stars":28,"repoUrl":29,"updatedAt":14303},"agents-sdk","build AI agents on Cloudflare Workers","Build AI agents on Cloudflare Workers using the Agents SDK. Load when creating stateful agents, durable workflows, real-time WebSocket apps, scheduled tasks, MCP servers, or chat applications. Covers Agent class, state management, callable RPC, Workflows integration, and React hooks. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14292,14293,14296,14297,14300],{"name":20,"slug":21,"type":15},{"name":14294,"slug":14295,"type":15},"Cloudflare Workers","cloudflare-workers",{"name":23,"slug":24,"type":15},{"name":14298,"slug":14299,"type":15},"Serverless","serverless",{"name":14301,"slug":14302,"type":15},"WebSockets","websockets","2026-04-06T18:39:51.717063",{"slug":14305,"name":14305,"fn":14306,"description":14307,"org":14308,"tags":14309,"stars":28,"repoUrl":29,"updatedAt":14321},"ai-elements","build chat UIs with AI Elements","AI Elements component library guidance — pre-built React components for AI interfaces built on shadcn\u002Fui. Use when building chat UIs, message displays, tool call rendering, streaming responses, reasoning panels, or any AI-native interface with the AI SDK.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14310,14311,14314,14317,14320],{"name":26,"slug":27,"type":15},{"name":14312,"slug":14313,"type":15},"React","react",{"name":14315,"slug":14316,"type":15},"shadcn\u002Fui","shadcn-ui",{"name":14318,"slug":14319,"type":15},"UI Components","ui-components",{"name":13,"slug":14,"type":15},"2026-04-06T18:40:59.619419",{"slug":14323,"name":14323,"fn":14324,"description":14325,"org":14326,"tags":14327,"stars":28,"repoUrl":29,"updatedAt":14339},"ai-gateway","configure Vercel AI Gateway","Vercel AI Gateway expert guidance. Use when configuring model routing, provider failover, cost tracking, or managing multiple AI providers through a unified API.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14328,14331,14334,14335,14338],{"name":14329,"slug":14330,"type":15},"AI Infrastructure","ai-infrastructure",{"name":14332,"slug":14333,"type":15},"Cost Optimization","cost-optimization",{"name":17,"slug":18,"type":15},{"name":14336,"slug":14337,"type":15},"Performance","performance",{"name":13,"slug":14,"type":15},"2026-04-06T18:40:44.377464",{"slug":14341,"name":14341,"fn":14342,"description":14343,"org":14344,"tags":14345,"stars":28,"repoUrl":29,"updatedAt":14351},"ai-generation-persistence","implement persistence patterns for AI generations","AI generation persistence patterns — unique IDs, addressable URLs, database storage, and cost tracking for every LLM generation",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14346,14347,14350],{"name":14332,"slug":14333,"type":15},{"name":14348,"slug":14349,"type":15},"Database","database",{"name":17,"slug":18,"type":15},"2026-04-06T18:41:08.513425",600,{"items":14354,"total":14551},[14355,14376,14399,14416,14432,14449,14468,14480,14494,14508,14520,14535],{"slug":14356,"name":14356,"fn":14357,"description":14358,"org":14359,"tags":14360,"stars":14373,"repoUrl":14374,"updatedAt":14375},"prior-auth-packet-builder","build healthcare prior authorization packets","Build a concise prior authorization packet from local case files and payer policy docs.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14361,14364,14367,14370],{"name":14362,"slug":14363,"type":15},"Documents","documents",{"name":14365,"slug":14366,"type":15},"Healthcare","healthcare",{"name":14368,"slug":14369,"type":15},"Insurance","insurance",{"name":14371,"slug":14372,"type":15},"Regulatory Compliance","regulatory-compliance",28169,"https:\u002F\u002Fgithub.com\u002Fopenai\u002Fopenai-agents-python","2026-04-16T05:11:39.180399",{"slug":14377,"name":14377,"fn":14378,"description":14379,"org":14380,"tags":14381,"stars":14396,"repoUrl":14397,"updatedAt":14398},"aspnet-core","build ASP.NET Core web applications","Build, review, refactor, or architect ASP.NET Core web applications using current official guidance for .NET web development. Use when working on Blazor Web Apps, Razor Pages, MVC, Minimal APIs, controller-based Web APIs, SignalR, gRPC, middleware, dependency injection, configuration, authentication, authorization, testing, performance, deployment, or ASP.NET Core upgrades.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14382,14385,14387,14390,14393],{"name":14383,"slug":14384,"type":15},".NET","dotnet",{"name":14386,"slug":14377,"type":15},"ASP.NET Core",{"name":14388,"slug":14389,"type":15},"Blazor","blazor",{"name":14391,"slug":14392,"type":15},"C#","csharp",{"name":14394,"slug":14395,"type":15},"Web Development","web-development",23787,"https:\u002F\u002Fgithub.com\u002Fopenai\u002Fskills","2026-04-12T05:07:02.819491",{"slug":14400,"name":14400,"fn":14401,"description":14402,"org":14403,"tags":14404,"stars":14396,"repoUrl":14397,"updatedAt":14415},"chatgpt-apps","build ChatGPT Apps SDK applications","Build, scaffold, refactor, and troubleshoot ChatGPT Apps SDK applications that combine an MCP server and widget UI. Use when Codex needs to design tools, register UI resources, wire the MCP Apps bridge or ChatGPT compatibility APIs, apply Apps SDK metadata or CSP or domain settings, or produce a docs-aligned project scaffold. Prefer a docs-first workflow by invoking the openai-docs skill or OpenAI developer docs MCP tools before generating code.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14405,14408,14411,14414],{"name":14406,"slug":14407,"type":15},"Apps SDK","apps-sdk",{"name":14409,"slug":14410,"type":15},"ChatGPT","chatgpt",{"name":14412,"slug":14413,"type":15},"MCP","mcp",{"name":9,"slug":8,"type":15},"2026-04-12T05:07:05.468097",{"slug":14417,"name":14417,"fn":14418,"description":14419,"org":14420,"tags":14421,"stars":14396,"repoUrl":14397,"updatedAt":14431},"cli-creator","build CLIs from API docs","Build a composable CLI for Codex from API docs, an OpenAPI spec, existing curl examples, an SDK, a web app, an admin tool, or a local script. Use when the user wants Codex to create a command-line tool that can run from any repo, expose composable read\u002Fwrite commands, return stable JSON, manage auth, and pair with a companion skill.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14422,14425,14428],{"name":14423,"slug":14424,"type":15},"API Development","api-development",{"name":14426,"slug":14427,"type":15},"CLI","cli",{"name":14429,"slug":14430,"type":15},"Codex","codex","2026-04-12T05:07:04.132762",{"slug":14433,"name":14433,"fn":14434,"description":14435,"org":14436,"tags":14437,"stars":14396,"repoUrl":14397,"updatedAt":14448},"cloudflare-deploy","deploy projects to Cloudflare","Deploy applications and infrastructure to Cloudflare using Workers, Pages, and related platform services. Use when the user asks to deploy, host, publish, or set up a project on Cloudflare.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14438,14441,14444,14445],{"name":14439,"slug":14440,"type":15},"Cloudflare","cloudflare",{"name":14442,"slug":14443,"type":15},"Cloudflare Pages","cloudflare-pages",{"name":14294,"slug":14295,"type":15},{"name":14446,"slug":14447,"type":15},"Deployment","deployment","2026-04-12T05:07:14.275118",{"slug":14450,"name":14450,"fn":14451,"description":14452,"org":14453,"tags":14454,"stars":14396,"repoUrl":14397,"updatedAt":14467},"define-goal","define and set measurable project goals","Help the user define a concrete, measurable goal before starting work, especially when they ask to use the goal tool, create a goal, set an objective, clarify success criteria, or turn a fuzzy intention into a quantitative outcome. Use this skill for goal creation and goal refinement only; it does not manage durable snapshots, decision logs, or long-running execution artifacts.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14455,14458,14461,14464],{"name":14456,"slug":14457,"type":15},"Productivity","productivity",{"name":14459,"slug":14460,"type":15},"Project Management","project-management",{"name":14462,"slug":14463,"type":15},"Strategy","strategy",{"name":14465,"slug":14466,"type":15},"Task Management","task-management","2026-05-23T06:17:16.870838",{"slug":14469,"name":14469,"fn":14470,"description":14471,"org":14472,"tags":14473,"stars":14396,"repoUrl":14397,"updatedAt":14479},"figma","translate Figma designs into code","Use the Figma MCP server to fetch design context, screenshots, variables, and assets from Figma, and to translate Figma nodes into production code. Trigger when a task involves Figma URLs, node IDs, design-to-code implementation, or Figma MCP setup and troubleshooting.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14474,14475,14477,14478],{"name":14257,"slug":14258,"type":15},{"name":14476,"slug":14469,"type":15},"Figma",{"name":26,"slug":27,"type":15},{"name":14412,"slug":14413,"type":15},"2026-04-12T05:06:47.939943",{"slug":14481,"name":14481,"fn":14482,"description":14483,"org":14484,"tags":14485,"stars":14396,"repoUrl":14397,"updatedAt":14493},"figma-code-connect-components","connect Figma designs to code components","Connects Figma design components to code components using Code Connect mapping tools. Use when user says \"code connect\", \"connect this component to code\", \"map this component\", \"link component to code\", \"create code connect mapping\", or wants to establish mappings between Figma designs and code implementations. For canvas writes via `use_figma`, use `figma-use`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14486,14487,14490,14491,14492],{"name":14257,"slug":14258,"type":15},{"name":14488,"slug":14489,"type":15},"Design System","design-system",{"name":14476,"slug":14469,"type":15},{"name":26,"slug":27,"type":15},{"name":14318,"slug":14319,"type":15},"2026-05-10T05:59:52.971881",{"slug":14495,"name":14495,"fn":14496,"description":14497,"org":14498,"tags":14499,"stars":14396,"repoUrl":14397,"updatedAt":14507},"figma-create-design-system-rules","generate design system rules from Figma","Generates custom design system rules for the user's codebase. Use when user says \"create design system rules\", \"generate rules for my project\", \"set up design rules\", \"customize design system guidelines\", or wants to establish project-specific conventions for Figma-to-code workflows. Requires Figma MCP server connection.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14500,14501,14502,14505,14506],{"name":14257,"slug":14258,"type":15},{"name":14488,"slug":14489,"type":15},{"name":14503,"slug":14504,"type":15},"Documentation","documentation",{"name":14476,"slug":14469,"type":15},{"name":26,"slug":27,"type":15},"2026-05-16T06:07:47.821474",{"slug":14509,"name":14509,"fn":14510,"description":14511,"org":14512,"tags":14513,"stars":14396,"repoUrl":14397,"updatedAt":14519},"figma-implement-design","translate Figma designs into application code","Translates Figma designs into production-ready application code with 1:1 visual fidelity. Use when implementing UI code from Figma files, when user mentions \"implement design\", \"generate code\", \"implement component\", provides Figma URLs, or asks to build components matching Figma specs. For Figma canvas writes via `use_figma`, use `figma-use`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14514,14515,14516,14517,14518],{"name":14257,"slug":14258,"type":15},{"name":14476,"slug":14469,"type":15},{"name":26,"slug":27,"type":15},{"name":14318,"slug":14319,"type":15},{"name":14394,"slug":14395,"type":15},"2026-05-16T06:07:40.583615",{"slug":14521,"name":14521,"fn":14522,"description":14523,"org":14524,"tags":14525,"stars":14396,"repoUrl":14397,"updatedAt":14534},"hatch-pet","create animated pets for Codex","Create, repair, validate, visually QA, and package Codex-compatible animated pets and pet spritesheets from character art, generated images, company or prospect brand cues, or visual references. Use when a user wants a lightweight-worker Codex pet workflow, a non-pixel custom pet style, a prospect or company mascot pet, or a full 8x9 animated pet atlas with transparent unused cells, QA contact sheets, and pet.json packaging. This skill composes the installed $imagegen system skill for visual generation and uses bundled scripts for deterministic spritesheet assembly.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14526,14529,14530,14533],{"name":14527,"slug":14528,"type":15},"Animation","animation",{"name":14429,"slug":14430,"type":15},{"name":14531,"slug":14532,"type":15},"Creative","creative",{"name":14257,"slug":14258,"type":15},"2026-05-02T05:31:48.48485",{"slug":14536,"name":14536,"fn":14537,"description":14538,"org":14539,"tags":14540,"stars":14396,"repoUrl":14397,"updatedAt":14550},"imagegen","generate and edit raster images","Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output should be a bitmap asset rather than repo-native code or vector. Do not use when the task is better handled by editing existing SVG\u002Fvector\u002Fcode-native assets, extending an established icon or logo system, or building the visual directly in HTML\u002FCSS\u002Fcanvas.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[14541,14542,14543,14546,14549],{"name":14531,"slug":14532,"type":15},{"name":14257,"slug":14258,"type":15},{"name":14544,"slug":14545,"type":15},"Image Generation","image-generation",{"name":14547,"slug":14548,"type":15},"Images","images",{"name":9,"slug":8,"type":15},"2026-05-15T06:23:24.312127",675]