ai 6.0.209 → 6.0.210

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.210
4
+
5
+ ### Patch Changes
6
+
7
+ - 1b40ac7: Publish all packages under the `@ai-v6` dist tag.
8
+ - Updated dependencies [1b40ac7]
9
+ - @ai-sdk/gateway@3.0.135
10
+ - @ai-sdk/provider-utils@4.0.31
11
+ - @ai-sdk/provider@3.0.11
12
+
3
13
  ## 6.0.209
4
14
 
5
15
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1281,7 +1281,7 @@ function detectMediaType({
1281
1281
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
1282
1282
 
1283
1283
  // src/version.ts
1284
- var VERSION = true ? "6.0.209" : "0.0.0-test";
1284
+ var VERSION = true ? "6.0.210" : "0.0.0-test";
1285
1285
 
1286
1286
  // src/util/download/download.ts
1287
1287
  var download = async ({
package/dist/index.mjs CHANGED
@@ -1171,7 +1171,7 @@ import {
1171
1171
  } from "@ai-sdk/provider-utils";
1172
1172
 
1173
1173
  // src/version.ts
1174
- var VERSION = true ? "6.0.209" : "0.0.0-test";
1174
+ var VERSION = true ? "6.0.210" : "0.0.0-test";
1175
1175
 
1176
1176
  // src/util/download/download.ts
1177
1177
  var download = async ({
@@ -152,7 +152,7 @@ function detectMediaType({
152
152
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
153
153
 
154
154
  // src/version.ts
155
- var VERSION = true ? "6.0.209" : "0.0.0-test";
155
+ var VERSION = true ? "6.0.210" : "0.0.0-test";
156
156
 
157
157
  // src/util/download/download.ts
158
158
  var download = async ({
@@ -132,7 +132,7 @@ import {
132
132
  } from "@ai-sdk/provider-utils";
133
133
 
134
134
  // src/version.ts
135
- var VERSION = true ? "6.0.209" : "0.0.0-test";
135
+ var VERSION = true ? "6.0.210" : "0.0.0-test";
136
136
 
137
137
  // src/util/download/download.ts
138
138
  var download = async ({
@@ -376,7 +376,7 @@ To solve this, you can enable multi-step tool calls using `stopWhen`. By default
376
376
 
377
377
  Modify your `app/api/chat/route.ts` file to include the `stopWhen` condition:
378
378
 
379
- ```tsx filename="app/api/chat/route.ts" highlight="16"
379
+ ```tsx filename="app/api/chat/route.ts" highlight="17"
380
380
  import {
381
381
  streamText,
382
382
  UIMessage,
@@ -431,7 +431,7 @@ By setting `stopWhen: stepCountIs(5)`, you're allowing the model to use up to 5
431
431
 
432
432
  Update your `app/api/chat/route.ts` file to add a new tool to convert the temperature from Fahrenheit to Celsius:
433
433
 
434
- ```tsx filename="app/api/chat/route.ts" highlight="31-46"
434
+ ```tsx filename="app/api/chat/route.ts" highlight="32-45"
435
435
  import {
436
436
  streamText,
437
437
  UIMessage,
@@ -369,7 +369,7 @@ To solve this, you can enable multi-step tool calls using `stopWhen`. By default
369
369
 
370
370
  Modify your `app/api/chat/route.ts` file to include the `stopWhen` condition:
371
371
 
372
- ```tsx filename="app/api/chat/route.ts" highlight="16"
372
+ ```tsx filename="app/api/chat/route.ts" highlight="17"
373
373
  import {
374
374
  streamText,
375
375
  UIMessage,
@@ -416,7 +416,7 @@ By setting `stopWhen: stepCountIs(5)`, you're allowing the model to use up to 5
416
416
 
417
417
  Update your `app/api/chat/route.ts` file to add a new tool to convert the temperature from Fahrenheit to Celsius:
418
418
 
419
- ```tsx filename="app/api/chat/route.ts" highlight="31-46"
419
+ ```tsx filename="app/api/chat/route.ts" highlight="32-45"
420
420
  import {
421
421
  streamText,
422
422
  UIMessage,
@@ -252,7 +252,7 @@ Let's enhance your chatbot by adding a simple weather tool.
252
252
 
253
253
  Modify your `src/routes/api/chat/+server.ts` file to include the new weather tool:
254
254
 
255
- ```tsx filename="src/routes/api/chat/+server.ts" highlight="2,3,17-31"
255
+ ```tsx filename="src/routes/api/chat/+server.ts" highlight="5-6,23-37"
256
256
  import {
257
257
  createGateway,
258
258
  streamText,
@@ -373,7 +373,7 @@ To solve this, you can enable multi-step tool calls using `stopWhen`. By default
373
373
 
374
374
  Modify your `src/routes/api/chat/+server.ts` file to include the `stopWhen` condition:
375
375
 
376
- ```ts filename="src/routes/api/chat/+server.ts" highlight="15"
376
+ ```ts filename="src/routes/api/chat/+server.ts" highlight="23"
377
377
  import {
378
378
  createGateway,
379
379
  streamText,
@@ -426,7 +426,7 @@ By setting `stopWhen: stepCountIs(5)`, you're allowing the model to use up to 5
426
426
 
427
427
  Update your `src/routes/api/chat/+server.ts` file to add a new tool to convert the temperature from Fahrenheit to Celsius:
428
428
 
429
- ```tsx filename="src/routes/api/chat/+server.ts" highlight="32-45"
429
+ ```tsx filename="src/routes/api/chat/+server.ts" highlight="38-51"
430
430
  import {
431
431
  createGateway,
432
432
  streamText,
@@ -489,7 +489,7 @@ export async function POST({ request }) {
489
489
 
490
490
  Update your UI to handle the new temperature conversion tool by modifying the tool part handling:
491
491
 
492
- ```svelte filename="src/routes/+page.svelte" highlight="17"
492
+ ```svelte filename="src/routes/+page.svelte" highlight="23-24"
493
493
  <script lang="ts">
494
494
  import { Chat } from '@ai-sdk/svelte';
495
495
 
@@ -258,7 +258,7 @@ Let's enhance your chatbot by adding a simple weather tool.
258
258
 
259
259
  Modify your `server/api/chat.ts` file to include the new weather tool:
260
260
 
261
- ```typescript filename="server/api/chat.ts" highlight="1,16-32"
261
+ ```typescript filename="server/api/chat.ts" highlight="5-8,23-39"
262
262
  import {
263
263
  createGateway,
264
264
  streamText,
@@ -330,7 +330,7 @@ Notice the blank response in the UI? This is because instead of generating a tex
330
330
 
331
331
  To display the tool invocation in your UI, update your `pages/index.vue` file:
332
332
 
333
- ```typescript filename="pages/index.vue" highlight="16-18"
333
+ ```typescript filename="pages/index.vue" highlight="24"
334
334
  <script setup lang="ts">
335
335
  import { Chat } from "@ai-sdk/vue";
336
336
  import { ref } from "vue";
@@ -379,7 +379,7 @@ To solve this, you can enable multi-step tool calls using `stopWhen`. By default
379
379
 
380
380
  Modify your `server/api/chat.ts` file to include the `stopWhen` condition:
381
381
 
382
- ```typescript filename="server/api/chat.ts" highlight="22"
382
+ ```typescript filename="server/api/chat.ts" highlight="24"
383
383
  import {
384
384
  createGateway,
385
385
  streamText,
@@ -436,7 +436,7 @@ By setting `stopWhen: stepCountIs(5)`, you're allowing the model to use up to 5
436
436
 
437
437
  Update your `server/api/chat.ts` file to add a new tool to convert the temperature from Fahrenheit to Celsius:
438
438
 
439
- ```typescript filename="server/api/chat.ts" highlight="32-45"
439
+ ```typescript filename="server/api/chat.ts" highlight="41-54"
440
440
  import {
441
441
  createGateway,
442
442
  streamText,
@@ -503,7 +503,7 @@ export default defineLazyEventHandler(async () => {
503
503
 
504
504
  Update your UI to handle the new temperature conversion tool by modifying the tool part handling:
505
505
 
506
- ```typescript filename="pages/index.vue" highlight="24"
506
+ ```typescript filename="pages/index.vue" highlight="24-29"
507
507
  <script setup lang="ts">
508
508
  import { Chat } from "@ai-sdk/vue";
509
509
  import { ref } from "vue";
@@ -196,7 +196,7 @@ Let's enhance your agent by adding a simple weather tool.
196
196
 
197
197
  Modify your `index.ts` file to include the new weather tool:
198
198
 
199
- ```ts filename="index.ts" highlight="2,4,24-37"
199
+ ```ts filename="index.ts" highlight="2,4,24-38"
200
200
  import { ModelMessage, streamText, tool } from 'ai';
201
201
  __PROVIDER_IMPORT__;
202
202
  import 'dotenv/config';
@@ -339,7 +339,7 @@ To solve this, you can enable multi-step tool calls using `stopWhen`. This featu
339
339
 
340
340
  Modify your `index.ts` file to configure stopping conditions with `stopWhen`:
341
341
 
342
- ```ts filename="index.ts" highlight="38-41"
342
+ ```ts filename="index.ts" highlight="1,40-45"
343
343
  import { ModelMessage, streamText, tool, stepCountIs } from 'ai';
344
344
  __PROVIDER_IMPORT__;
345
345
  import 'dotenv/config';
@@ -415,7 +415,7 @@ By setting `stopWhen: stepCountIs(5)`, you're allowing the agent to use up to 5
415
415
 
416
416
  Update your `index.ts` file to add a new tool to convert the temperature from Celsius to Fahrenheit:
417
417
 
418
- ```ts filename="index.ts" highlight="37-48"
418
+ ```ts filename="index.ts" highlight="39-52"
419
419
  import { ModelMessage, streamText, tool, stepCountIs } from 'ai';
420
420
  __PROVIDER_IMPORT__;
421
421
  import 'dotenv/config';
@@ -382,7 +382,7 @@ Notice the blank response in the UI? This is because instead of generating a tex
382
382
 
383
383
  To display the weather tool invocation in your UI, update your `app/(tabs)/index.tsx` file:
384
384
 
385
- ```tsx filename="app/(tabs)/index.tsx" highlight="31-35"
385
+ ```tsx filename="app/(tabs)/index.tsx" highlight="39-44"
386
386
  import { generateAPIUrl } from '@/utils';
387
387
  import { useChat } from '@ai-sdk/react';
388
388
  import { DefaultChatTransport } from 'ai';
@@ -473,7 +473,7 @@ To solve this, you can enable multi-step tool calls using `stopWhen`. By default
473
473
 
474
474
  Modify your `app/api/chat+api.ts` file to include the `stopWhen` condition:
475
475
 
476
- ```tsx filename="app/api/chat+api.ts" highlight="10"
476
+ ```tsx filename="app/api/chat+api.ts" highlight="17"
477
477
  import {
478
478
  streamText,
479
479
  UIMessage,
@@ -530,7 +530,7 @@ By setting `stopWhen: stepCountIs(5)`, you're allowing the model to use up to 5
530
530
 
531
531
  Update your `app/api/chat+api.ts` file to add a new tool to convert the temperature from Fahrenheit to Celsius:
532
532
 
533
- ```tsx filename="app/api/chat+api.ts" highlight="28-41"
533
+ ```tsx filename="app/api/chat+api.ts" highlight="32-45"
534
534
  import {
535
535
  streamText,
536
536
  UIMessage,
@@ -597,7 +597,7 @@ export async function POST(req: Request) {
597
597
 
598
598
  To display the temperature conversion tool invocation in your UI, update your `app/(tabs)/index.tsx` file to handle the new tool part:
599
599
 
600
- ```tsx filename="app/(tabs)/index.tsx" highlight="37-42"
600
+ ```tsx filename="app/(tabs)/index.tsx" highlight="39-45"
601
601
  import { generateAPIUrl } from '@/utils';
602
602
  import { useChat } from '@ai-sdk/react';
603
603
  import { DefaultChatTransport } from 'ai';
@@ -254,7 +254,7 @@ Let's enhance your chatbot by adding a simple weather tool.
254
254
 
255
255
  Modify your `src/routes/api/chat.ts` file to include the new weather tool:
256
256
 
257
- ```tsx filename="src/routes/api/chat.ts" highlight="2,13-27"
257
+ ```tsx filename="src/routes/api/chat.ts" highlight="2,15-31"
258
258
  import { streamText, UIMessage, convertToModelMessages, tool } from 'ai';
259
259
  __PROVIDER_IMPORT__;
260
260
  import { createFileRoute } from '@tanstack/react-router';
@@ -320,7 +320,7 @@ Notice the blank response in the UI? This is because instead of generating a tex
320
320
 
321
321
  To display the tool invocation in your UI, update your `src/routes/index.tsx` file:
322
322
 
323
- ```tsx filename="src/routes/index.tsx" highlight="16-21"
323
+ ```tsx filename="src/routes/index.tsx" highlight="21-26"
324
324
  import { createFileRoute } from '@tanstack/react-router';
325
325
  import { useChat } from '@ai-sdk/react';
326
326
  import { useState } from 'react';
@@ -443,7 +443,7 @@ By setting `stopWhen: stepCountIs(5)`, you're allowing the model to use up to 5
443
443
 
444
444
  Update your `src/routes/api/chat.ts` file to add a new tool to convert the temperature from Fahrenheit to Celsius:
445
445
 
446
- ```tsx filename="src/routes/api/chat.ts" highlight="34-47"
446
+ ```tsx filename="src/routes/api/chat.ts" highlight="38-51"
447
447
  import {
448
448
  streamText,
449
449
  UIMessage,
@@ -509,7 +509,7 @@ export const Route = createFileRoute('/api/chat')({
509
509
 
510
510
  update your `src/routes/index.tsx` file to render the new temperature conversion tool:
511
511
 
512
- ```tsx filename="src/routes/index.tsx" highlight="21"
512
+ ```tsx filename="src/routes/index.tsx" highlight="21-26"
513
513
  import { createFileRoute } from '@tanstack/react-router';
514
514
  import { useChat } from '@ai-sdk/react';
515
515
  import { useState } from 'react';
@@ -122,7 +122,7 @@ You can use `status` for e.g. the following purposes:
122
122
  - To show a "Stop" button to abort the current message.
123
123
  - To disable the submit button.
124
124
 
125
- ```tsx filename='app/page.tsx' highlight="6,22-29,36"
125
+ ```tsx filename='app/page.tsx' highlight="8,26-33,47,50"
126
126
  'use client';
127
127
 
128
128
  import { useChat } from '@ai-sdk/react';
@@ -192,7 +192,7 @@ It can be used to display an error message, disable the submit button, or show a
192
192
  server.
193
193
  </Note>
194
194
 
195
- ```tsx file="app/page.tsx" highlight="6,20-27,33"
195
+ ```tsx file="app/page.tsx" highlight="8,26-33,47"
196
196
  'use client';
197
197
 
198
198
  import { useChat } from '@ai-sdk/react';
@@ -452,7 +452,7 @@ The request-level options are merged with hook-level options, with request-level
452
452
  You can configure custom `body` fields on a per-request basis using the second parameter of the `sendMessage` function.
453
453
  This is useful if you want to pass in additional information to your backend that is not part of the message list.
454
454
 
455
- ```tsx filename="app/page.tsx" highlight="20-25"
455
+ ```tsx filename="app/page.tsx" highlight="25-32"
456
456
  'use client';
457
457
 
458
458
  import { useChat } from '@ai-sdk/react';
@@ -120,7 +120,7 @@ There are three things worth mentioning:
120
120
  It asks the user for confirmation and displays the result once the user confirms or denies the execution.
121
121
  The result is added to the chat using `addToolOutput` with the `tool` parameter for type safety.
122
122
 
123
- ```tsx filename='app/page.tsx' highlight="2,6,10,14-20"
123
+ ```tsx filename='app/page.tsx' highlight="6,11,16,19-23,25-26,28-33,51,66-70,77-81"
124
124
  'use client';
125
125
 
126
126
  import { useChat } from '@ai-sdk/react';
@@ -62,7 +62,7 @@ You can use the error object to show an error message, disable the submit button
62
62
  server.
63
63
  </Note>
64
64
 
65
- ```tsx file="app/page.tsx" highlight="7,18-25,31"
65
+ ```tsx file="app/page.tsx" highlight="8,28-35,41"
66
66
  'use client';
67
67
 
68
68
  import { useChat } from '@ai-sdk/react';
@@ -115,7 +115,7 @@ export default function Chat() {
115
115
 
116
116
  Alternatively you can write a custom submit handler that replaces the last message when an error is present.
117
117
 
118
- ```tsx file="app/page.tsx" highlight="17-23,35"
118
+ ```tsx file="app/page.tsx" highlight="13-15,17-18,35"
119
119
  'use client';
120
120
 
121
121
  import { useChat } from '@ai-sdk/react';
@@ -40,7 +40,7 @@ export type MyUIMessage = UIMessage<MessageMetadata>;
40
40
 
41
41
  Use the `messageMetadata` callback in `toUIMessageStreamResponse` to send metadata at different streaming stages:
42
42
 
43
- ```ts filename="app/api/chat/route.ts" highlight="11-20"
43
+ ```ts filename="app/api/chat/route.ts" highlight="14-22,24-30"
44
44
  import { convertToModelMessages, streamText } from 'ai';
45
45
  __PROVIDER_IMPORT__;
46
46
  import type { MyUIMessage } from '@/types';
@@ -84,7 +84,7 @@ export async function POST(req: Request) {
84
84
 
85
85
  Access metadata through the `message.metadata` property:
86
86
 
87
- ```tsx filename="app/page.tsx" highlight="8,18-23"
87
+ ```tsx filename="app/page.tsx" highlight="8,20-23,33-36"
88
88
  'use client';
89
89
 
90
90
  import { useChat } from '@ai-sdk/react';
@@ -51,7 +51,7 @@ This will cancel the stream from the client side to the server.
51
51
  both.
52
52
  </Note>
53
53
 
54
- ```tsx file="app/page.tsx" highlight="9,18-20"
54
+ ```tsx file="app/page.tsx" highlight="6,11-14"
55
55
  'use client';
56
56
 
57
57
  import { useCompletion } from '@ai-sdk/react';
@@ -89,7 +89,7 @@ Unlike `onFinish`, which is called when a stream completes normally, `onAbort` i
89
89
  single callback.
90
90
  </Note>
91
91
 
92
- ```tsx highlight="8-12"
92
+ ```tsx highlight="6-9"
93
93
  import { streamText } from 'ai';
94
94
  __PROVIDER_IMPORT__;
95
95
 
@@ -141,7 +141,7 @@ for await (const part of result.fullStream) {
141
141
 
142
142
  When using `toUIMessageStreamResponse`, you need to handle stream abortion slightly differently. The `onFinish` callback receives an `isAborted` parameter, and you should pass the `consumeStream` function to ensure proper abort handling:
143
143
 
144
- ```tsx highlight="5,19,20-24,26"
144
+ ```tsx highlight="3,20-27,29"
145
145
  import { openai } from '@ai-sdk/openai';
146
146
  import {
147
147
  consumeStream,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "6.0.209",
3
+ "version": "6.0.210",
4
4
  "description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -45,9 +45,9 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@opentelemetry/api": "^1.9.0",
48
- "@ai-sdk/gateway": "3.0.134",
49
- "@ai-sdk/provider": "3.0.10",
50
- "@ai-sdk/provider-utils": "4.0.30"
48
+ "@ai-sdk/gateway": "3.0.135",
49
+ "@ai-sdk/provider": "3.0.11",
50
+ "@ai-sdk/provider-utils": "4.0.31"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@edge-runtime/vm": "^5.0.0",
@@ -58,7 +58,7 @@
58
58
  "tsx": "^4.19.2",
59
59
  "typescript": "5.8.3",
60
60
  "zod": "3.25.76",
61
- "@ai-sdk/test-server": "1.0.5",
61
+ "@ai-sdk/test-server": "1.0.6",
62
62
  "@vercel/ai-tsconfig": "0.0.0"
63
63
  },
64
64
  "peerDependencies": {