@assistant-ui/mcp-docs-server 0.1.24 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/code-examples/waterfall.md +4 -2
- package/.docs/organized/code-examples/with-a2a.md +676 -0
- package/.docs/organized/code-examples/with-ag-ui.md +5 -6
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +27 -15
- package/.docs/organized/code-examples/with-artifacts.md +4 -4
- package/.docs/organized/code-examples/with-assistant-transport.md +2 -2
- package/.docs/organized/code-examples/with-chain-of-thought.md +33 -25
- package/.docs/organized/code-examples/with-cloud-standalone.md +9 -6
- package/.docs/organized/code-examples/with-cloud.md +4 -4
- package/.docs/organized/code-examples/with-custom-thread-list.md +6 -6
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +7 -7
- package/.docs/organized/code-examples/with-expo.md +565 -514
- package/.docs/organized/code-examples/with-external-store.md +2 -2
- package/.docs/organized/code-examples/with-ffmpeg.md +4 -4
- package/.docs/organized/code-examples/with-google-adk.md +353 -0
- package/.docs/organized/code-examples/with-heat-graph.md +304 -0
- package/.docs/organized/code-examples/with-langgraph.md +24 -22
- package/.docs/organized/code-examples/with-parent-id-grouping.md +3 -3
- package/.docs/organized/code-examples/with-react-hook-form.md +4 -4
- package/.docs/organized/code-examples/with-react-ink.md +265 -0
- package/.docs/organized/code-examples/with-react-router.md +5 -5
- package/.docs/organized/code-examples/with-store.md +28 -17
- package/.docs/organized/code-examples/with-tanstack.md +7 -7
- package/.docs/organized/code-examples/with-tap-runtime.md +5 -3
- package/.docs/raw/blog/2025-01-31-changelog/index.mdx +1 -1
- package/.docs/raw/blog/2026-03-launch-week/index.mdx +227 -0
- package/.docs/raw/docs/(docs)/architecture.mdx +1 -1
- package/.docs/raw/docs/(docs)/cli.mdx +14 -9
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +8 -3
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +5 -1
- package/.docs/raw/docs/(docs)/copilots/{make-assistant-readable.mdx → make-assistant-visible.mdx} +14 -5
- package/.docs/raw/docs/(docs)/copilots/model-context.mdx +11 -11
- package/.docs/raw/docs/(docs)/copilots/motivation.mdx +2 -2
- package/.docs/raw/docs/(docs)/devtools.mdx +3 -2
- package/.docs/raw/docs/(docs)/guides/attachments.mdx +9 -11
- package/.docs/raw/docs/(docs)/guides/branching.mdx +11 -6
- package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +18 -16
- package/.docs/raw/docs/(docs)/guides/context-api.mdx +81 -43
- package/.docs/raw/docs/(docs)/guides/dictation.mdx +5 -5
- package/.docs/raw/docs/(docs)/guides/editing.mdx +16 -7
- package/.docs/raw/docs/(docs)/guides/latex.mdx +3 -0
- package/.docs/raw/docs/(docs)/guides/message-timing.mdx +2 -1
- package/.docs/raw/docs/(docs)/guides/multi-agent.mdx +173 -0
- package/.docs/raw/docs/(docs)/guides/quoting.mdx +55 -206
- package/.docs/raw/docs/(docs)/guides/speech.mdx +1 -4
- package/.docs/raw/docs/(docs)/guides/suggestions.mdx +9 -15
- package/.docs/raw/docs/(docs)/guides/tool-ui.mdx +17 -7
- package/.docs/raw/docs/(docs)/guides/tools.mdx +24 -9
- package/.docs/raw/docs/(docs)/index.mdx +3 -3
- package/.docs/raw/docs/(docs)/installation.mdx +69 -46
- package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +20 -6
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +24 -4
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +20 -19
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +28 -53
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +4 -4
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +7 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +20 -14
- package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +99 -45
- package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +52 -40
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +343 -23
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +4 -6
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +4 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +3 -5
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +169 -22
- package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +14 -4
- package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +15 -26
- package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +39 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +33 -9
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +48 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +36 -7
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +30 -10
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +12 -10
- package/.docs/raw/docs/(reference)/migrations/deprecation-policy.mdx +1 -1
- package/.docs/raw/docs/(reference)/migrations/react-langgraph-v0-7.mdx +9 -4
- package/.docs/raw/docs/(reference)/migrations/v0-11.mdx +7 -5
- package/.docs/raw/docs/(reference)/migrations/v0-12.mdx +9 -7
- package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +159 -0
- package/.docs/raw/docs/(reference)/react-compatibility.mdx +5 -134
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +84 -6
- package/.docs/raw/docs/cloud/ai-sdk.mdx +14 -4
- package/.docs/raw/docs/cloud/langgraph.mdx +13 -3
- package/.docs/raw/docs/ink/adapters.mdx +41 -0
- package/.docs/raw/docs/ink/custom-backend.mdx +203 -0
- package/.docs/raw/docs/ink/hooks.mdx +448 -0
- package/.docs/raw/docs/ink/index.mdx +239 -0
- package/.docs/raw/docs/ink/migration.mdx +140 -0
- package/.docs/raw/docs/ink/primitives.mdx +699 -0
- package/.docs/raw/docs/react-native/adapters.mdx +63 -87
- package/.docs/raw/docs/react-native/custom-backend.mdx +11 -14
- package/.docs/raw/docs/react-native/hooks.mdx +214 -232
- package/.docs/raw/docs/react-native/index.mdx +118 -159
- package/.docs/raw/docs/react-native/migration.mdx +144 -0
- package/.docs/raw/docs/react-native/primitives.mdx +431 -302
- package/.docs/raw/docs/runtimes/a2a/index.mdx +294 -0
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +9 -9
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +14 -3
- package/.docs/raw/docs/runtimes/assistant-transport.mdx +59 -25
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +13 -6
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +138 -38
- package/.docs/raw/docs/runtimes/custom/local.mdx +184 -42
- package/.docs/raw/docs/runtimes/data-stream.mdx +92 -19
- package/.docs/raw/docs/runtimes/google-adk/index.mdx +624 -0
- package/.docs/raw/docs/runtimes/helicone.mdx +6 -6
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +38 -27
- package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +1 -1
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +15 -20
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +7 -11
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +8 -11
- package/.docs/raw/docs/runtimes/langserve.mdx +6 -7
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +18 -3
- package/.docs/raw/docs/ui/file.mdx +5 -4
- package/.docs/raw/docs/ui/image.mdx +5 -4
- package/.docs/raw/docs/ui/markdown.mdx +3 -1
- package/.docs/raw/docs/ui/model-selector.mdx +8 -8
- package/.docs/raw/docs/ui/part-grouping.mdx +7 -10
- package/.docs/raw/docs/ui/quote.mdx +210 -0
- package/.docs/raw/docs/ui/reasoning.mdx +12 -11
- package/.docs/raw/docs/ui/sources.mdx +88 -17
- package/.docs/raw/docs/ui/streamdown.mdx +16 -7
- package/.docs/raw/docs/ui/thread-list.mdx +11 -13
- package/.docs/raw/docs/ui/thread.mdx +28 -33
- package/.docs/raw/docs/ui/tool-fallback.mdx +5 -6
- package/.docs/raw/docs/ui/tool-group.mdx +9 -8
- package/.docs/raw/docs/utilities/heat-graph.mdx +236 -0
- package/.docs/raw/docs/utilities/tw-shimmer.mdx +211 -0
- package/package.json +4 -4
- package/.docs/raw/docs/(reference)/legacy/styled/assistant-modal.mdx +0 -77
- package/.docs/raw/docs/(reference)/legacy/styled/decomposition.mdx +0 -635
- package/.docs/raw/docs/(reference)/legacy/styled/markdown.mdx +0 -77
- package/.docs/raw/docs/(reference)/legacy/styled/scrollbar.mdx +0 -72
- package/.docs/raw/docs/(reference)/legacy/styled/thread-width.mdx +0 -22
- package/.docs/raw/docs/(reference)/legacy/styled/thread.mdx +0 -77
- /package/.docs/raw/docs/cloud/{overview.mdx → index.mdx} +0 -0
|
@@ -107,10 +107,10 @@ Install provider SDK:
|
|
|
107
107
|
<InstallCommand npm={["ai", "@assistant-ui/react-ai-sdk", "@ai-sdk/google-vertex"]} />
|
|
108
108
|
</Tab>
|
|
109
109
|
<Tab>
|
|
110
|
-
<InstallCommand npm={["ai", "@assistant-ui/react-ai-sdk", "@ai-sdk/
|
|
110
|
+
<InstallCommand npm={["ai", "@assistant-ui/react-ai-sdk", "@ai-sdk/groq"]} />
|
|
111
111
|
</Tab>
|
|
112
112
|
<Tab>
|
|
113
|
-
<InstallCommand npm={["ai", "@assistant-ui/react-ai-sdk", "@ai-sdk/
|
|
113
|
+
<InstallCommand npm={["ai", "@assistant-ui/react-ai-sdk", "@ai-sdk/fireworks"]} />
|
|
114
114
|
</Tab>
|
|
115
115
|
<Tab>
|
|
116
116
|
<InstallCommand npm={["ai", "@assistant-ui/react-ai-sdk", "@ai-sdk/cohere"]} />
|
|
@@ -128,15 +128,18 @@ Add an API endpoint:
|
|
|
128
128
|
<Tabs groupId="provider" items={["OpenAI", "Anthropic", "Azure", "AWS", "Gemini", "GCP", "Groq", "Fireworks", "Cohere", "Ollama", "Chrome AI"]}>
|
|
129
129
|
```ts title="/app/api/chat/route.ts" tab="OpenAI"
|
|
130
130
|
import { openai } from "@ai-sdk/openai";
|
|
131
|
+
import { frontendTools } from "@assistant-ui/react-ai-sdk";
|
|
131
132
|
import { convertToModelMessages, streamText } from "ai";
|
|
132
133
|
|
|
133
134
|
export const maxDuration = 30;
|
|
134
135
|
|
|
135
136
|
export async function POST(req: Request) {
|
|
136
|
-
const { messages } = await req.json();
|
|
137
|
+
const { messages, system, tools } = await req.json();
|
|
137
138
|
const result = streamText({
|
|
138
139
|
model: openai("gpt-4o-mini"),
|
|
139
|
-
|
|
140
|
+
system,
|
|
141
|
+
messages: await convertToModelMessages(messages),
|
|
142
|
+
tools: frontendTools(tools),
|
|
140
143
|
});
|
|
141
144
|
return result.toUIMessageStreamResponse();
|
|
142
145
|
}
|
|
@@ -144,15 +147,18 @@ export async function POST(req: Request) {
|
|
|
144
147
|
|
|
145
148
|
```ts title="/app/api/chat/route.ts" tab="Anthropic"
|
|
146
149
|
import { anthropic } from "@ai-sdk/anthropic";
|
|
150
|
+
import { frontendTools } from "@assistant-ui/react-ai-sdk";
|
|
147
151
|
import { convertToModelMessages, streamText } from "ai";
|
|
148
152
|
|
|
149
153
|
export const maxDuration = 30;
|
|
150
154
|
|
|
151
155
|
export async function POST(req: Request) {
|
|
152
|
-
const { messages } = await req.json();
|
|
156
|
+
const { messages, system, tools } = await req.json();
|
|
153
157
|
const result = streamText({
|
|
154
|
-
model: anthropic("claude-
|
|
155
|
-
|
|
158
|
+
model: anthropic("claude-sonnet-4-6"),
|
|
159
|
+
system,
|
|
160
|
+
messages: await convertToModelMessages(messages),
|
|
161
|
+
tools: frontendTools(tools),
|
|
156
162
|
});
|
|
157
163
|
return result.toUIMessageStreamResponse();
|
|
158
164
|
}
|
|
@@ -160,15 +166,18 @@ export async function POST(req: Request) {
|
|
|
160
166
|
|
|
161
167
|
```ts title="/app/api/chat/route.ts" tab="Azure"
|
|
162
168
|
import { azure } from "@ai-sdk/azure";
|
|
169
|
+
import { frontendTools } from "@assistant-ui/react-ai-sdk";
|
|
163
170
|
import { convertToModelMessages, streamText } from "ai";
|
|
164
171
|
|
|
165
172
|
export const maxDuration = 30;
|
|
166
173
|
|
|
167
174
|
export async function POST(req: Request) {
|
|
168
|
-
const { messages } = await req.json();
|
|
175
|
+
const { messages, system, tools } = await req.json();
|
|
169
176
|
const result = streamText({
|
|
170
177
|
model: azure("your-deployment-name"),
|
|
171
|
-
|
|
178
|
+
system,
|
|
179
|
+
messages: await convertToModelMessages(messages),
|
|
180
|
+
tools: frontendTools(tools),
|
|
172
181
|
});
|
|
173
182
|
return result.toUIMessageStreamResponse();
|
|
174
183
|
}
|
|
@@ -176,15 +185,18 @@ export async function POST(req: Request) {
|
|
|
176
185
|
|
|
177
186
|
```ts title="/app/api/chat/route.ts" tab="AWS"
|
|
178
187
|
import { bedrock } from "@ai-sdk/amazon-bedrock";
|
|
188
|
+
import { frontendTools } from "@assistant-ui/react-ai-sdk";
|
|
179
189
|
import { convertToModelMessages, streamText } from "ai";
|
|
180
190
|
|
|
181
191
|
export const maxDuration = 30;
|
|
182
192
|
|
|
183
193
|
export async function POST(req: Request) {
|
|
184
|
-
const { messages } = await req.json();
|
|
194
|
+
const { messages, system, tools } = await req.json();
|
|
185
195
|
const result = streamText({
|
|
186
|
-
model: bedrock("anthropic.claude-
|
|
187
|
-
|
|
196
|
+
model: bedrock("anthropic.claude-sonnet-4-6-v1:0"),
|
|
197
|
+
system,
|
|
198
|
+
messages: await convertToModelMessages(messages),
|
|
199
|
+
tools: frontendTools(tools),
|
|
188
200
|
});
|
|
189
201
|
return result.toUIMessageStreamResponse();
|
|
190
202
|
}
|
|
@@ -192,15 +204,18 @@ export async function POST(req: Request) {
|
|
|
192
204
|
|
|
193
205
|
```ts title="/app/api/chat/route.ts" tab="Gemini"
|
|
194
206
|
import { google } from "@ai-sdk/google";
|
|
207
|
+
import { frontendTools } from "@assistant-ui/react-ai-sdk";
|
|
195
208
|
import { convertToModelMessages, streamText } from "ai";
|
|
196
209
|
|
|
197
210
|
export const maxDuration = 30;
|
|
198
211
|
|
|
199
212
|
export async function POST(req: Request) {
|
|
200
|
-
const { messages } = await req.json();
|
|
213
|
+
const { messages, system, tools } = await req.json();
|
|
201
214
|
const result = streamText({
|
|
202
215
|
model: google("gemini-2.0-flash"),
|
|
203
|
-
|
|
216
|
+
system,
|
|
217
|
+
messages: await convertToModelMessages(messages),
|
|
218
|
+
tools: frontendTools(tools),
|
|
204
219
|
});
|
|
205
220
|
return result.toUIMessageStreamResponse();
|
|
206
221
|
}
|
|
@@ -208,57 +223,56 @@ export async function POST(req: Request) {
|
|
|
208
223
|
|
|
209
224
|
```ts title="/app/api/chat/route.ts" tab="GCP"
|
|
210
225
|
import { vertex } from "@ai-sdk/google-vertex";
|
|
226
|
+
import { frontendTools } from "@assistant-ui/react-ai-sdk";
|
|
211
227
|
import { convertToModelMessages, streamText } from "ai";
|
|
212
228
|
|
|
213
229
|
export const maxDuration = 30;
|
|
214
230
|
|
|
215
231
|
export async function POST(req: Request) {
|
|
216
|
-
const { messages } = await req.json();
|
|
232
|
+
const { messages, system, tools } = await req.json();
|
|
217
233
|
const result = streamText({
|
|
218
|
-
model: vertex("gemini-
|
|
219
|
-
|
|
234
|
+
model: vertex("gemini-2.0-flash"),
|
|
235
|
+
system,
|
|
236
|
+
messages: await convertToModelMessages(messages),
|
|
237
|
+
tools: frontendTools(tools),
|
|
220
238
|
});
|
|
221
239
|
return result.toUIMessageStreamResponse();
|
|
222
240
|
}
|
|
223
241
|
```
|
|
224
242
|
|
|
225
243
|
```ts title="/app/api/chat/route.ts" tab="Groq"
|
|
226
|
-
import {
|
|
244
|
+
import { groq } from "@ai-sdk/groq";
|
|
245
|
+
import { frontendTools } from "@assistant-ui/react-ai-sdk";
|
|
227
246
|
import { convertToModelMessages, streamText } from "ai";
|
|
228
247
|
|
|
229
248
|
export const maxDuration = 30;
|
|
230
249
|
|
|
231
|
-
const groq = createOpenAI({
|
|
232
|
-
apiKey: process.env.GROQ_API_KEY ?? "",
|
|
233
|
-
baseURL: "https://api.groq.com/openai/v1",
|
|
234
|
-
});
|
|
235
|
-
|
|
236
250
|
export async function POST(req: Request) {
|
|
237
|
-
const { messages } = await req.json();
|
|
251
|
+
const { messages, system, tools } = await req.json();
|
|
238
252
|
const result = streamText({
|
|
239
|
-
model: groq("
|
|
240
|
-
|
|
253
|
+
model: groq("llama-3.3-70b-versatile"),
|
|
254
|
+
system,
|
|
255
|
+
messages: await convertToModelMessages(messages),
|
|
256
|
+
tools: frontendTools(tools),
|
|
241
257
|
});
|
|
242
258
|
return result.toUIMessageStreamResponse();
|
|
243
259
|
}
|
|
244
260
|
```
|
|
245
261
|
|
|
246
262
|
```ts title="/app/api/chat/route.ts" tab="Fireworks"
|
|
247
|
-
import {
|
|
263
|
+
import { fireworks } from "@ai-sdk/fireworks";
|
|
264
|
+
import { frontendTools } from "@assistant-ui/react-ai-sdk";
|
|
248
265
|
import { convertToModelMessages, streamText } from "ai";
|
|
249
266
|
|
|
250
267
|
export const maxDuration = 30;
|
|
251
268
|
|
|
252
|
-
const fireworks = createOpenAI({
|
|
253
|
-
apiKey: process.env.FIREWORKS_API_KEY ?? "",
|
|
254
|
-
baseURL: "https://api.fireworks.ai/inference/v1",
|
|
255
|
-
});
|
|
256
|
-
|
|
257
269
|
export async function POST(req: Request) {
|
|
258
|
-
const { messages } = await req.json();
|
|
270
|
+
const { messages, system, tools } = await req.json();
|
|
259
271
|
const result = streamText({
|
|
260
|
-
model: fireworks("accounts/fireworks/models/
|
|
261
|
-
|
|
272
|
+
model: fireworks("accounts/fireworks/models/llama-v3p3-70b-instruct"),
|
|
273
|
+
system,
|
|
274
|
+
messages: await convertToModelMessages(messages),
|
|
275
|
+
tools: frontendTools(tools),
|
|
262
276
|
});
|
|
263
277
|
return result.toUIMessageStreamResponse();
|
|
264
278
|
}
|
|
@@ -266,15 +280,18 @@ export async function POST(req: Request) {
|
|
|
266
280
|
|
|
267
281
|
```ts title="/app/api/chat/route.ts" tab="Cohere"
|
|
268
282
|
import { cohere } from "@ai-sdk/cohere";
|
|
283
|
+
import { frontendTools } from "@assistant-ui/react-ai-sdk";
|
|
269
284
|
import { convertToModelMessages, streamText } from "ai";
|
|
270
285
|
|
|
271
286
|
export const maxDuration = 30;
|
|
272
287
|
|
|
273
288
|
export async function POST(req: Request) {
|
|
274
|
-
const { messages } = await req.json();
|
|
289
|
+
const { messages, system, tools } = await req.json();
|
|
275
290
|
const result = streamText({
|
|
276
291
|
model: cohere("command-r-plus"),
|
|
277
|
-
|
|
292
|
+
system,
|
|
293
|
+
messages: await convertToModelMessages(messages),
|
|
294
|
+
tools: frontendTools(tools),
|
|
278
295
|
});
|
|
279
296
|
return result.toUIMessageStreamResponse();
|
|
280
297
|
}
|
|
@@ -282,15 +299,18 @@ export async function POST(req: Request) {
|
|
|
282
299
|
|
|
283
300
|
```ts title="/app/api/chat/route.ts" tab="Ollama"
|
|
284
301
|
import { ollama } from "ollama-ai-provider-v2";
|
|
302
|
+
import { frontendTools } from "@assistant-ui/react-ai-sdk";
|
|
285
303
|
import { convertToModelMessages, streamText } from "ai";
|
|
286
304
|
|
|
287
305
|
export const maxDuration = 30;
|
|
288
306
|
|
|
289
307
|
export async function POST(req: Request) {
|
|
290
|
-
const { messages } = await req.json();
|
|
308
|
+
const { messages, system, tools } = await req.json();
|
|
291
309
|
const result = streamText({
|
|
292
310
|
model: ollama("llama3"),
|
|
293
|
-
|
|
311
|
+
system,
|
|
312
|
+
messages: await convertToModelMessages(messages),
|
|
313
|
+
tools: frontendTools(tools),
|
|
294
314
|
});
|
|
295
315
|
return result.toUIMessageStreamResponse();
|
|
296
316
|
}
|
|
@@ -298,15 +318,18 @@ export async function POST(req: Request) {
|
|
|
298
318
|
|
|
299
319
|
```ts title="/app/api/chat/route.ts" tab="Chrome AI"
|
|
300
320
|
import { chromeai } from "chrome-ai";
|
|
321
|
+
import { frontendTools } from "@assistant-ui/react-ai-sdk";
|
|
301
322
|
import { convertToModelMessages, streamText } from "ai";
|
|
302
323
|
|
|
303
324
|
export const maxDuration = 30;
|
|
304
325
|
|
|
305
326
|
export async function POST(req: Request) {
|
|
306
|
-
const { messages } = await req.json();
|
|
327
|
+
const { messages, system, tools } = await req.json();
|
|
307
328
|
const result = streamText({
|
|
308
329
|
model: chromeai(),
|
|
309
|
-
|
|
330
|
+
system,
|
|
331
|
+
messages: await convertToModelMessages(messages),
|
|
332
|
+
tools: frontendTools(tools),
|
|
310
333
|
});
|
|
311
334
|
return result.toUIMessageStreamResponse();
|
|
312
335
|
}
|
|
@@ -385,7 +408,7 @@ import { useChatRuntime, AssistantChatTransport } from "@assistant-ui/react-ai-s
|
|
|
385
408
|
import { ThreadList } from "@/components/assistant-ui/thread-list";
|
|
386
409
|
import { Thread } from "@/components/assistant-ui/thread";
|
|
387
410
|
|
|
388
|
-
|
|
411
|
+
export default function MyApp() {
|
|
389
412
|
const runtime = useChatRuntime({
|
|
390
413
|
transport: new AssistantChatTransport({
|
|
391
414
|
api: "/api/chat",
|
|
@@ -400,7 +423,7 @@ const MyApp = () => {
|
|
|
400
423
|
</div>
|
|
401
424
|
</AssistantRuntimeProvider>
|
|
402
425
|
);
|
|
403
|
-
}
|
|
426
|
+
}
|
|
404
427
|
```
|
|
405
428
|
|
|
406
429
|
```tsx title="/app/page.tsx" tab="AssistantModal"
|
|
@@ -410,7 +433,7 @@ import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
|
|
410
433
|
import { useChatRuntime, AssistantChatTransport } from "@assistant-ui/react-ai-sdk";
|
|
411
434
|
import { AssistantModal } from "@/components/assistant-ui/assistant-modal";
|
|
412
435
|
|
|
413
|
-
|
|
436
|
+
export default function MyApp() {
|
|
414
437
|
const runtime = useChatRuntime({
|
|
415
438
|
transport: new AssistantChatTransport({
|
|
416
439
|
api: "/api/chat",
|
|
@@ -422,7 +445,7 @@ const MyApp = () => {
|
|
|
422
445
|
<AssistantModal />
|
|
423
446
|
</AssistantRuntimeProvider>
|
|
424
447
|
);
|
|
425
|
-
}
|
|
448
|
+
}
|
|
426
449
|
```
|
|
427
450
|
|
|
428
451
|
</Tabs>
|
|
@@ -446,7 +469,7 @@ const MyApp = () => {
|
|
|
446
469
|
<Card
|
|
447
470
|
title="Add Persistence"
|
|
448
471
|
description="Save and restore chat conversations"
|
|
449
|
-
href="/docs/cloud
|
|
472
|
+
href="/docs/cloud"
|
|
450
473
|
/>
|
|
451
474
|
<Card
|
|
452
475
|
title="Examples"
|
package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx
CHANGED
|
@@ -3,24 +3,38 @@ title: <TextMessagePartProvider />
|
|
|
3
3
|
description: Context provider for reusing text components outside of message content.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { AssistantRuntimeProvider } from "@/generated/typeDocs";
|
|
7
|
-
|
|
8
6
|
The `TextMessagePartProvider` provides data and APIs for `TextMessagePart` components.
|
|
9
7
|
|
|
10
8
|
This is useful if you want to reuse the same `Text` component outside of a message text, e.g. with the `@assistant-ui/react-markdown` package.
|
|
11
9
|
|
|
12
|
-
```tsx
|
|
13
|
-
import {
|
|
10
|
+
```tsx
|
|
11
|
+
import { TextMessagePartProvider } from "@assistant-ui/react";
|
|
14
12
|
|
|
15
13
|
const MyApp = () => {
|
|
16
14
|
return (
|
|
17
15
|
<TextMessagePartProvider text={"Hello!"}>
|
|
18
16
|
<MyMarkdownText />
|
|
19
|
-
</
|
|
17
|
+
</TextMessagePartProvider>
|
|
20
18
|
);
|
|
21
19
|
};
|
|
22
20
|
```
|
|
23
21
|
|
|
24
22
|
#### Properties
|
|
25
23
|
|
|
26
|
-
<ParametersTable
|
|
24
|
+
<ParametersTable
|
|
25
|
+
type="TextMessagePartProviderProps"
|
|
26
|
+
parameters={[
|
|
27
|
+
{
|
|
28
|
+
name: "text",
|
|
29
|
+
type: "string",
|
|
30
|
+
required: true,
|
|
31
|
+
description: "The text content to provide to child components.",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "isRunning",
|
|
35
|
+
type: "boolean",
|
|
36
|
+
required: false,
|
|
37
|
+
description: "Whether the text is still being streamed. Defaults to false.",
|
|
38
|
+
},
|
|
39
|
+
]}
|
|
40
|
+
/>
|
|
@@ -35,6 +35,16 @@ const MyRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
|
|
|
35
35
|
type: "string",
|
|
36
36
|
description: "The API endpoint URL for the data stream protocol.",
|
|
37
37
|
},
|
|
38
|
+
{
|
|
39
|
+
name: "protocol",
|
|
40
|
+
type: '"ui-message-stream" | "data-stream"',
|
|
41
|
+
description: 'The streaming protocol to use. Defaults to "ui-message-stream". Use "data-stream" for legacy AI SDK compatibility.',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "onData",
|
|
45
|
+
type: "(data: { type: string; name: string; data: unknown; transient?: boolean }) => void",
|
|
46
|
+
description: "Optional callback for data-* parts. Only applies when using the ui-message-stream protocol.",
|
|
47
|
+
},
|
|
38
48
|
{
|
|
39
49
|
name: "onResponse",
|
|
40
50
|
type: "(response: Response) => void | Promise<void>",
|
|
@@ -67,8 +77,8 @@ const MyRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
|
|
|
67
77
|
},
|
|
68
78
|
{
|
|
69
79
|
name: "body",
|
|
70
|
-
type: "object",
|
|
71
|
-
description: "Optional additional body parameters to include in the request.",
|
|
80
|
+
type: "object | (() => Promise<object | undefined>)",
|
|
81
|
+
description: "Optional additional body parameters to include in the request. Can be an object or an async function that returns one.",
|
|
72
82
|
},
|
|
73
83
|
{
|
|
74
84
|
name: "sendExtraMessageFields",
|
|
@@ -111,6 +121,16 @@ const MyRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
|
|
|
111
121
|
type: "string",
|
|
112
122
|
description: "The ID of the assistant to connect to.",
|
|
113
123
|
},
|
|
124
|
+
{
|
|
125
|
+
name: "protocol",
|
|
126
|
+
type: '"ui-message-stream" | "data-stream"',
|
|
127
|
+
description: 'The streaming protocol to use. Defaults to "ui-message-stream". Use "data-stream" for legacy AI SDK compatibility.',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "onData",
|
|
131
|
+
type: "(data: { type: string; name: string; data: unknown; transient?: boolean }) => void",
|
|
132
|
+
description: "Optional callback for data-* parts. Only applies when using the ui-message-stream protocol.",
|
|
133
|
+
},
|
|
114
134
|
{
|
|
115
135
|
name: "onResponse",
|
|
116
136
|
type: "(response: Response) => void | Promise<void>",
|
|
@@ -143,8 +163,8 @@ const MyRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
|
|
|
143
163
|
},
|
|
144
164
|
{
|
|
145
165
|
name: "body",
|
|
146
|
-
type: "object",
|
|
147
|
-
description: "Optional additional body parameters to include in the request.",
|
|
166
|
+
type: "object | (() => Promise<object | undefined>)",
|
|
167
|
+
description: "Optional additional body parameters to include in the request. Can be an object or an async function that returns one.",
|
|
148
168
|
},
|
|
149
169
|
{
|
|
150
170
|
name: "sendExtraMessageFields",
|
|
@@ -89,7 +89,7 @@ Drop-in replacement hook for `useForm` that adds support for `@assistant-ui/reac
|
|
|
89
89
|
|
|
90
90
|
### `formTools`
|
|
91
91
|
|
|
92
|
-
The set of tools to use with `useAssistantForm
|
|
92
|
+
The set of tools to use with `useAssistantForm` on the server side. While the AI SDK now supports forwarding frontend tools via `frontendTools()`, using `formTools` directly on the server gives you more control over tool execution.
|
|
93
93
|
|
|
94
94
|
```tsx {1, 5-7}
|
|
95
95
|
import { formTools } from "@assistant-ui/react-hook-form";
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "@assistant-ui/react-ai-sdk"
|
|
3
|
-
description: Vercel AI SDK
|
|
3
|
+
description: Vercel AI SDK integration with chat runtime hooks and transport utilities.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Vercel AI SDK integration for assistant-ui.
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
<Callout type="info">
|
|
10
|
-
This package provides integration with AI SDK
|
|
11
|
-
SDK v4 (Legacy)](/docs/runtimes/ai-sdk/v4-legacy) documentation.
|
|
10
|
+
This package provides integration with AI SDK v6. For older versions, see the [AI
|
|
11
|
+
SDK v5 (Legacy)](/docs/runtimes/ai-sdk/v5-legacy) or [AI SDK v4 (Legacy)](/docs/runtimes/ai-sdk/v4-legacy) documentation.
|
|
12
12
|
</Callout>
|
|
13
13
|
|
|
14
14
|
## API Reference
|
|
15
15
|
|
|
16
16
|
### `useChatRuntime`
|
|
17
17
|
|
|
18
|
-
Creates a runtime
|
|
18
|
+
Creates a runtime with AI SDK's `useChat` hook integration. This is the recommended approach for most use cases.
|
|
19
19
|
|
|
20
20
|
```tsx
|
|
21
21
|
import { useChatRuntime, AssistantChatTransport } from "@assistant-ui/react-ai-sdk";
|
|
@@ -56,16 +56,11 @@ const runtime = useChatRuntime({
|
|
|
56
56
|
{
|
|
57
57
|
type: "UseChatRuntimeOptions",
|
|
58
58
|
parameters: [
|
|
59
|
-
{
|
|
60
|
-
name: "api",
|
|
61
|
-
type: "string",
|
|
62
|
-
description: "The API endpoint URL. Defaults to '/api/chat'.",
|
|
63
|
-
},
|
|
64
59
|
{
|
|
65
60
|
name: "transport",
|
|
66
61
|
type: "ChatTransport",
|
|
67
62
|
description:
|
|
68
|
-
"Custom transport implementation. Defaults to AssistantChatTransport which forwards system messages and tools.",
|
|
63
|
+
"Custom transport implementation. Defaults to AssistantChatTransport (which sends requests to '/api/chat' and forwards system messages and tools). Use `new AssistantChatTransport({ api: '/custom-endpoint' })` to customize the endpoint.",
|
|
69
64
|
},
|
|
70
65
|
{
|
|
71
66
|
name: "cloud",
|
|
@@ -73,6 +68,18 @@ const runtime = useChatRuntime({
|
|
|
73
68
|
description:
|
|
74
69
|
"Optional AssistantCloud instance for chat persistence.",
|
|
75
70
|
},
|
|
71
|
+
{
|
|
72
|
+
name: "adapters",
|
|
73
|
+
type: "RuntimeAdapters",
|
|
74
|
+
description:
|
|
75
|
+
"Optional runtime adapters to extend or override built-in functionality (attachments, speech, dictation, feedback, history).",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "toCreateMessage",
|
|
79
|
+
type: "(message: AppendMessage) => CreateUIMessage",
|
|
80
|
+
description:
|
|
81
|
+
"Optional custom function to convert an AppendMessage into an AI SDK CreateUIMessage before sending.",
|
|
82
|
+
},
|
|
76
83
|
{
|
|
77
84
|
name: "initialMessages",
|
|
78
85
|
type: "UIMessage[]",
|
|
@@ -134,18 +141,12 @@ const MyRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
|
|
|
134
141
|
},
|
|
135
142
|
{
|
|
136
143
|
name: "options",
|
|
137
|
-
type: "
|
|
144
|
+
type: "AISDKRuntimeAdapter",
|
|
138
145
|
description: "Optional configuration options.",
|
|
139
146
|
children: [
|
|
140
147
|
{
|
|
141
|
-
type: "
|
|
148
|
+
type: "AISDKRuntimeAdapter",
|
|
142
149
|
parameters: [
|
|
143
|
-
{
|
|
144
|
-
name: "cloud",
|
|
145
|
-
type: "AssistantCloud",
|
|
146
|
-
description:
|
|
147
|
-
"Optional AssistantCloud instance for chat persistence.",
|
|
148
|
-
},
|
|
149
150
|
{
|
|
150
151
|
name: "adapters",
|
|
151
152
|
type: "RuntimeAdapters",
|
|
@@ -221,7 +222,7 @@ export async function POST(req: Request) {
|
|
|
221
222
|
const result = streamText({
|
|
222
223
|
model: openai("gpt-4o"),
|
|
223
224
|
system,
|
|
224
|
-
messages: convertToModelMessages(messages),
|
|
225
|
+
messages: await convertToModelMessages(messages),
|
|
225
226
|
tools: {
|
|
226
227
|
// Wrap frontend tools with the helper
|
|
227
228
|
...frontendTools(tools),
|