ai 7.0.146 → 7.0.147

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 (39) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +3 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/internal/index.js +1 -1
  6. package/docs/02-foundations/01-overview.mdx +1 -1
  7. package/docs/02-foundations/02-providers-and-models.mdx +2 -2
  8. package/docs/02-foundations/03-prompts.mdx +3 -3
  9. package/docs/02-foundations/04-tools.mdx +2 -2
  10. package/docs/02-getting-started/00-choosing-a-provider.mdx +1 -1
  11. package/docs/02-getting-started/02-nextjs-app-router.mdx +4 -4
  12. package/docs/02-getting-started/03-nextjs-pages-router.mdx +4 -4
  13. package/docs/02-getting-started/04-svelte.mdx +3 -3
  14. package/docs/02-getting-started/05-nuxt.mdx +3 -3
  15. package/docs/02-getting-started/06-nodejs.mdx +2 -2
  16. package/docs/02-getting-started/07-expo.mdx +4 -4
  17. package/docs/02-getting-started/08-tanstack-start.mdx +4 -4
  18. package/docs/03-ai-sdk-core/10-generating-structured-data.mdx +1 -1
  19. package/docs/03-ai-sdk-core/18-tools.mdx +5 -5
  20. package/docs/03-ai-sdk-core/37-speech.mdx +1 -1
  21. package/docs/03-ai-sdk-core/41-skill-uploads.mdx +24 -10
  22. package/docs/03-ai-sdk-harnesses/02-harness-agent.mdx +1 -1
  23. package/docs/03-ai-sdk-harnesses/05-harness-adapters.mdx +5 -5
  24. package/docs/03-ai-sdk-harnesses/06-workflow-utilities.mdx +12 -0
  25. package/docs/03-ai-sdk-harnesses/07-ui.mdx +2 -2
  26. package/docs/04-ai-sdk-ui/03-chatbot-tool-usage.mdx +2 -2
  27. package/docs/05-ai-sdk-rsc/01-overview.mdx +1 -1
  28. package/docs/05-ai-sdk-rsc/10-migrating-to-ui.mdx +1 -1
  29. package/docs/06-advanced/01-prompt-engineering.mdx +1 -1
  30. package/docs/06-advanced/03-backpressure.mdx +1 -1
  31. package/docs/06-advanced/10-vercel-deployment-guide.mdx +1 -1
  32. package/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +1 -1
  33. package/docs/07-reference/01-ai-sdk-core/14-upload-skill.mdx +3 -3
  34. package/docs/07-reference/01-ai-sdk-core/22-dynamic-tool.mdx +1 -1
  35. package/docs/08-migration-guides/index.mdx +12 -12
  36. package/docs/09-troubleshooting/05-tool-invocation-missing-result.mdx +1 -1
  37. package/package.json +2 -2
  38. package/src/generate-text/output.ts +1 -1
  39. package/src/ui/process-ui-message-stream.ts +1 -0
@@ -111,7 +111,7 @@ function asAsyncIterableStream(stream) {
111
111
  }
112
112
  //#endregion
113
113
  //#region src/version.ts
114
- const VERSION = "7.0.146";
114
+ const VERSION = "7.0.147";
115
115
  //#endregion
116
116
  //#region src/util/download/download.ts
117
117
  /**
@@ -40,4 +40,4 @@ However, it's crucial to understand LLMs' limitations. When asked about less kno
40
40
 
41
41
  An **embedding model** is used to convert complex data (like words or images) into a dense vector (a list of numbers) representation, known as an embedding. Unlike generative models, embedding models do not generate new text or data. Instead, they provide representations of semantic and syntactic relationships between entities that can be used as input for other models or other natural language processing tasks.
42
42
 
43
- In the next section, you will learn about the difference between models providers and models, and which ones are available in the AI SDK.
43
+ In the next section, you will learn about the difference between model providers and models, and which ones are available in the AI SDK.
@@ -9,7 +9,7 @@ Companies such as OpenAI and Anthropic (providers) offer access to a range of la
9
9
 
10
10
  Each provider typically has its own unique method for interfacing with their models, complicating the process of switching providers and increasing the risk of vendor lock-in.
11
11
 
12
- To solve these challenges, AI SDK Core offers a standardized approach to interacting with LLMs through a [language model specification](https://github.com/vercel/ai/tree/main/packages/provider/src/language-model/v3) that abstracts differences between providers. This unified interface allows you to switch between providers with ease while using the same API for all providers.
12
+ To solve these challenges, AI SDK Core offers a standardized approach to interacting with LLMs through a [language model specification](https://github.com/vercel/ai/tree/main/packages/provider/src/language-model/v4) that abstracts differences between providers. This unified interface allows you to switch between providers with ease while using the same API for all providers.
13
13
 
14
14
  Here is an overview of the AI SDK Provider Architecture:
15
15
 
@@ -56,7 +56,7 @@ You can also use the [OpenAI Compatible provider](/providers/openai-compatible-p
56
56
  - [LM Studio](/providers/openai-compatible-providers/lmstudio)
57
57
  - [Heroku](/providers/openai-compatible-providers/heroku)
58
58
 
59
- Our [language model specification](https://github.com/vercel/ai/tree/main/packages/provider/src/language-model/v3) is published as an open-source package, which you can use to create [custom providers](/providers/community-providers/custom-providers).
59
+ Our [language model specification](https://github.com/vercel/ai/tree/main/packages/provider/src/language-model/v4) is published as an open-source package, which you can use to create [custom providers](/providers/community-providers/custom-providers).
60
60
 
61
61
  The open-source community has created the following providers:
62
62
 
@@ -58,7 +58,7 @@ System messages in `prompt` or `messages` are rejected by default; use the `inst
58
58
  const result = await generateText({
59
59
  model: __MODEL__,
60
60
  instructions:
61
- `You help planning travel itineraries. ` +
61
+ `You help plan travel itineraries. ` +
62
62
  `Respond to the users' request with a list ` +
63
63
  `of the best stops to make in their destination.`,
64
64
  prompt:
@@ -481,7 +481,7 @@ const result = await generateText({
481
481
  });
482
482
  ```
483
483
 
484
- ### Tool messages
484
+ ### Tool Messages
485
485
 
486
486
  <Note>
487
487
  [Tools](/docs/foundations/tools) (also known as function calling) are programs
@@ -616,7 +616,7 @@ const result = await generateText({
616
616
  model: __MODEL__,
617
617
  allowSystemInMessages: true,
618
618
  messages: [
619
- { role: 'system', content: 'You help planning travel itineraries.' },
619
+ { role: 'system', content: 'You help plan travel itineraries.' },
620
620
  {
621
621
  role: 'user',
622
622
  content:
@@ -34,7 +34,7 @@ A tool consists of three properties:
34
34
 
35
35
  If the LLM decides to use a tool, it will generate a tool call.
36
36
  Tools with an `execute` function are run automatically when these calls are generated.
37
- The output of the tool calls are returned using tool result objects.
37
+ The output of the tool calls is returned using tool result objects.
38
38
 
39
39
  You can automatically pass tool results back to the LLM
40
40
  using [multi-step calls](/docs/ai-sdk-core/tools-and-tool-calling#multi-step-calls-using-stopwhen) with `streamText` and `generateText`.
@@ -150,7 +150,7 @@ const result = await generateText({
150
150
 
151
151
  ## Schemas
152
152
 
153
- Schemas are used to define and validate the [tool input](/docs/ai-sdk-core/tools-and-tool-calling), tools outputs, and structured output generation.
153
+ Schemas are used to define and validate the [tool input](/docs/ai-sdk-core/tools-and-tool-calling), tool outputs, and structured output generation.
154
154
 
155
155
  The AI SDK supports the following schemas:
156
156
 
@@ -80,7 +80,7 @@ See [available providers](/providers/ai-sdk-providers) for setup instructions fo
80
80
 
81
81
  ## Custom Providers
82
82
 
83
- You can build your own provider to integrate any service with the AI SDK. The AI SDK provides a [Language Model Specification](https://github.com/vercel/ai/tree/main/packages/provider/src/language-model/v3) that ensures compatibility across providers.
83
+ You can build your own provider to integrate any service with the AI SDK. The AI SDK provides a [Language Model Specification](https://github.com/vercel/ai/tree/main/packages/provider/src/language-model/v4) that ensures compatibility across providers.
84
84
 
85
85
  ```ts
86
86
  import { generateText } from 'ai';
@@ -16,7 +16,7 @@ If you are unfamiliar with the concepts of [Prompt Engineering](/docs/advanced/p
16
16
  To follow this quickstart, you'll need:
17
17
 
18
18
  - Node.js 22+ and pnpm installed on your local development machine.
19
- - A [ Vercel AI Gateway ](https://vercel.com/ai-gateway) API key.
19
+ - A [Vercel AI Gateway](https://vercel.com/ai-gateway) API key.
20
20
 
21
21
  If you haven't obtained your Vercel AI Gateway API key, you can do so by [signing up](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai&title=Go+to+AI+Gateway) on the Vercel website.
22
22
 
@@ -40,7 +40,7 @@ Navigate to the newly created directory:
40
40
 
41
41
  ### Install dependencies
42
42
 
43
- Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [ Vercel AI Gateway provider ](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
43
+ Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [Vercel AI Gateway provider](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
44
44
 
45
45
  <Note>
46
46
  This guide uses the Vercel AI Gateway provider so you can access hundreds of
@@ -109,7 +109,7 @@ This Route Handler creates a POST request endpoint at `/api/chat`.
109
109
 
110
110
  ## Choosing a Provider
111
111
 
112
- The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [ community ](/providers/community-providers) packages.
112
+ The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [community](/providers/community-providers) packages.
113
113
 
114
114
  This quickstart uses the [Vercel AI Gateway](https://vercel.com/ai-gateway) provider, which is the default [global provider](/docs/ai-sdk-core/provider-management#global-provider-configuration). This means you can access models using a simple string in the model configuration:
115
115
 
@@ -149,7 +149,7 @@ Pick the approach that best matches how you want to manage providers across your
149
149
 
150
150
  ## Wire up the UI
151
151
 
152
- Now that you have a Route Handler that can query an LLM, it's time to setup your frontend. The AI SDK's [ UI ](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
152
+ Now that you have a Route Handler that can query an LLM, it's time to set up your frontend. The AI SDK's [UI](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
153
153
 
154
154
  Update your root page (`app/page.tsx`) with the following code to show a list of chat messages and provide a user message input:
155
155
 
@@ -16,7 +16,7 @@ If you are unfamiliar with the concepts of [Prompt Engineering](/docs/advanced/p
16
16
  To follow this quickstart, you'll need:
17
17
 
18
18
  - Node.js 22+ and pnpm installed on your local development machine.
19
- - A [ Vercel AI Gateway ](https://vercel.com/ai-gateway) API key.
19
+ - A [Vercel AI Gateway](https://vercel.com/ai-gateway) API key.
20
20
 
21
21
  If you haven't obtained your Vercel AI Gateway API key, you can do so by [signing up](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai&title=Go+to+AI+Gateway) on the Vercel website.
22
22
 
@@ -38,7 +38,7 @@ Navigate to the newly created directory:
38
38
 
39
39
  ### Install dependencies
40
40
 
41
- Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [ Vercel AI Gateway provider ](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
41
+ Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [Vercel AI Gateway provider](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
42
42
 
43
43
  <Note>
44
44
  This guide uses the Vercel AI Gateway provider so you can access hundreds of
@@ -113,7 +113,7 @@ This Route Handler creates a POST request endpoint at `/api/chat`.
113
113
 
114
114
  ## Choosing a Provider
115
115
 
116
- The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [ community ](/providers/community-providers) packages.
116
+ The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [community](/providers/community-providers) packages.
117
117
 
118
118
  This quickstart uses the [Vercel AI Gateway](https://vercel.com/ai-gateway) provider, which is the default [global provider](/docs/ai-sdk-core/provider-management#global-provider-configuration). This means you can access models using a simple string in the model configuration:
119
119
 
@@ -153,7 +153,7 @@ Pick the approach that best matches how you want to manage providers across your
153
153
 
154
154
  ## Wire up the UI
155
155
 
156
- Now that you have an API route that can query an LLM, it's time to set up your frontend. The AI SDK's [ UI ](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
156
+ Now that you have an API route that can query an LLM, it's time to set up your frontend. The AI SDK's [UI](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
157
157
 
158
158
  Update your root page (`pages/index.tsx`) with the following code to show a list of chat messages and provide a user message input:
159
159
 
@@ -16,7 +16,7 @@ If you are unfamiliar with the concepts of [Prompt Engineering](/docs/advanced/p
16
16
  To follow this quickstart, you'll need:
17
17
 
18
18
  - Node.js 22+ and pnpm installed on your local development machine.
19
- - A [ Vercel AI Gateway ](https://vercel.com/ai-gateway) API key.
19
+ - A [Vercel AI Gateway](https://vercel.com/ai-gateway) API key.
20
20
 
21
21
  If you haven't obtained your Vercel AI Gateway API key, you can do so by [signing up](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai&title=Go+to+AI+Gateway) on the Vercel website.
22
22
 
@@ -32,7 +32,7 @@ Navigate to the newly created directory:
32
32
 
33
33
  ### Install Dependencies
34
34
 
35
- Install `ai` and `@ai-sdk/svelte`, the AI package and AI SDK's Svelte bindings. The AI SDK's [ Vercel AI Gateway provider ](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
35
+ Install `ai` and `@ai-sdk/svelte`, the AI package and AI SDK's Svelte bindings. The AI SDK's [Vercel AI Gateway provider](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
36
36
 
37
37
  <Note>
38
38
  This guide uses the Vercel AI Gateway provider so you can access hundreds of
@@ -112,7 +112,7 @@ Let's take a look at what is happening in this code:
112
112
 
113
113
  ## Choosing a Provider
114
114
 
115
- The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [ community ](/providers/community-providers) packages.
115
+ The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [community](/providers/community-providers) packages.
116
116
 
117
117
  This quickstart uses the [Vercel AI Gateway](https://vercel.com/ai-gateway) provider, which is the default [global provider](/docs/ai-sdk-core/provider-management#global-provider-configuration). This means you can access models using a simple string in the model configuration:
118
118
 
@@ -16,7 +16,7 @@ If you are unfamiliar with the concepts of [Prompt Engineering](/docs/advanced/p
16
16
  To follow this quickstart, you'll need:
17
17
 
18
18
  - Node.js 22+ and pnpm installed on your local development machine.
19
- - A [ Vercel AI Gateway ](https://vercel.com/ai-gateway) API key.
19
+ - A [Vercel AI Gateway](https://vercel.com/ai-gateway) API key.
20
20
 
21
21
  If you haven't obtained your Vercel AI Gateway API key, you can do so by [signing up](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai&title=Go+to+AI+Gateway) on the Vercel website.
22
22
 
@@ -120,7 +120,7 @@ Let's take a look at what is happening in this code:
120
120
 
121
121
  ## Choosing a Provider
122
122
 
123
- The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [ community ](/providers/community-providers) packages.
123
+ The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [community](/providers/community-providers) packages.
124
124
 
125
125
  This quickstart uses the [Vercel AI Gateway](https://vercel.com/ai-gateway) provider, which is the default [global provider](/docs/ai-sdk-core/provider-management#global-provider-configuration). This means you can access models using a simple string in the model configuration:
126
126
 
@@ -154,7 +154,7 @@ model: openai('gpt-6-astra');
154
154
 
155
155
  ## Wire up the UI
156
156
 
157
- Now that you have an API route that can query an LLM, it's time to set up your frontend. The AI SDK's [ UI ](/docs/ai-sdk-ui/overview) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
157
+ Now that you have an API route that can query an LLM, it's time to set up your frontend. The AI SDK's [UI](/docs/ai-sdk-ui/overview) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
158
158
 
159
159
  Update your root page (`pages/index.vue`) with the following code to show a list of chat messages and provide a user message input:
160
160
 
@@ -16,7 +16,7 @@ If you are unfamiliar with the concepts of [Prompt Engineering](/docs/advanced/p
16
16
  To follow this quickstart, you'll need:
17
17
 
18
18
  - Node.js 22+ and pnpm installed on your local development machine.
19
- - A [ Vercel AI Gateway ](https://vercel.com/ai-gateway) API key.
19
+ - A [Vercel AI Gateway](https://vercel.com/ai-gateway) API key.
20
20
 
21
21
  If you haven't obtained your Vercel AI Gateway API key, you can do so by [signing up](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai&title=Go+to+AI+Gateway) on the Vercel website.
22
22
 
@@ -133,7 +133,7 @@ You should see a prompt in your terminal. Test it out by entering a message and
133
133
 
134
134
  ## Choosing a Provider
135
135
 
136
- The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [ community ](/providers/community-providers) packages.
136
+ The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [community](/providers/community-providers) packages.
137
137
 
138
138
  This quickstart uses the [Vercel AI Gateway](https://vercel.com/ai-gateway) provider, which is the default [global provider](/docs/ai-sdk-core/provider-management#global-provider-configuration). This means you can access models using a simple string in the model configuration:
139
139
 
@@ -14,7 +14,7 @@ If you are unfamiliar with the concepts of [Prompt Engineering](/docs/advanced/p
14
14
  To follow this quickstart, you'll need:
15
15
 
16
16
  - Node.js 22+ and pnpm installed on your local development machine.
17
- - A [ Vercel AI Gateway ](https://vercel.com/ai-gateway) API key.
17
+ - A [Vercel AI Gateway](https://vercel.com/ai-gateway) API key.
18
18
 
19
19
  If you haven't obtained your Vercel AI Gateway API key, you can do so by [signing up](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai&title=Go+to+AI+Gateway) on the Vercel website.
20
20
 
@@ -32,7 +32,7 @@ Navigate to the newly created directory:
32
32
 
33
33
  ### Install dependencies
34
34
 
35
- Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [ Vercel AI Gateway provider ](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
35
+ Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [Vercel AI Gateway provider](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
36
36
 
37
37
  <Note>
38
38
  This guide uses the Vercel AI Gateway provider so you can access hundreds of
@@ -112,7 +112,7 @@ This API route creates a POST request endpoint at `/api/chat`.
112
112
 
113
113
  ## Choosing a Provider
114
114
 
115
- The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [ community ](/providers/community-providers) packages.
115
+ The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [community](/providers/community-providers) packages.
116
116
 
117
117
  This quickstart uses the [Vercel AI Gateway](https://vercel.com/ai-gateway) provider, which is the default [global provider](/docs/ai-sdk-core/provider-management#global-provider-configuration). This means you can access models using a simple string in the model configuration:
118
118
 
@@ -152,7 +152,7 @@ Pick the approach that best matches how you want to manage providers across your
152
152
 
153
153
  ## Wire up the UI
154
154
 
155
- Now that you have an API route that can query an LLM, it's time to setup your frontend. The AI SDK's [ UI ](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
155
+ Now that you have an API route that can query an LLM, it's time to set up your frontend. The AI SDK's [UI](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
156
156
 
157
157
  Update your root page (`app/(tabs)/index.tsx`) with the following code to show a list of chat messages and provide a user message input:
158
158
 
@@ -16,7 +16,7 @@ If you are unfamiliar with the concepts of [Prompt Engineering](/docs/advanced/p
16
16
  To follow this quickstart, you'll need:
17
17
 
18
18
  - Node.js 22+ and pnpm installed on your local development machine.
19
- - A [ Vercel AI Gateway ](https://vercel.com/ai-gateway) API key.
19
+ - A [Vercel AI Gateway](https://vercel.com/ai-gateway) API key.
20
20
 
21
21
  If you haven't obtained your Vercel AI Gateway API key, you can do so by [signing up](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai&title=Go+to+AI+Gateway) on the Vercel website.
22
22
 
@@ -32,7 +32,7 @@ Navigate to the newly created directory:
32
32
 
33
33
  ### Install dependencies
34
34
 
35
- Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [ Vercel AI Gateway provider ](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
35
+ Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [Vercel AI Gateway provider](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
36
36
 
37
37
  <Note>
38
38
  This guide uses the Vercel AI Gateway provider so you can access hundreds of
@@ -108,7 +108,7 @@ This Route Handler creates a POST request endpoint at `/api/chat`.
108
108
 
109
109
  ## Choosing a Provider
110
110
 
111
- The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [ community ](/providers/community-providers) packages.
111
+ The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [community](/providers/community-providers) packages.
112
112
 
113
113
  This quickstart uses the [Vercel AI Gateway](https://vercel.com/ai-gateway) provider, which is the default [global provider](/docs/ai-sdk-core/provider-management#global-provider-configuration). This means you can access models using a simple string in the model configuration:
114
114
 
@@ -148,7 +148,7 @@ Pick the approach that best matches how you want to manage providers across your
148
148
 
149
149
  ## Wire up the UI
150
150
 
151
- Now that you have a Route Handler that can query an LLM, it's time to setup your frontend. The AI SDK's [ UI ](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
151
+ Now that you have a Route Handler that can query an LLM, it's time to set up your frontend. The AI SDK's [UI](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
152
152
 
153
153
  Update your index route (`src/routes/index.tsx`) with the following code to show a list of chat messages and provide a user message input:
154
154
 
@@ -11,7 +11,7 @@ For example, you might want to extract information from text, classify data, or
11
11
  Many language models are capable of generating structured data, often defined as using "JSON modes" or "tools".
12
12
  However, you need to manually provide schemas and then validate the generated data as LLMs can produce incorrect or incomplete structured data.
13
13
 
14
- The AI SDK standardises structured object generation across model providers
14
+ The AI SDK standardizes structured object generation across model providers
15
15
  using the `output` property on [`generateText`](/docs/reference/ai-sdk-core/generate-text)
16
16
  and [`streamText`](/docs/reference/ai-sdk-core/stream-text).
17
17
  You can use [Zod schemas](/docs/reference/ai-sdk-core/zod-schema), [Valibot](/docs/reference/ai-sdk-core/valibot-schema), or [JSON schemas](/docs/reference/ai-sdk-core/json-schema) to specify the shape of the data that you want,
@@ -17,7 +17,7 @@ For defining your own tools and configuring tool execution, see
17
17
 
18
18
  ## Bash Tool
19
19
 
20
- `createBashTool` lets agents run Bash commands to search, analyze, and transform files.
20
+ `experimental_createBashTool` lets agents run Bash commands to search, analyze, and transform files.
21
21
  Supply an `Experimental_SandboxSession` to choose where commands run. Use
22
22
  `@ai-sdk/sandbox-just-bash` for an in-memory environment,
23
23
  `@ai-sdk/sandbox-vercel` for Vercel Sandbox, or your own implementation.
@@ -38,7 +38,7 @@ Requires Node.js 22.13 or newer.
38
38
 
39
39
  ```ts
40
40
  import { createJustBashNetworkSandboxSession } from '@ai-sdk/sandbox-just-bash';
41
- import { createBashTool } from '@ai-sdk/tool-bash';
41
+ import { experimental_createBashTool as createBashTool } from '@ai-sdk/tool-bash';
42
42
  import { generateText, isStepCount } from 'ai';
43
43
 
44
44
  const session = await createJustBashNetworkSandboxSession();
@@ -72,7 +72,7 @@ Vercel Sandbox. Wrap it with the adapter before passing it to the tool:
72
72
 
73
73
  ```ts
74
74
  import { createVercelSandboxSessionFromNativeSandbox } from '@ai-sdk/sandbox-vercel';
75
- import { createBashTool } from '@ai-sdk/tool-bash';
75
+ import { experimental_createBashTool as createBashTool } from '@ai-sdk/tool-bash';
76
76
  import { Sandbox } from '@vercel/sandbox';
77
77
 
78
78
  const nativeSandbox = await Sandbox.create();
@@ -100,7 +100,7 @@ Raw runtime instances need their respective adapters; a custom
100
100
 
101
101
  ### Options
102
102
 
103
- `createBashTool()` requires an options object:
103
+ `experimental_createBashTool()` requires an options object:
104
104
 
105
105
  | Option | Type | Description |
106
106
  | ------------------ | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
@@ -129,7 +129,7 @@ Tools using the same session share files. Creating a tool does not reset existin
129
129
  files or create a new sandbox. Use separate sessions for independent workflows.
130
130
  The caller creates, reconnects, and destroys the sandbox.
131
131
 
132
- `createBashTool()` returns the tool directly, ready to use as `tools: { bash }`.
132
+ `experimental_createBashTool()` returns the tool directly, ready to use as `tools: { bash }`.
133
133
  Use the supplied sandbox's `readTextFile({ path })` to read generated text files;
134
134
  it returns `null` if the file is missing. Relative read paths depend on the
135
135
  sandbox adapter; just-bash resolves them against its default directory. With an
@@ -50,7 +50,7 @@ const audioBase64 = result.audio.base64; // audio data as base64 string
50
50
 
51
51
  ## Settings
52
52
 
53
- ### Provider-Specific settings
53
+ ### Provider-Specific Settings
54
54
 
55
55
  You can set model-specific settings with the `providerOptions` parameter.
56
56
 
@@ -14,7 +14,7 @@ that providers can load, e.g. in sandboxed container environments.
14
14
 
15
15
  In the AI SDK, the uploaded skill is identified by a `ProviderReference` — a
16
16
  `Record<string, string>` mapping provider names to provider-specific identifiers.
17
- This concept is used for other provider specific asset references too, such as
17
+ This concept is used for other provider-specific asset references too, such as
18
18
  uploaded media files.
19
19
 
20
20
  ```ts
@@ -30,7 +30,7 @@ const { providerReference } = await uploadSkill({
30
30
  files: [
31
31
  {
32
32
  path: 'my-skill/SKILL.md',
33
- content: readFileSync('./SKILL.md'),
33
+ data: readFileSync('./SKILL.md'),
34
34
  },
35
35
  ],
36
36
  displayTitle: 'My Skill',
@@ -57,16 +57,16 @@ As a shorthand, you can pass a provider instance directly to `api` instead of ca
57
57
  ```ts highlight="2"
58
58
  const { providerReference } = await uploadSkill({
59
59
  api: anthropic, // shorthand for anthropic.skills()
60
- files: [{ path: 'my-skill/SKILL.md', content: readFileSync('./SKILL.md') }],
60
+ files: [{ path: 'my-skill/SKILL.md', data: readFileSync('./SKILL.md') }],
61
61
  displayTitle: 'My Skill',
62
62
  });
63
63
  ```
64
64
 
65
65
  ## Skill Files
66
66
 
67
- A skill is composed of one or more files, each with a relative `path` and `content`.
68
- File content can be provided as a `Uint8Array` (e.g. from `fs.readFileSync`) or as a
69
- base64-encoded string:
67
+ A skill is composed of one or more files, each with a relative `path` and `data`.
68
+
69
+ File content can be provided as a `Uint8Array` (for example, from `fs.readFileSync`) or as a base64-encoded string. Alternatively, `data` can be provided as a tagged object with either `type: 'text'` or `type: 'data'` to explicitly specify the content format:
70
70
 
71
71
  ```ts
72
72
  const { providerReference } = await uploadSkill({
@@ -74,11 +74,25 @@ const { providerReference } = await uploadSkill({
74
74
  files: [
75
75
  {
76
76
  path: 'my-skill/SKILL.md',
77
- content: readFileSync('./SKILL.md'), // Uint8Array
77
+ data: readFileSync('./SKILL.md'), // Uint8Array
78
78
  },
79
79
  {
80
80
  path: 'my-skill/helper.py',
81
- content: readFileSync('./helper.py'),
81
+ data: readFileSync('./helper.py'),
82
+ },
83
+ {
84
+ path: 'my-skill/data.json',
85
+ data: {
86
+ type: 'data',
87
+ data: Buffer.from(JSON.stringify({ foo: 'bar' })).toString('base64'),
88
+ },
89
+ },
90
+ {
91
+ path: 'my-skill/README.txt',
92
+ data: {
93
+ type: 'text',
94
+ text: 'This is a skill for demonstrating skill uploads.',
95
+ },
82
96
  },
83
97
  ],
84
98
  });
@@ -123,11 +137,11 @@ merge the references:
123
137
  const [openaiUpload, anthropicUpload] = await Promise.all([
124
138
  uploadSkill({
125
139
  api: openai.skills(),
126
- files: [{ path: 'my-skill/SKILL.md', content: skillSource }],
140
+ files: [{ path: 'my-skill/SKILL.md', data: skillSource }],
127
141
  }),
128
142
  uploadSkill({
129
143
  api: anthropic.skills(),
130
- files: [{ path: 'my-skill/SKILL.md', content: skillSource }],
144
+ files: [{ path: 'my-skill/SKILL.md', data: skillSource }],
131
145
  displayTitle: 'My Skill',
132
146
  }),
133
147
  ]);
@@ -15,7 +15,7 @@ Install the core harness package, a harness adapter, and a sandbox adapter:
15
15
 
16
16
  <InstallPackages packages="@ai-sdk/harness @ai-sdk/harness-claude-code @ai-sdk/sandbox-vercel" />
17
17
 
18
- Bridge-backed harnesses such as Claude Code and Codex require using real network sandbox
18
+ Bridge-backed harnesses such as Claude Code and Codex require using a real network sandbox
19
19
  like `@ai-sdk/sandbox-vercel`. Host-runtime harnesses such as Pi can also run with
20
20
  `@ai-sdk/sandbox-just-bash` because they do not need a sandbox-exposed port.
21
21
 
@@ -38,10 +38,10 @@ The AI SDK includes the following harness adapters:
38
38
  | [Claude Code](/providers/ai-sdk-harnesses/claude-code) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> |
39
39
  | [Cline](/providers/ai-sdk-harnesses/cline) | Host process | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> |
40
40
  | [Codex](/providers/ai-sdk-harnesses/codex) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> | <Check /> | <Cross /> |
41
- | [Cursor](/providers/ai-sdk-harnesses/cursor) | Sandbox via ACP | <Check /> | <Check /> | <Cross /> | <Cross /> | <Cross /> | <Cross /> | <Cross /> |
42
- | [Deep Agents](/providers/ai-sdk-harnesses/deepagents) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection | <Cross /> | <Cross /> |
41
+ | [Cursor](/providers/ai-sdk-harnesses/cursor) | Sandbox via ACP | <Check /> | <Check /> | <Cross /> | <Cross /> | <Cross /> | <Check /> | <Cross /> |
42
+ | [Deep Agents](/providers/ai-sdk-harnesses/deepagents) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection | <Check /> | <Cross /> |
43
43
  | [fx](/providers/ai-sdk-harnesses/fx) | Host process | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> |
44
- | [GitHub Copilot](/providers/ai-sdk-harnesses/github-copilot) | Sandbox via ACP | <Check /> | <Check /> | <Cross /> | <Cross /> | <Cross /> | <Cross /> | <Cross /> |
45
- | [Grok Build](/providers/ai-sdk-harnesses/grok-build) | Sandbox via ACP | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> | <Cross /> | <Cross /> |
46
- | [OpenCode](/providers/ai-sdk-harnesses/opencode) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> |
44
+ | [GitHub Copilot](/providers/ai-sdk-harnesses/github-copilot) | Sandbox via ACP | <Check /> | <Check /> | <Cross /> | <Cross /> | <Cross /> | <Check /> | <Cross /> |
45
+ | [Grok Build](/providers/ai-sdk-harnesses/grok-build) | Sandbox via ACP | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> | <Check /> | <Cross /> |
46
+ | [OpenCode](/providers/ai-sdk-harnesses/opencode) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> |
47
47
  | [Pi](/providers/ai-sdk-harnesses/pi) | Host process | <Check /> | <Check /> | <Cross /> | <Check /> | <Check /> | <Check /> | <Cross /> |
@@ -308,6 +308,18 @@ export async function POST(request: Request) {
308
308
  }
309
309
  ```
310
310
 
311
+ If you use Next.js, wrap your config with `withWorkflow()` so the Workflow SDK
312
+ transforms `'use workflow'` and `'use step'` modules. Other frameworks have
313
+ their own Workflow SDK setup.
314
+
315
+ ```js filename='next.config.js'
316
+ import { withWorkflow } from 'workflow/next';
317
+
318
+ const nextConfig = {};
319
+
320
+ export default withWorkflow(nextConfig);
321
+ ```
322
+
311
323
  The workflow state `sessionId` identifies the harness session. The step derives
312
324
  `sandboxId` from it; otherwise, you must persist `sandboxSession.id` separately
313
325
  to reattach across steps. Keep
@@ -93,7 +93,7 @@ export const agent = new HarnessAgent({
93
93
 
94
94
  Persist the opaque resume state returned by `session.detach()`. If the
95
95
  turn paused for approval or was otherwise interrupted, that resume state carries
96
- the continuation state internally. The chat id can also be the harness
96
+ the continuation state internally. The chat ID can also be the harness
97
97
  `sessionId`. Here we derive a stable `sandboxId` from that known chat id. If
98
98
  you do not derive one, persist the returned `sandboxSession.id` separately.
99
99
 
@@ -170,7 +170,7 @@ export async function POST(request: Request) {
170
170
  } = await request.json();
171
171
 
172
172
  if (!body.id) {
173
- throw new Error('Missing chat id');
173
+ return new Response('Missing chat ID', { status: 400 });
174
174
  }
175
175
 
176
176
  const chatId = body.id;
@@ -16,12 +16,12 @@ The flow is as follows:
16
16
 
17
17
  1. The user enters a message in the chat UI.
18
18
  1. The message is sent to the API route.
19
- 1. In your server side route, the language model generates tool calls during the `streamText` call.
19
+ 1. In your server-side route, the language model generates tool calls during the `streamText` call.
20
20
  1. All tool calls are forwarded to the client.
21
21
  1. Server-side tools are executed using their `execute` method and their results are forwarded to the client.
22
22
  1. Client-side tools that should be automatically executed are handled with the `onToolCall` callback.
23
23
  You must call `addToolOutput` to provide the tool result.
24
- 1. Client-side tool that require user interactions can be displayed in the UI.
24
+ 1. Client-side tools that require user interactions can be displayed in the UI.
25
25
  The tool calls and results are available as tool invocation parts in the `parts` property of the last assistant message.
26
26
  1. When the user interaction is done, `addToolOutput` can be used to add the tool result to the chat.
27
27
  1. The chat can be configured to automatically submit when all tool results are available using `sendAutomaticallyWhen`.
@@ -16,7 +16,7 @@ description: An overview of AI SDK RSC.
16
16
  Server Components.
17
17
  </Note>
18
18
 
19
- [React Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components) (RSC) allow you to write UI that can be rendered on the server and streamed to the client. RSCs enable [ Server Actions ](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#with-client-components), a new way to call server-side code directly from the client just like any other function with end-to-end type-safety. This combination opens the door to a new way of building AI applications, allowing the large language model (LLM) to generate and stream UI directly from the server to the client.
19
+ [React Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components) (RSC) allow you to write UI that can be rendered on the server and streamed to the client. RSCs enable [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#with-client-components), a new way to call server-side code directly from the client just like any other function with end-to-end type-safety. This combination opens the door to a new way of building AI applications, allowing the large language model (LLM) to generate and stream UI directly from the server to the client.
20
20
 
21
21
  ## AI SDK RSC Functions
22
22
 
@@ -166,7 +166,7 @@ export default function Page() {
166
166
 
167
167
  In AI SDK RSC, `streamUI` does not support parallel tool calls. You will have to use a combination of `streamText`, `createStreamableUI` and `createStreamableValue`.
168
168
 
169
- With AI SDK UI, `useChat` comes with built-in support for parallel tool calls. You can define multiple tools in the `streamText` and have them called them in parallel. The `useChat` hook will then handle the parallel tool calls for you automatically.
169
+ With AI SDK UI, `useChat` comes with built-in support for parallel tool calls. You can define multiple tools in the `streamText` and have them called in parallel. The `useChat` hook will then handle the parallel tool calls for you automatically.
170
170
 
171
171
  ### Multi-Step Tool Calls
172
172
 
@@ -17,7 +17,7 @@ Prompts are the starting points for LLMs. They are the inputs that trigger the m
17
17
 
18
18
  ## Why is prompt engineering needed?
19
19
 
20
- Prompt engineering currently plays a pivotal role in shaping the responses of LLMs. It allows us to tweak the model to respond more effectively to a broader range of queries. This includes the use of techniques like semantic search, command grammars, and the ReActive model architecture. The performance, context window, and cost of LLMs varies between models and model providers which adds further constraints to the mix. For example, the GPT-4 model is more expensive than GPT-3.5-turbo and significantly slower, but it can also be more effective at certain tasks. And so, like many things in software engineering, there is a trade-offs between cost and performance.
20
+ Prompt engineering currently plays a pivotal role in shaping the responses of LLMs. It allows us to tweak the model to respond more effectively to a broader range of queries. This includes the use of techniques like semantic search, command grammars, and the ReActive model architecture. The performance, context window, and cost of LLMs varies between models and model providers which adds further constraints to the mix. For example, the GPT-4 model is more expensive than GPT-3.5-turbo and significantly slower, but it can also be more effective at certain tasks. And so, like many things in software engineering, there is a trade-off between cost and performance.
21
21
 
22
22
  To assist with comparing and tweaking LLMs, we've built an AI playground that allows you to compare the performance of different models side-by-side online. When you're ready, you can even generate code with the AI SDK to quickly use your prompt and your selected model into your own applications.
23
23
 
@@ -120,7 +120,7 @@ function createStream(iterator) {
120
120
  }
121
121
  // Collect data from stream
122
122
  async function run() {
123
- // Set up a stream that of integers
123
+ // Set up a stream of integers
124
124
  const stream = createStream(integers());
125
125
 
126
126
  // Read values from our stream
@@ -16,7 +16,7 @@ Vercel allows for automatic deployments on every branch push and merges onto the
16
16
  To follow along with this guide, you will need:
17
17
 
18
18
  - a Vercel account
19
- - an account with a Git provider (this tutorial will use [Github](https://github.com))
19
+ - an account with a Git provider (this tutorial will use [GitHub](https://github.com))
20
20
  - an OpenAI API key
21
21
 
22
22
  This guide will teach you how to deploy the application you built in the Next.js (App Router) quickstart tutorial to Vercel. If you haven’t completed the quickstart guide, you can start with [this repo](https://github.com/vercel-labs/ai-sdk-deployment-guide).
@@ -7,7 +7,7 @@ description: API Reference for generateText.
7
7
 
8
8
  Generates text and calls tools for a given prompt using a language model.
9
9
 
10
- It is ideal for non-interactive use cases such as automation tasks where you need to write text (e.g. drafting email or summarizing web pages) and for agents that use tools.
10
+ It is ideal for non-interactive use cases such as automation tasks where you need to write text (e.g. drafting emails or summarizing web pages) and for agents that use tools.
11
11
 
12
12
  ```ts
13
13
  import { generateText } from 'ai';