@assistant-ui/mcp-docs-server 0.1.3 → 0.1.5

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.
Files changed (48) hide show
  1. package/.docs/organized/code-examples/local-ollama.md +13 -13
  2. package/.docs/organized/code-examples/search-agent-for-e-commerce.md +18 -18
  3. package/.docs/organized/code-examples/{with-vercel-ai-rsc.md → with-ai-sdk-v5.md} +225 -230
  4. package/.docs/organized/code-examples/with-ai-sdk.md +13 -13
  5. package/.docs/organized/code-examples/with-cloud.md +12 -12
  6. package/.docs/organized/code-examples/with-external-store.md +9 -9
  7. package/.docs/organized/code-examples/with-ffmpeg.md +19 -19
  8. package/.docs/organized/code-examples/with-langgraph.md +14 -14
  9. package/.docs/organized/code-examples/with-openai-assistants.md +12 -12
  10. package/.docs/organized/code-examples/with-parent-id-grouping.md +1374 -0
  11. package/.docs/organized/code-examples/with-react-hook-form.md +18 -18
  12. package/.docs/raw/docs/about-assistantui.mdx +9 -0
  13. package/.docs/raw/docs/api-reference/context-providers/{TextContentPartProvider.mdx → TextMessagePartProvider.mdx} +3 -3
  14. package/.docs/raw/docs/api-reference/integrations/react-hook-form.mdx +2 -2
  15. package/.docs/raw/docs/api-reference/overview.mdx +23 -23
  16. package/.docs/raw/docs/api-reference/primitives/Error.mdx +5 -3
  17. package/.docs/raw/docs/api-reference/primitives/Message.mdx +32 -0
  18. package/.docs/raw/docs/api-reference/primitives/{ContentPart.mdx → MessagePart.mdx} +41 -41
  19. package/.docs/raw/docs/api-reference/runtimes/MessagePartRuntime.mdx +22 -0
  20. package/.docs/raw/docs/api-reference/runtimes/ThreadListRuntime.mdx +1 -0
  21. package/.docs/raw/docs/api-reference/runtimes/ThreadRuntime.mdx +1 -0
  22. package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +89 -32
  23. package/.docs/raw/docs/cloud/persistence/langgraph.mdx +187 -32
  24. package/.docs/raw/docs/concepts/runtime-layer.mdx +7 -7
  25. package/.docs/raw/docs/copilots/make-assistant-tool-ui.mdx +22 -13
  26. package/.docs/raw/docs/copilots/make-assistant-tool.mdx +20 -14
  27. package/.docs/raw/docs/getting-started.mdx +11 -10
  28. package/.docs/raw/docs/guides/Attachments.mdx +24 -21
  29. package/.docs/raw/docs/guides/Latex.mdx +81 -0
  30. package/.docs/raw/docs/guides/ToolUI.mdx +13 -8
  31. package/.docs/raw/docs/migrations/v0-11.mdx +169 -0
  32. package/.docs/raw/docs/migrations/v0-7.mdx +8 -8
  33. package/.docs/raw/docs/migrations/v0-8.mdx +14 -14
  34. package/.docs/raw/docs/migrations/v0-9.mdx +3 -3
  35. package/.docs/raw/docs/runtimes/ai-sdk/rsc.mdx +2 -2
  36. package/.docs/raw/docs/runtimes/ai-sdk/use-assistant-hook.mdx +1 -1
  37. package/.docs/raw/docs/runtimes/ai-sdk/use-chat-hook.mdx +2 -2
  38. package/.docs/raw/docs/runtimes/ai-sdk/use-chat-v5.mdx +129 -0
  39. package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +3 -3
  40. package/.docs/raw/docs/runtimes/custom/external-store.mdx +5 -5
  41. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +2 -2
  42. package/.docs/raw/docs/ui/Attachment.mdx +5 -2
  43. package/.docs/raw/docs/ui/Markdown.mdx +2 -3
  44. package/.docs/raw/docs/ui/PartGrouping.mdx +540 -0
  45. package/.docs/raw/docs/ui/ToolFallback.mdx +2 -2
  46. package/.docs/raw/docs/ui/ToolGroup.mdx +96 -0
  47. package/package.json +8 -8
  48. package/.docs/raw/docs/api-reference/runtimes/ContentPartRuntime.mdx +0 -22
@@ -0,0 +1,129 @@
1
+ ---
2
+ title: AI SDK v5 (@alpha)
3
+ ---
4
+
5
+ import { Callout } from "fumadocs-ui/components/callout";
6
+
7
+ <Callout type="warn">
8
+ This integration is currently in **alpha**. APIs may change before the stable release.
9
+ </Callout>
10
+
11
+ ## Overview
12
+
13
+ Integration with the Vercel AI SDK v5's `useChat` hook using the `@assistant-ui/react-ai-sdk` package with the `@alpha` tag.
14
+ This version supports the latest AI SDK v5 features including the new streamText API and improved TypeScript support.
15
+
16
+ ## Getting Started
17
+
18
+ import { Steps, Step } from "fumadocs-ui/components/steps";
19
+
20
+ <Steps>
21
+ <Step>
22
+ ### Create a Next.JS project
23
+
24
+ ```sh
25
+ npx create-next-app@latest my-app
26
+ cd my-app
27
+ ```
28
+
29
+ </Step>
30
+ <Step>
31
+
32
+ ### Install AI SDK v5 and `@assistant-ui/react` with alpha tag
33
+
34
+ ```sh npm2yarn
35
+ npm install @assistant-ui/react @assistant-ui/react-ai-sdk@alpha ai @ai-sdk/openai
36
+ ```
37
+
38
+ </Step>
39
+ <Step>
40
+
41
+ ### Setup a backend route under `/api/chat`
42
+
43
+ `@/app/api/chat/route.ts`
44
+
45
+ ```tsx
46
+ import { openai } from "@ai-sdk/openai";
47
+ import {
48
+ streamText,
49
+ UIMessage,
50
+ convertToModelMessages,
51
+ tool,
52
+ } from "ai";
53
+ import { z } from "zod";
54
+
55
+ // Allow streaming responses up to 30 seconds
56
+ export const maxDuration = 30;
57
+
58
+ export async function POST(req: Request) {
59
+ const { messages }: { messages: UIMessage[] } = await req.json();
60
+
61
+ const result = streamText({
62
+ model: openai("gpt-4o"),
63
+ messages: convertToModelMessages(messages),
64
+ tools: {
65
+ get_current_weather: tool({
66
+ description: "Get the current weather",
67
+ inputSchema: z.object({
68
+ city: z.string(),
69
+ }),
70
+ execute: async ({ city }) => {
71
+ return `The weather in ${city} is sunny`;
72
+ },
73
+ }),
74
+ },
75
+ });
76
+
77
+ return result.toUIMessageStreamResponse();
78
+ }
79
+ ```
80
+
81
+ </Step>
82
+ <Step>
83
+
84
+ ### Wrap your app with `AssistantRuntimeProvider` with AI SDK v5 runtime
85
+
86
+ `@/app/page.tsx`
87
+
88
+ ```tsx
89
+ "use client";
90
+
91
+ import { Thread } from "@/components/assistant-ui/thread";
92
+ import { useChat } from "@ai-sdk/react";
93
+ import { AssistantRuntimeProvider } from "@assistant-ui/react";
94
+ import { useAISDKRuntime } from "@assistant-ui/react-ai-sdk";
95
+
96
+ export default function Home() {
97
+ const chat = useChat();
98
+ const runtime = useAISDKRuntime(chat);
99
+
100
+ return (
101
+ <AssistantRuntimeProvider runtime={runtime}>
102
+ <div className="h-full">
103
+ <Thread />
104
+ </div>
105
+ </AssistantRuntimeProvider>
106
+ );
107
+ }
108
+ ```
109
+
110
+ </Step>
111
+ </Steps>
112
+
113
+ ## API Reference
114
+
115
+ ### useAISDKRuntime
116
+
117
+ Creates a runtime adapter for AI SDK v5's `useChat` hook.
118
+
119
+ ```tsx
120
+ import { useChat } from "@ai-sdk/react";
121
+ import { useAISDKRuntime } from "@assistant-ui/react-ai-sdk";
122
+
123
+ const chat = useChat();
124
+ const runtime = useAISDKRuntime(chat);
125
+ ```
126
+
127
+ ## Example
128
+
129
+ For a complete example, check out the [AI SDK v5 example](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-ai-sdk-v5) in our repository.
@@ -38,7 +38,7 @@ npm install @assistant-ui/react @assistant-ui/react-ai-sdk ai @ai-sdk/openai
38
38
 
39
39
  ```tsx
40
40
  import { openai } from "@ai-sdk/openai";
41
- import { streamText } from "ai";
41
+ import { convertToCoreMessages, streamText } from "ai";
42
42
 
43
43
  export const maxDuration = 30;
44
44
 
@@ -129,8 +129,8 @@ const MyAssistantMessage = () => {
129
129
 
130
130
  const WeatherToolUI = makeAssistantToolUI({
131
131
  render: () => {
132
- const aiSDKMessage = useContentPart((p) => getExternalStoreMessages(p)[0]);
132
+ const aiSDKMessage = useMessagePart((p) => getExternalStoreMessages(p)[0]);
133
133
  // ...
134
134
  },
135
135
  });
136
- ```
136
+ ```
@@ -1144,13 +1144,13 @@ const MyComponent = () => {
1144
1144
  messages for display.
1145
1145
  </Callout>
1146
1146
 
1147
- ### Content Part Access
1147
+ ### Message part Access
1148
1148
 
1149
1149
  ```tsx
1150
1150
  const ToolUI = makeAssistantToolUI({
1151
1151
  render: () => {
1152
- const originalMessages = useContentPart((p) => getExternalStoreMessages(p));
1153
- // Access original message data for this content part
1152
+ const originalMessages = useMessagePart((p) => getExternalStoreMessages(p));
1153
+ // Access original message data for this message part
1154
1154
  },
1155
1155
  });
1156
1156
  ```
@@ -1500,8 +1500,8 @@ A flexible message format that can be converted to assistant-ui's internal forma
1500
1500
  },
1501
1501
  {
1502
1502
  name: "content",
1503
- type: "string | readonly ContentPart[]",
1504
- description: "Message content as string or structured content parts",
1503
+ type: "string | readonly MessagePart[]",
1504
+ description: "Message content as string or structured message parts",
1505
1505
  required: true,
1506
1506
  },
1507
1507
  {
@@ -273,12 +273,12 @@ npx shadcn@latest add button
273
273
  Then create a new file under `/components/tools/ToolFallback.tsx` to define the fallback UI.
274
274
 
275
275
  ```tsx title="@/components/tools/ToolFallback.tsx"
276
- import { ToolCallContentPartComponent } from "@assistant-ui/react";
276
+ import { ToolCallMessagePartComponent } from "@assistant-ui/react";
277
277
  import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
278
278
  import { useState } from "react";
279
279
  import { Button } from "../ui/button";
280
280
 
281
- export const ToolFallback: ToolCallContentPartComponent = ({
281
+ export const ToolFallback: ToolCallMessagePartComponent = ({
282
282
  toolName,
283
283
  argsText,
284
284
  result,
@@ -13,7 +13,10 @@ The Attachment components let the user attach files and view the attachments.
13
13
  <AttachmentSample />
14
14
 
15
15
  <Callout type="info">
16
- **Note:** These components provide the UI for attachments, but you also need to configure attachment adapters in your runtime to handle file uploads and processing. See the [Attachments Guide](/docs/guides/Attachments) for complete setup instructions.
16
+ **Note:** These components provide the UI for attachments, but you also need
17
+ to configure attachment adapters in your runtime to handle file uploads and
18
+ processing. See the [Attachments Guide](/docs/guides/Attachments) for complete
19
+ setup instructions.
17
20
  </Callout>
18
21
 
19
22
  ## Getting Started
@@ -69,7 +72,7 @@ const UserMessage: FC = () => {
69
72
  <UserMessageAttachments />
70
73
 
71
74
  <div className="...">
72
- <MessagePrimitive.Content />
75
+ <MessagePrimitive.Parts />
73
76
  </div>
74
77
 
75
78
  <BranchPicker className="..." />
@@ -30,7 +30,7 @@ This adds a `/components/assistant-ui/markdown-text.tsx` file to your project, w
30
30
 
31
31
  ### Use it in your application
32
32
 
33
- Pass the `MarkdownText` component to the `MessagePrimitive.Content` component
33
+ Pass the `MarkdownText` component to the `MessagePrimitive.Parts` component
34
34
 
35
35
  ```tsx twoslash title="/components/assistant-ui/thread.tsx" {1,11}
36
36
  // @filename: /components/assistant-ui/markdown-text.tsx
@@ -52,7 +52,7 @@ const AssistantMessage: FC = () => {
52
52
  return (
53
53
  <MessagePrimitive.Root className="...">
54
54
  <div className="...">
55
- <MessagePrimitive.Content components={{ Text: MarkdownText }} />
55
+ <MessagePrimitive.Parts components={{ Text: MarkdownText }} />
56
56
  </div>
57
57
  <AssistantActionBar />
58
58
 
@@ -69,4 +69,3 @@ const AssistantMessage: FC = () => {
69
69
  ## Syntax highlighting
70
70
 
71
71
  Syntax Highlighting is not included by default, see [Syntax Highlighting](/docs/ui/SyntaxHighlighting) to learn how to add it.
72
-