ai 6.0.78 → 6.0.79
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 +7 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/docs/02-getting-started/02-nextjs-app-router.mdx +5 -5
- package/docs/02-getting-started/03-nextjs-pages-router.mdx +4 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1210,7 +1210,7 @@ var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
|
1210
1210
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1211
1211
|
|
|
1212
1212
|
// src/version.ts
|
|
1213
|
-
var VERSION = true ? "6.0.
|
|
1213
|
+
var VERSION = true ? "6.0.79" : "0.0.0-test";
|
|
1214
1214
|
|
|
1215
1215
|
// src/util/download/download.ts
|
|
1216
1216
|
var download = async ({ url }) => {
|
package/dist/index.mjs
CHANGED
|
@@ -1100,7 +1100,7 @@ import {
|
|
|
1100
1100
|
} from "@ai-sdk/provider-utils";
|
|
1101
1101
|
|
|
1102
1102
|
// src/version.ts
|
|
1103
|
-
var VERSION = true ? "6.0.
|
|
1103
|
+
var VERSION = true ? "6.0.79" : "0.0.0-test";
|
|
1104
1104
|
|
|
1105
1105
|
// src/util/download/download.ts
|
|
1106
1106
|
var download = async ({ url }) => {
|
package/dist/internal/index.js
CHANGED
|
@@ -153,7 +153,7 @@ var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
|
153
153
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
154
154
|
|
|
155
155
|
// src/version.ts
|
|
156
|
-
var VERSION = true ? "6.0.
|
|
156
|
+
var VERSION = true ? "6.0.79" : "0.0.0-test";
|
|
157
157
|
|
|
158
158
|
// src/util/download/download.ts
|
|
159
159
|
var download = async ({ url }) => {
|
package/dist/internal/index.mjs
CHANGED
|
@@ -128,7 +128,7 @@ import {
|
|
|
128
128
|
} from "@ai-sdk/provider-utils";
|
|
129
129
|
|
|
130
130
|
// src/version.ts
|
|
131
|
-
var VERSION = true ? "6.0.
|
|
131
|
+
var VERSION = true ? "6.0.79" : "0.0.0-test";
|
|
132
132
|
|
|
133
133
|
// src/util/download/download.ts
|
|
134
134
|
var download = async ({ url }) => {
|
|
@@ -257,7 +257,7 @@ Let's enhance your chatbot by adding a simple weather tool.
|
|
|
257
257
|
|
|
258
258
|
Modify your `app/api/chat/route.ts` file to include the new weather tool:
|
|
259
259
|
|
|
260
|
-
```tsx filename="app/api/chat/route.ts" highlight="
|
|
260
|
+
```tsx filename="app/api/chat/route.ts" highlight="1,11-25"
|
|
261
261
|
import { streamText, UIMessage, convertToModelMessages, tool } from 'ai';
|
|
262
262
|
__PROVIDER_IMPORT__;
|
|
263
263
|
import { z } from 'zod';
|
|
@@ -314,7 +314,7 @@ Notice the blank response in the UI? This is because instead of generating a tex
|
|
|
314
314
|
|
|
315
315
|
To display the tool invocation in your UI, update your `app/page.tsx` file:
|
|
316
316
|
|
|
317
|
-
```tsx filename="app/page.tsx" highlight="
|
|
317
|
+
```tsx filename="app/page.tsx" highlight="18-22"
|
|
318
318
|
'use client';
|
|
319
319
|
|
|
320
320
|
import { useChat } from '@ai-sdk/react';
|
|
@@ -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"
|
|
379
|
+
```tsx filename="app/api/chat/route.ts" highlight="16"
|
|
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="
|
|
434
|
+
```tsx filename="app/api/chat/route.ts" highlight="31-46"
|
|
435
435
|
import {
|
|
436
436
|
streamText,
|
|
437
437
|
UIMessage,
|
|
@@ -488,7 +488,7 @@ export async function POST(req: Request) {
|
|
|
488
488
|
|
|
489
489
|
update your `app/page.tsx` file to render the new temperature conversion tool:
|
|
490
490
|
|
|
491
|
-
```tsx filename="app/page.tsx" highlight="
|
|
491
|
+
```tsx filename="app/page.tsx" highlight="19"
|
|
492
492
|
'use client';
|
|
493
493
|
|
|
494
494
|
import { useChat } from '@ai-sdk/react';
|
|
@@ -252,7 +252,7 @@ For example, if a user asks about the current weather, without tools, the model
|
|
|
252
252
|
|
|
253
253
|
Let's start by giving your chatbot a weather tool. Update your Route Handler (`app/api/chat/route.ts`):
|
|
254
254
|
|
|
255
|
-
```tsx filename="app/api/chat/route.ts"
|
|
255
|
+
```tsx filename="app/api/chat/route.ts" highlight="1,11-25"
|
|
256
256
|
import { streamText, UIMessage, convertToModelMessages, tool } from 'ai';
|
|
257
257
|
__PROVIDER_IMPORT__;
|
|
258
258
|
import { z } from 'zod';
|
|
@@ -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"
|
|
372
|
+
```tsx filename="app/api/chat/route.ts" highlight="16"
|
|
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="
|
|
419
|
+
```tsx filename="app/api/chat/route.ts" highlight="31-46"
|
|
420
420
|
import {
|
|
421
421
|
streamText,
|
|
422
422
|
UIMessage,
|
|
@@ -473,7 +473,7 @@ export async function POST(req: Request) {
|
|
|
473
473
|
|
|
474
474
|
Update your `pages/index.tsx` file to render the new temperature conversion tool:
|
|
475
475
|
|
|
476
|
-
```tsx filename="pages/index.tsx" highlight="
|
|
476
|
+
```tsx filename="pages/index.tsx" highlight="17"
|
|
477
477
|
import { useChat } from '@ai-sdk/react';
|
|
478
478
|
import { useState } from 'react';
|
|
479
479
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.79",
|
|
4
4
|
"description": "AI SDK by Vercel - The AI Toolkit for TypeScript and JavaScript",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@opentelemetry/api": "1.9.0",
|
|
48
|
-
"@ai-sdk/gateway": "3.0.
|
|
48
|
+
"@ai-sdk/gateway": "3.0.40",
|
|
49
49
|
"@ai-sdk/provider": "3.0.8",
|
|
50
50
|
"@ai-sdk/provider-utils": "4.0.14"
|
|
51
51
|
},
|