ai 6.0.167 → 6.0.169
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 +20 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/docs/03-agents/05-configuring-call-options.mdx +1 -1
- package/docs/03-ai-sdk-core/30-embeddings.mdx +8 -18
- package/docs/04-ai-sdk-ui/03-chatbot-message-persistence.mdx +0 -1
- package/package.json +7 -6
- package/src/ui/validate-ui-messages.ts +9 -0
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.169" : "0.0.0-test";
|
|
157
157
|
|
|
158
158
|
// src/util/download/download.ts
|
|
159
159
|
var download = async ({
|
package/dist/internal/index.mjs
CHANGED
|
@@ -153,7 +153,7 @@ await newsAgent.generate({
|
|
|
153
153
|
Configure provider settings dynamically:
|
|
154
154
|
|
|
155
155
|
```ts
|
|
156
|
-
import {
|
|
156
|
+
import { OpenAILanguageModelResponsesOptions } from '@ai-sdk/openai';
|
|
157
157
|
import { ToolLoopAgent } from 'ai';
|
|
158
158
|
import { z } from 'zod';
|
|
159
159
|
|
|
@@ -16,7 +16,6 @@ You can use it with embeddings models, e.g. `openai.embeddingModel('text-embeddi
|
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
18
|
import { embed } from 'ai';
|
|
19
|
-
import { openai } from '@ai-sdk/openai';
|
|
20
19
|
|
|
21
20
|
// 'embedding' is a single embedding object (number[])
|
|
22
21
|
const { embedding } = await embed({
|
|
@@ -35,7 +34,6 @@ Similar to `embed`, you can use it with embeddings models,
|
|
|
35
34
|
e.g. `openai.embeddingModel('text-embedding-3-large')` or `mistral.embeddingModel('mistral-embed')`.
|
|
36
35
|
|
|
37
36
|
```tsx
|
|
38
|
-
import { openai } from '@ai-sdk/openai';
|
|
39
37
|
import { embedMany } from 'ai';
|
|
40
38
|
|
|
41
39
|
// 'embeddings' is an array of embedding objects (number[][]).
|
|
@@ -56,8 +54,7 @@ After embedding values, you can calculate the similarity between them using the
|
|
|
56
54
|
This is useful to e.g. find similar words or phrases in a dataset.
|
|
57
55
|
You can also rank and filter related items based on their similarity.
|
|
58
56
|
|
|
59
|
-
```ts highlight={"
|
|
60
|
-
import { openai } from '@ai-sdk/openai';
|
|
57
|
+
```ts highlight={"1,9"}
|
|
61
58
|
import { cosineSimilarity, embedMany } from 'ai';
|
|
62
59
|
|
|
63
60
|
const { embeddings } = await embedMany({
|
|
@@ -75,8 +72,7 @@ console.log(
|
|
|
75
72
|
Many providers charge based on the number of tokens used to generate embeddings.
|
|
76
73
|
Both `embed` and `embedMany` provide token usage information in the `usage` property of the result object:
|
|
77
74
|
|
|
78
|
-
```ts highlight={"
|
|
79
|
-
import { openai } from '@ai-sdk/openai';
|
|
75
|
+
```ts highlight={"3,8"}
|
|
80
76
|
import { embed } from 'ai';
|
|
81
77
|
|
|
82
78
|
const { embedding, usage } = await embed({
|
|
@@ -93,8 +89,7 @@ console.log(usage); // { tokens: 10 }
|
|
|
93
89
|
|
|
94
90
|
Embedding model settings can be configured using `providerOptions` for provider-specific parameters:
|
|
95
91
|
|
|
96
|
-
```ts highlight={"
|
|
97
|
-
import { openai } from '@ai-sdk/openai';
|
|
92
|
+
```ts highlight={"4-8"}
|
|
98
93
|
import { embed } from 'ai';
|
|
99
94
|
|
|
100
95
|
const { embedding } = await embed({
|
|
@@ -112,8 +107,7 @@ const { embedding } = await embed({
|
|
|
112
107
|
|
|
113
108
|
The `embedMany` function now supports parallel processing with configurable `maxParallelCalls` to optimize performance:
|
|
114
109
|
|
|
115
|
-
```ts highlight={"
|
|
116
|
-
import { openai } from '@ai-sdk/openai';
|
|
110
|
+
```ts highlight={"3"}
|
|
117
111
|
import { embedMany } from 'ai';
|
|
118
112
|
|
|
119
113
|
const { embeddings, usage } = await embedMany({
|
|
@@ -133,8 +127,7 @@ Both `embed` and `embedMany` accept an optional `maxRetries` parameter of type `
|
|
|
133
127
|
that you can use to set the maximum number of retries for the embedding process.
|
|
134
128
|
It defaults to `2` retries (3 attempts in total). You can set it to `0` to disable retries.
|
|
135
129
|
|
|
136
|
-
```ts highlight={"
|
|
137
|
-
import { openai } from '@ai-sdk/openai';
|
|
130
|
+
```ts highlight={"6"}
|
|
138
131
|
import { embed } from 'ai';
|
|
139
132
|
|
|
140
133
|
const { embedding } = await embed({
|
|
@@ -150,8 +143,7 @@ Both `embed` and `embedMany` accept an optional `abortSignal` parameter of
|
|
|
150
143
|
type [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
|
|
151
144
|
that you can use to abort the embedding process or set a timeout.
|
|
152
145
|
|
|
153
|
-
```ts highlight={"
|
|
154
|
-
import { openai } from '@ai-sdk/openai';
|
|
146
|
+
```ts highlight={"6"}
|
|
155
147
|
import { embed } from 'ai';
|
|
156
148
|
|
|
157
149
|
const { embedding } = await embed({
|
|
@@ -166,8 +158,7 @@ const { embedding } = await embed({
|
|
|
166
158
|
Both `embed` and `embedMany` accept an optional `headers` parameter of type `Record<string, string>`
|
|
167
159
|
that you can use to add custom headers to the embedding request.
|
|
168
160
|
|
|
169
|
-
```ts highlight={"
|
|
170
|
-
import { openai } from '@ai-sdk/openai';
|
|
161
|
+
```ts highlight={"6"}
|
|
171
162
|
import { embed } from 'ai';
|
|
172
163
|
|
|
173
164
|
const { embedding } = await embed({
|
|
@@ -181,8 +172,7 @@ const { embedding } = await embed({
|
|
|
181
172
|
|
|
182
173
|
Both `embed` and `embedMany` return response information that includes the raw provider response:
|
|
183
174
|
|
|
184
|
-
```ts highlight={"
|
|
185
|
-
import { openai } from '@ai-sdk/openai';
|
|
175
|
+
```ts highlight={"3,8"}
|
|
186
176
|
import { embed } from 'ai';
|
|
187
177
|
|
|
188
178
|
const { embedding, response } = await embed({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.169",
|
|
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.
|
|
49
|
-
"@ai-sdk/provider": "3.0.
|
|
50
|
-
"@ai-sdk/provider-utils": "4.0.
|
|
48
|
+
"@ai-sdk/gateway": "3.0.105",
|
|
49
|
+
"@ai-sdk/provider": "3.0.9",
|
|
50
|
+
"@ai-sdk/provider-utils": "4.0.24"
|
|
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.
|
|
61
|
+
"@ai-sdk/test-server": "1.0.4",
|
|
62
62
|
"@vercel/ai-tsconfig": "0.0.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
@@ -73,7 +73,8 @@
|
|
|
73
73
|
"homepage": "https://ai-sdk.dev/docs",
|
|
74
74
|
"repository": {
|
|
75
75
|
"type": "git",
|
|
76
|
-
"url": "
|
|
76
|
+
"url": "https://github.com/vercel/ai",
|
|
77
|
+
"directory": "packages/ai"
|
|
77
78
|
},
|
|
78
79
|
"bugs": {
|
|
79
80
|
"url": "https://github.com/vercel/ai/issues"
|
|
@@ -405,6 +405,15 @@ export async function safeValidateUIMessages<UI_MESSAGE extends UIMessage>({
|
|
|
405
405
|
const toolName = toolPart.type.slice(5);
|
|
406
406
|
const tool = tools[toolName];
|
|
407
407
|
|
|
408
|
+
if (
|
|
409
|
+
!tool &&
|
|
410
|
+
(toolPart.state === 'output-available' ||
|
|
411
|
+
toolPart.state === 'output-error' ||
|
|
412
|
+
toolPart.state === 'output-denied')
|
|
413
|
+
) {
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
|
|
408
417
|
// TODO support dynamic tools
|
|
409
418
|
if (!tool) {
|
|
410
419
|
return {
|