ai 5.0.0-canary.20 → 5.0.0-canary.21
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 +51 -0
- package/dist/index.d.mts +467 -512
- package/dist/index.d.ts +467 -512
- package/dist/index.js +989 -1411
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +947 -1368
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +7 -13
- package/dist/internal/index.d.ts +7 -13
- package/dist/internal/index.js +126 -126
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +119 -119
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { ToolResultContent, Schema, ToolCall, ToolResult, IdGenerator, FetchFunction } from '@ai-sdk/provider-utils';
|
2
2
|
export { IdGenerator, Schema, ToolCall, ToolResult, asSchema, createIdGenerator, generateId, jsonSchema } from '@ai-sdk/provider-utils';
|
3
3
|
import { z } from 'zod';
|
4
4
|
import { ServerResponse } from 'node:http';
|
@@ -16,15 +16,6 @@ declare const dataStreamPartSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject
|
|
16
16
|
}, {
|
17
17
|
type: "text";
|
18
18
|
value: string;
|
19
|
-
}>, z.ZodObject<{
|
20
|
-
type: z.ZodLiteral<"data">;
|
21
|
-
value: z.ZodArray<z.ZodAny, "many">;
|
22
|
-
}, "strip", z.ZodTypeAny, {
|
23
|
-
type: "data";
|
24
|
-
value: any[];
|
25
|
-
}, {
|
26
|
-
type: "data";
|
27
|
-
value: any[];
|
28
19
|
}>, z.ZodObject<{
|
29
20
|
type: z.ZodLiteral<"error">;
|
30
21
|
value: z.ZodString;
|
@@ -34,15 +25,6 @@ declare const dataStreamPartSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject
|
|
34
25
|
}, {
|
35
26
|
type: "error";
|
36
27
|
value: string;
|
37
|
-
}>, z.ZodObject<{
|
38
|
-
type: z.ZodLiteral<"message-annotations">;
|
39
|
-
value: z.ZodArray<z.ZodAny, "many">;
|
40
|
-
}, "strip", z.ZodTypeAny, {
|
41
|
-
type: "message-annotations";
|
42
|
-
value: any[];
|
43
|
-
}, {
|
44
|
-
type: "message-annotations";
|
45
|
-
value: any[];
|
46
28
|
}>, z.ZodObject<{
|
47
29
|
type: z.ZodLiteral<"tool-call">;
|
48
30
|
value: z.ZodObject<{
|
@@ -149,162 +131,6 @@ declare const dataStreamPartSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject
|
|
149
131
|
toolCallId: string;
|
150
132
|
argsTextDelta: string;
|
151
133
|
};
|
152
|
-
}>, z.ZodObject<{
|
153
|
-
type: z.ZodLiteral<"finish-message">;
|
154
|
-
value: z.ZodObject<{
|
155
|
-
finishReason: z.ZodEnum<["stop", "length", "tool-calls", "content-filter", "other", "error", "unknown"]>;
|
156
|
-
usage: z.ZodOptional<z.ZodObject<{
|
157
|
-
inputTokens: z.ZodOptional<z.ZodNumber>;
|
158
|
-
outputTokens: z.ZodOptional<z.ZodNumber>;
|
159
|
-
totalTokens: z.ZodOptional<z.ZodNumber>;
|
160
|
-
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
161
|
-
cachedInputTokens: z.ZodOptional<z.ZodNumber>;
|
162
|
-
}, "strip", z.ZodTypeAny, {
|
163
|
-
inputTokens?: number | undefined;
|
164
|
-
outputTokens?: number | undefined;
|
165
|
-
totalTokens?: number | undefined;
|
166
|
-
reasoningTokens?: number | undefined;
|
167
|
-
cachedInputTokens?: number | undefined;
|
168
|
-
}, {
|
169
|
-
inputTokens?: number | undefined;
|
170
|
-
outputTokens?: number | undefined;
|
171
|
-
totalTokens?: number | undefined;
|
172
|
-
reasoningTokens?: number | undefined;
|
173
|
-
cachedInputTokens?: number | undefined;
|
174
|
-
}>>;
|
175
|
-
}, "strip", z.ZodTypeAny, {
|
176
|
-
finishReason: "length" | "stop" | "tool-calls" | "content-filter" | "other" | "error" | "unknown";
|
177
|
-
usage?: {
|
178
|
-
inputTokens?: number | undefined;
|
179
|
-
outputTokens?: number | undefined;
|
180
|
-
totalTokens?: number | undefined;
|
181
|
-
reasoningTokens?: number | undefined;
|
182
|
-
cachedInputTokens?: number | undefined;
|
183
|
-
} | undefined;
|
184
|
-
}, {
|
185
|
-
finishReason: "length" | "stop" | "tool-calls" | "content-filter" | "other" | "error" | "unknown";
|
186
|
-
usage?: {
|
187
|
-
inputTokens?: number | undefined;
|
188
|
-
outputTokens?: number | undefined;
|
189
|
-
totalTokens?: number | undefined;
|
190
|
-
reasoningTokens?: number | undefined;
|
191
|
-
cachedInputTokens?: number | undefined;
|
192
|
-
} | undefined;
|
193
|
-
}>;
|
194
|
-
}, "strip", z.ZodTypeAny, {
|
195
|
-
type: "finish-message";
|
196
|
-
value: {
|
197
|
-
finishReason: "length" | "stop" | "tool-calls" | "content-filter" | "other" | "error" | "unknown";
|
198
|
-
usage?: {
|
199
|
-
inputTokens?: number | undefined;
|
200
|
-
outputTokens?: number | undefined;
|
201
|
-
totalTokens?: number | undefined;
|
202
|
-
reasoningTokens?: number | undefined;
|
203
|
-
cachedInputTokens?: number | undefined;
|
204
|
-
} | undefined;
|
205
|
-
};
|
206
|
-
}, {
|
207
|
-
type: "finish-message";
|
208
|
-
value: {
|
209
|
-
finishReason: "length" | "stop" | "tool-calls" | "content-filter" | "other" | "error" | "unknown";
|
210
|
-
usage?: {
|
211
|
-
inputTokens?: number | undefined;
|
212
|
-
outputTokens?: number | undefined;
|
213
|
-
totalTokens?: number | undefined;
|
214
|
-
reasoningTokens?: number | undefined;
|
215
|
-
cachedInputTokens?: number | undefined;
|
216
|
-
} | undefined;
|
217
|
-
};
|
218
|
-
}>, z.ZodObject<{
|
219
|
-
type: z.ZodLiteral<"finish-step">;
|
220
|
-
value: z.ZodObject<{
|
221
|
-
isContinued: z.ZodBoolean;
|
222
|
-
finishReason: z.ZodEnum<["stop", "length", "tool-calls", "content-filter", "other", "error", "unknown"]>;
|
223
|
-
usage: z.ZodOptional<z.ZodObject<{
|
224
|
-
inputTokens: z.ZodOptional<z.ZodNumber>;
|
225
|
-
outputTokens: z.ZodOptional<z.ZodNumber>;
|
226
|
-
totalTokens: z.ZodOptional<z.ZodNumber>;
|
227
|
-
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
228
|
-
cachedInputTokens: z.ZodOptional<z.ZodNumber>;
|
229
|
-
}, "strip", z.ZodTypeAny, {
|
230
|
-
inputTokens?: number | undefined;
|
231
|
-
outputTokens?: number | undefined;
|
232
|
-
totalTokens?: number | undefined;
|
233
|
-
reasoningTokens?: number | undefined;
|
234
|
-
cachedInputTokens?: number | undefined;
|
235
|
-
}, {
|
236
|
-
inputTokens?: number | undefined;
|
237
|
-
outputTokens?: number | undefined;
|
238
|
-
totalTokens?: number | undefined;
|
239
|
-
reasoningTokens?: number | undefined;
|
240
|
-
cachedInputTokens?: number | undefined;
|
241
|
-
}>>;
|
242
|
-
}, "strip", z.ZodTypeAny, {
|
243
|
-
finishReason: "length" | "stop" | "tool-calls" | "content-filter" | "other" | "error" | "unknown";
|
244
|
-
isContinued: boolean;
|
245
|
-
usage?: {
|
246
|
-
inputTokens?: number | undefined;
|
247
|
-
outputTokens?: number | undefined;
|
248
|
-
totalTokens?: number | undefined;
|
249
|
-
reasoningTokens?: number | undefined;
|
250
|
-
cachedInputTokens?: number | undefined;
|
251
|
-
} | undefined;
|
252
|
-
}, {
|
253
|
-
finishReason: "length" | "stop" | "tool-calls" | "content-filter" | "other" | "error" | "unknown";
|
254
|
-
isContinued: boolean;
|
255
|
-
usage?: {
|
256
|
-
inputTokens?: number | undefined;
|
257
|
-
outputTokens?: number | undefined;
|
258
|
-
totalTokens?: number | undefined;
|
259
|
-
reasoningTokens?: number | undefined;
|
260
|
-
cachedInputTokens?: number | undefined;
|
261
|
-
} | undefined;
|
262
|
-
}>;
|
263
|
-
}, "strip", z.ZodTypeAny, {
|
264
|
-
type: "finish-step";
|
265
|
-
value: {
|
266
|
-
finishReason: "length" | "stop" | "tool-calls" | "content-filter" | "other" | "error" | "unknown";
|
267
|
-
isContinued: boolean;
|
268
|
-
usage?: {
|
269
|
-
inputTokens?: number | undefined;
|
270
|
-
outputTokens?: number | undefined;
|
271
|
-
totalTokens?: number | undefined;
|
272
|
-
reasoningTokens?: number | undefined;
|
273
|
-
cachedInputTokens?: number | undefined;
|
274
|
-
} | undefined;
|
275
|
-
};
|
276
|
-
}, {
|
277
|
-
type: "finish-step";
|
278
|
-
value: {
|
279
|
-
finishReason: "length" | "stop" | "tool-calls" | "content-filter" | "other" | "error" | "unknown";
|
280
|
-
isContinued: boolean;
|
281
|
-
usage?: {
|
282
|
-
inputTokens?: number | undefined;
|
283
|
-
outputTokens?: number | undefined;
|
284
|
-
totalTokens?: number | undefined;
|
285
|
-
reasoningTokens?: number | undefined;
|
286
|
-
cachedInputTokens?: number | undefined;
|
287
|
-
} | undefined;
|
288
|
-
};
|
289
|
-
}>, z.ZodObject<{
|
290
|
-
type: z.ZodLiteral<"start-step">;
|
291
|
-
value: z.ZodObject<{
|
292
|
-
messageId: z.ZodString;
|
293
|
-
}, "strip", z.ZodTypeAny, {
|
294
|
-
messageId: string;
|
295
|
-
}, {
|
296
|
-
messageId: string;
|
297
|
-
}>;
|
298
|
-
}, "strip", z.ZodTypeAny, {
|
299
|
-
type: "start-step";
|
300
|
-
value: {
|
301
|
-
messageId: string;
|
302
|
-
};
|
303
|
-
}, {
|
304
|
-
type: "start-step";
|
305
|
-
value: {
|
306
|
-
messageId: string;
|
307
|
-
};
|
308
134
|
}>, z.ZodObject<{
|
309
135
|
type: z.ZodLiteral<"reasoning">;
|
310
136
|
value: z.ZodObject<{
|
@@ -397,6 +223,106 @@ declare const dataStreamPartSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject
|
|
397
223
|
url: string;
|
398
224
|
mediaType: string;
|
399
225
|
};
|
226
|
+
}>, z.ZodObject<{
|
227
|
+
type: z.ZodLiteral<"metadata">;
|
228
|
+
value: z.ZodObject<{
|
229
|
+
metadata: z.ZodUnknown;
|
230
|
+
}, "strip", z.ZodTypeAny, {
|
231
|
+
metadata?: unknown;
|
232
|
+
}, {
|
233
|
+
metadata?: unknown;
|
234
|
+
}>;
|
235
|
+
}, "strip", z.ZodTypeAny, {
|
236
|
+
type: "metadata";
|
237
|
+
value: {
|
238
|
+
metadata?: unknown;
|
239
|
+
};
|
240
|
+
}, {
|
241
|
+
type: "metadata";
|
242
|
+
value: {
|
243
|
+
metadata?: unknown;
|
244
|
+
};
|
245
|
+
}>, z.ZodObject<{
|
246
|
+
type: z.ZodLiteral<"start-step">;
|
247
|
+
value: z.ZodObject<{
|
248
|
+
metadata: z.ZodUnknown;
|
249
|
+
}, "strip", z.ZodTypeAny, {
|
250
|
+
metadata?: unknown;
|
251
|
+
}, {
|
252
|
+
metadata?: unknown;
|
253
|
+
}>;
|
254
|
+
}, "strip", z.ZodTypeAny, {
|
255
|
+
type: "start-step";
|
256
|
+
value: {
|
257
|
+
metadata?: unknown;
|
258
|
+
};
|
259
|
+
}, {
|
260
|
+
type: "start-step";
|
261
|
+
value: {
|
262
|
+
metadata?: unknown;
|
263
|
+
};
|
264
|
+
}>, z.ZodObject<{
|
265
|
+
type: z.ZodLiteral<"finish-step">;
|
266
|
+
value: z.ZodObject<{
|
267
|
+
metadata: z.ZodUnknown;
|
268
|
+
}, "strip", z.ZodTypeAny, {
|
269
|
+
metadata?: unknown;
|
270
|
+
}, {
|
271
|
+
metadata?: unknown;
|
272
|
+
}>;
|
273
|
+
}, "strip", z.ZodTypeAny, {
|
274
|
+
type: "finish-step";
|
275
|
+
value: {
|
276
|
+
metadata?: unknown;
|
277
|
+
};
|
278
|
+
}, {
|
279
|
+
type: "finish-step";
|
280
|
+
value: {
|
281
|
+
metadata?: unknown;
|
282
|
+
};
|
283
|
+
}>, z.ZodObject<{
|
284
|
+
type: z.ZodLiteral<"start">;
|
285
|
+
value: z.ZodObject<{
|
286
|
+
messageId: z.ZodOptional<z.ZodString>;
|
287
|
+
metadata: z.ZodUnknown;
|
288
|
+
}, "strip", z.ZodTypeAny, {
|
289
|
+
metadata?: unknown;
|
290
|
+
messageId?: string | undefined;
|
291
|
+
}, {
|
292
|
+
metadata?: unknown;
|
293
|
+
messageId?: string | undefined;
|
294
|
+
}>;
|
295
|
+
}, "strip", z.ZodTypeAny, {
|
296
|
+
type: "start";
|
297
|
+
value: {
|
298
|
+
metadata?: unknown;
|
299
|
+
messageId?: string | undefined;
|
300
|
+
};
|
301
|
+
}, {
|
302
|
+
type: "start";
|
303
|
+
value: {
|
304
|
+
metadata?: unknown;
|
305
|
+
messageId?: string | undefined;
|
306
|
+
};
|
307
|
+
}>, z.ZodObject<{
|
308
|
+
type: z.ZodLiteral<"finish">;
|
309
|
+
value: z.ZodObject<{
|
310
|
+
metadata: z.ZodUnknown;
|
311
|
+
}, "strip", z.ZodTypeAny, {
|
312
|
+
metadata?: unknown;
|
313
|
+
}, {
|
314
|
+
metadata?: unknown;
|
315
|
+
}>;
|
316
|
+
}, "strip", z.ZodTypeAny, {
|
317
|
+
type: "finish";
|
318
|
+
value: {
|
319
|
+
metadata?: unknown;
|
320
|
+
};
|
321
|
+
}, {
|
322
|
+
type: "finish";
|
323
|
+
value: {
|
324
|
+
metadata?: unknown;
|
325
|
+
};
|
400
326
|
}>, z.ZodObject<{
|
401
327
|
type: z.ZodLiteral<"reasoning-part-finish">;
|
402
328
|
value: z.ZodNull;
|
@@ -440,51 +366,6 @@ declare function pipeDataStreamToResponse({ response, status, statusText, header
|
|
440
366
|
dataStream: ReadableStream<DataStreamPart>;
|
441
367
|
} & ResponseInit): void;
|
442
368
|
|
443
|
-
declare function processDataStream({ stream, onTextPart, onReasoningPart, onReasoningPartFinish, onSourcePart, onFilePart, onDataPart, onErrorPart, onToolCallStreamingStartPart, onToolCallDeltaPart, onToolCallPart, onToolResultPart, onMessageAnnotationsPart, onFinishMessagePart, onFinishStepPart, onStartStepPart, }: {
|
444
|
-
stream: ReadableStream<Uint8Array>;
|
445
|
-
onTextPart?: (streamPart: (DataStreamPart & {
|
446
|
-
type: 'text';
|
447
|
-
})['value']) => Promise<void> | void;
|
448
|
-
onReasoningPart?: (streamPart: (DataStreamPart & {
|
449
|
-
type: 'reasoning';
|
450
|
-
})['value']) => Promise<void> | void;
|
451
|
-
onReasoningPartFinish?: (streamPart: (DataStreamPart & {
|
452
|
-
type: 'reasoning-part-finish';
|
453
|
-
})['value']) => Promise<void> | void;
|
454
|
-
onFilePart?: (streamPart: (DataStreamPart & {
|
455
|
-
type: 'file';
|
456
|
-
})['value']) => Promise<void> | void;
|
457
|
-
onSourcePart?: (streamPart: (DataStreamPart & {
|
458
|
-
type: 'source';
|
459
|
-
})['value']) => Promise<void> | void;
|
460
|
-
onDataPart?: (streamPart: (DataStreamPart & {
|
461
|
-
type: 'data';
|
462
|
-
})['value']) => Promise<void> | void;
|
463
|
-
onErrorPart?: (streamPart: (DataStreamPart & {
|
464
|
-
type: 'error';
|
465
|
-
})['value']) => Promise<void> | void;
|
466
|
-
onToolCallStreamingStartPart?: (streamPart: (DataStreamPart & {
|
467
|
-
type: 'tool-call-streaming-start';
|
468
|
-
})['value']) => Promise<void> | void;
|
469
|
-
onToolCallDeltaPart?: (streamPart: (DataStreamPart & {
|
470
|
-
type: 'tool-call-delta';
|
471
|
-
})['value']) => Promise<void> | void;
|
472
|
-
onToolCallPart?: (streamPart: ToolCall<string, any>) => Promise<void> | void;
|
473
|
-
onToolResultPart?: (streamPart: ToolResult<string, any, any>) => Promise<void> | void;
|
474
|
-
onMessageAnnotationsPart?: (streamPart: (DataStreamPart & {
|
475
|
-
type: 'message-annotations';
|
476
|
-
})['value']) => Promise<void> | void;
|
477
|
-
onFinishMessagePart?: (streamPart: (DataStreamPart & {
|
478
|
-
type: 'finish-message';
|
479
|
-
})['value']) => Promise<void> | void;
|
480
|
-
onFinishStepPart?: (streamPart: (DataStreamPart & {
|
481
|
-
type: 'finish-step';
|
482
|
-
})['value']) => Promise<void> | void;
|
483
|
-
onStartStepPart?: (streamPart: (DataStreamPart & {
|
484
|
-
type: 'start-step';
|
485
|
-
})['value']) => Promise<void> | void;
|
486
|
-
}): Promise<void>;
|
487
|
-
|
488
369
|
declare class JsonToSseTransformStream extends TransformStream<unknown, string> {
|
489
370
|
constructor();
|
490
371
|
}
|
@@ -1165,20 +1046,20 @@ declare const JSONRPCErrorSchema: z.ZodObject<{
|
|
1165
1046
|
data?: unknown;
|
1166
1047
|
}>;
|
1167
1048
|
}, "strict", z.ZodTypeAny, {
|
1049
|
+
id: string | number;
|
1168
1050
|
error: {
|
1169
1051
|
code: number;
|
1170
1052
|
message: string;
|
1171
1053
|
data?: unknown;
|
1172
1054
|
};
|
1173
|
-
id: string | number;
|
1174
1055
|
jsonrpc: "2.0";
|
1175
1056
|
}, {
|
1057
|
+
id: string | number;
|
1176
1058
|
error: {
|
1177
1059
|
code: number;
|
1178
1060
|
message: string;
|
1179
1061
|
data?: unknown;
|
1180
1062
|
};
|
1181
|
-
id: string | number;
|
1182
1063
|
jsonrpc: "2.0";
|
1183
1064
|
}>;
|
1184
1065
|
type JSONRPCError = z.infer<typeof JSONRPCErrorSchema>;
|
@@ -1299,20 +1180,20 @@ declare const JSONRPCMessageSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendS
|
|
1299
1180
|
data?: unknown;
|
1300
1181
|
}>;
|
1301
1182
|
}, "strict", z.ZodTypeAny, {
|
1183
|
+
id: string | number;
|
1302
1184
|
error: {
|
1303
1185
|
code: number;
|
1304
1186
|
message: string;
|
1305
1187
|
data?: unknown;
|
1306
1188
|
};
|
1307
|
-
id: string | number;
|
1308
1189
|
jsonrpc: "2.0";
|
1309
1190
|
}, {
|
1191
|
+
id: string | number;
|
1310
1192
|
error: {
|
1311
1193
|
code: number;
|
1312
1194
|
message: string;
|
1313
1195
|
data?: unknown;
|
1314
1196
|
};
|
1315
|
-
id: string | number;
|
1316
1197
|
jsonrpc: "2.0";
|
1317
1198
|
}>]>;
|
1318
1199
|
type JSONRPCMessage = z.infer<typeof JSONRPCMessageSchema>;
|
@@ -2228,6 +2109,39 @@ type ToolCallUnion<TOOLS extends ToolSet> = ValueOf<{
|
|
2228
2109
|
}>;
|
2229
2110
|
type ToolCallArray<TOOLS extends ToolSet> = Array<ToolCallUnion<TOOLS>>;
|
2230
2111
|
|
2112
|
+
type ToToolsWithDefinedExecute<TOOLS extends ToolSet> = {
|
2113
|
+
[K in keyof TOOLS as TOOLS[K]['execute'] extends undefined ? never : K]: TOOLS[K];
|
2114
|
+
};
|
2115
|
+
type ToToolResultObject<TOOLS extends ToolSet> = ValueOf<{
|
2116
|
+
[NAME in keyof TOOLS]: {
|
2117
|
+
type: 'tool-result';
|
2118
|
+
toolCallId: string;
|
2119
|
+
toolName: NAME & string;
|
2120
|
+
args: TOOLS[NAME] extends Tool<infer P> ? P : never;
|
2121
|
+
result: Awaited<ReturnType<Exclude<TOOLS[NAME]['execute'], undefined>>>;
|
2122
|
+
};
|
2123
|
+
}>;
|
2124
|
+
type ToolResultUnion<TOOLS extends ToolSet> = ToToolResultObject<ToToolsWithDefinedExecute<TOOLS>>;
|
2125
|
+
type ToolResultArray<TOOLS extends ToolSet> = Array<ToolResultUnion<TOOLS>>;
|
2126
|
+
|
2127
|
+
type ContentPart<TOOLS extends ToolSet> = {
|
2128
|
+
type: 'text';
|
2129
|
+
text: string;
|
2130
|
+
} | {
|
2131
|
+
type: 'reasoning';
|
2132
|
+
text: string;
|
2133
|
+
providerMetadata?: ProviderMetadata;
|
2134
|
+
} | ({
|
2135
|
+
type: 'source';
|
2136
|
+
} & Source) | {
|
2137
|
+
type: 'file';
|
2138
|
+
file: GeneratedFile;
|
2139
|
+
} | ({
|
2140
|
+
type: 'tool-call';
|
2141
|
+
} & ToolCallUnion<TOOLS>) | ({
|
2142
|
+
type: 'tool-result';
|
2143
|
+
} & ToolResultUnion<TOOLS>);
|
2144
|
+
|
2231
2145
|
declare const symbol$e: unique symbol;
|
2232
2146
|
declare class InvalidToolArgumentsError extends AISDKError {
|
2233
2147
|
private readonly [symbol$e];
|
@@ -2261,15 +2175,11 @@ type CallSettings = {
|
|
2261
2175
|
*/
|
2262
2176
|
maxOutputTokens?: number;
|
2263
2177
|
/**
|
2264
|
-
Temperature setting.
|
2265
|
-
1 (very random).
|
2178
|
+
Temperature setting. The range depends on the provider and model.
|
2266
2179
|
|
2267
2180
|
It is recommended to set either `temperature` or `topP`, but not both.
|
2268
|
-
Use `null` to use the provider's default temperature.
|
2269
|
-
|
2270
|
-
@default 0
|
2271
2181
|
*/
|
2272
|
-
temperature?: number
|
2182
|
+
temperature?: number;
|
2273
2183
|
/**
|
2274
2184
|
Nucleus sampling. This is a number between 0 and 1.
|
2275
2185
|
|
@@ -2377,41 +2287,12 @@ type ToolCallRepairFunction<TOOLS extends ToolSet> = (options: {
|
|
2377
2287
|
error: NoSuchToolError | InvalidToolArgumentsError;
|
2378
2288
|
}) => Promise<LanguageModelV2ToolCall | null>;
|
2379
2289
|
|
2380
|
-
type
|
2381
|
-
[K in keyof TOOLS as TOOLS[K]['execute'] extends undefined ? never : K]: TOOLS[K];
|
2382
|
-
};
|
2383
|
-
type ToToolResultObject<TOOLS extends ToolSet> = ValueOf<{
|
2384
|
-
[NAME in keyof TOOLS]: {
|
2385
|
-
type: 'tool-result';
|
2386
|
-
toolCallId: string;
|
2387
|
-
toolName: NAME & string;
|
2388
|
-
args: TOOLS[NAME] extends Tool<infer P> ? P : never;
|
2389
|
-
result: Awaited<ReturnType<Exclude<TOOLS[NAME]['execute'], undefined>>>;
|
2390
|
-
};
|
2391
|
-
}>;
|
2392
|
-
type ToolResultUnion<TOOLS extends ToolSet> = ToToolResultObject<ToToolsWithDefinedExecute<TOOLS>>;
|
2393
|
-
type ToolResultArray<TOOLS extends ToolSet> = Array<ToolResultUnion<TOOLS>>;
|
2394
|
-
|
2395
|
-
type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
2290
|
+
type SingleRequestTextStreamPart<TOOLS extends ToolSet> = ContentPart<TOOLS> | {
|
2396
2291
|
type: 'stream-start';
|
2397
2292
|
warnings: LanguageModelV2CallWarning[];
|
2398
|
-
} | {
|
2399
|
-
type: 'text';
|
2400
|
-
text: string;
|
2401
|
-
} | {
|
2402
|
-
type: 'reasoning';
|
2403
|
-
text: string;
|
2404
|
-
providerMetadata?: ProviderMetadata;
|
2405
2293
|
} | {
|
2406
2294
|
type: 'reasoning-part-finish';
|
2407
2295
|
} | {
|
2408
|
-
type: 'file';
|
2409
|
-
file: GeneratedFile;
|
2410
|
-
} | ({
|
2411
|
-
type: 'source';
|
2412
|
-
} & Source) | ({
|
2413
|
-
type: 'tool-call';
|
2414
|
-
} & ToolCallUnion<TOOLS>) | {
|
2415
2296
|
type: 'tool-call-streaming-start';
|
2416
2297
|
toolCallId: string;
|
2417
2298
|
toolName: string;
|
@@ -2420,9 +2301,7 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
2420
2301
|
toolCallId: string;
|
2421
2302
|
toolName: string;
|
2422
2303
|
argsTextDelta: string;
|
2423
|
-
} |
|
2424
|
-
type: 'tool-result';
|
2425
|
-
} & ToolResultUnion<TOOLS>) | {
|
2304
|
+
} | {
|
2426
2305
|
type: 'response-metadata';
|
2427
2306
|
id?: string;
|
2428
2307
|
timestamp?: Date;
|
@@ -2609,23 +2488,19 @@ type ToolInvocation = ({
|
|
2609
2488
|
/**
|
2610
2489
|
* AI SDK UI Messages. They are used in the client and to communicate between the frontend and the API routes.
|
2611
2490
|
*/
|
2612
|
-
interface UIMessage {
|
2491
|
+
interface UIMessage<METADATA = unknown> {
|
2613
2492
|
/**
|
2614
2493
|
A unique identifier for the message.
|
2615
2494
|
*/
|
2616
2495
|
id: string;
|
2617
2496
|
/**
|
2618
|
-
The timestamp of the message.
|
2619
|
-
*/
|
2620
|
-
createdAt?: Date;
|
2621
|
-
/**
|
2622
2497
|
The role of the message.
|
2623
2498
|
*/
|
2624
2499
|
role: 'system' | 'user' | 'assistant';
|
2625
2500
|
/**
|
2626
|
-
|
2501
|
+
The metadata of the message.
|
2627
2502
|
*/
|
2628
|
-
|
2503
|
+
metadata?: METADATA;
|
2629
2504
|
/**
|
2630
2505
|
The parts of the message. Use this for rendering the message in the UI.
|
2631
2506
|
|
@@ -2710,8 +2585,8 @@ type FileUIPart = {
|
|
2710
2585
|
type StepStartUIPart = {
|
2711
2586
|
type: 'step-start';
|
2712
2587
|
};
|
2713
|
-
type CreateUIMessage = Omit<UIMessage
|
2714
|
-
id?: UIMessage['id'];
|
2588
|
+
type CreateUIMessage<METADATA = unknown> = Omit<UIMessage<METADATA>, 'id'> & {
|
2589
|
+
id?: UIMessage<METADATA>['id'];
|
2715
2590
|
};
|
2716
2591
|
|
2717
2592
|
declare const symbol$3: unique symbol;
|
@@ -2773,173 +2648,47 @@ declare function pipeTextStreamToResponse({ response, status, statusText, header
|
|
2773
2648
|
declare function appendClientMessage({ messages, message, }: {
|
2774
2649
|
messages: UIMessage[];
|
2775
2650
|
message: UIMessage;
|
2776
|
-
}): UIMessage[];
|
2777
|
-
|
2778
|
-
type ContentPart<TOOLS extends ToolSet> = {
|
2779
|
-
type: 'text';
|
2780
|
-
text: string;
|
2781
|
-
} | {
|
2782
|
-
type: 'reasoning';
|
2783
|
-
text: string;
|
2784
|
-
providerMetadata?: ProviderMetadata;
|
2785
|
-
} | ({
|
2786
|
-
type: 'source';
|
2787
|
-
} & Source) | {
|
2788
|
-
type: 'file';
|
2789
|
-
file: GeneratedFile;
|
2790
|
-
} | ({
|
2791
|
-
type: 'tool-call';
|
2792
|
-
} & ToolCallUnion<TOOLS>) | ({
|
2793
|
-
type: 'tool-result';
|
2794
|
-
} & ToolResultUnion<TOOLS>);
|
2651
|
+
}): UIMessage<unknown>[];
|
2795
2652
|
|
2796
|
-
|
2797
|
-
A message that was generated during the generation process.
|
2798
|
-
It can be either an assistant message or a tool message.
|
2799
|
-
*/
|
2800
|
-
type ResponseMessage = (AssistantModelMessage | ToolModelMessage) & {
|
2653
|
+
type ChatRequestOptions = {
|
2801
2654
|
/**
|
2802
|
-
|
2655
|
+
Additional headers that should be to be passed to the API endpoint.
|
2803
2656
|
*/
|
2804
|
-
|
2805
|
-
};
|
2806
|
-
/**
|
2807
|
-
* The result of a single step in the generation process.
|
2808
|
-
*/
|
2809
|
-
type StepResult<TOOLS extends ToolSet> = {
|
2657
|
+
headers?: Record<string, string> | Headers;
|
2810
2658
|
/**
|
2811
|
-
|
2659
|
+
Additional body JSON properties that should be sent to the API endpoint.
|
2812
2660
|
*/
|
2813
|
-
|
2814
|
-
/**
|
2815
|
-
The generated text.
|
2816
|
-
*/
|
2817
|
-
readonly text: string;
|
2661
|
+
body?: object;
|
2818
2662
|
/**
|
2819
|
-
|
2820
|
-
|
2821
|
-
|
2663
|
+
Additional data to be sent to the API endpoint.
|
2664
|
+
*/
|
2665
|
+
data?: JSONValue$1;
|
2822
2666
|
/**
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2667
|
+
* Allow submitting an empty message. Defaults to `false`.
|
2668
|
+
*/
|
2669
|
+
allowEmptySubmit?: boolean;
|
2670
|
+
};
|
2671
|
+
type UseChatOptions<MESSAGE_METADATA = unknown> = {
|
2826
2672
|
/**
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2673
|
+
* Schema for the message metadata. Validates the message metadata.
|
2674
|
+
* Message metadata can be undefined or must match the schema.
|
2675
|
+
*/
|
2676
|
+
messageMetadataSchema?: Schema<MESSAGE_METADATA>;
|
2830
2677
|
/**
|
2831
|
-
|
2832
|
-
|
2833
|
-
|
2678
|
+
* The API endpoint that accepts a `{ messages: Message[] }` object and returns
|
2679
|
+
* a stream of tokens of the AI chat response. Defaults to `/api/chat`.
|
2680
|
+
*/
|
2681
|
+
api?: string;
|
2834
2682
|
/**
|
2835
|
-
|
2836
|
-
|
2837
|
-
|
2838
|
-
|
2839
|
-
|
2840
|
-
*/
|
2841
|
-
readonly toolResults: ToolResultArray<TOOLS>;
|
2842
|
-
/**
|
2843
|
-
The reason why the generation finished.
|
2844
|
-
*/
|
2845
|
-
readonly finishReason: FinishReason;
|
2846
|
-
/**
|
2847
|
-
The token usage of the generated text.
|
2848
|
-
*/
|
2849
|
-
readonly usage: LanguageModelUsage;
|
2850
|
-
/**
|
2851
|
-
Warnings from the model provider (e.g. unsupported settings).
|
2852
|
-
*/
|
2853
|
-
readonly warnings: CallWarning[] | undefined;
|
2854
|
-
/**
|
2855
|
-
Additional request information.
|
2856
|
-
*/
|
2857
|
-
readonly request: LanguageModelRequestMetadata;
|
2858
|
-
/**
|
2859
|
-
Additional response information.
|
2860
|
-
*/
|
2861
|
-
readonly response: LanguageModelResponseMetadata & {
|
2862
|
-
/**
|
2863
|
-
The response messages that were generated during the call.
|
2864
|
-
Response messages can be either assistant messages or tool messages.
|
2865
|
-
They contain a generated id.
|
2866
|
-
*/
|
2867
|
-
readonly messages: Array<ResponseMessage>;
|
2868
|
-
/**
|
2869
|
-
Response body (available only for providers that use HTTP requests).
|
2870
|
-
*/
|
2871
|
-
body?: unknown;
|
2872
|
-
};
|
2873
|
-
/**
|
2874
|
-
Additional provider-specific metadata. They are passed through
|
2875
|
-
from the provider to the AI SDK and enable provider-specific
|
2876
|
-
results that can be fully encapsulated in the provider.
|
2877
|
-
*/
|
2878
|
-
readonly providerMetadata: ProviderMetadata | undefined;
|
2879
|
-
/**
|
2880
|
-
The type of step that this result is for. The first step is always
|
2881
|
-
an "initial" step, and subsequent steps are either "continue" steps
|
2882
|
-
or "tool-result" steps.
|
2883
|
-
*/
|
2884
|
-
readonly stepType: 'initial' | 'continue' | 'tool-result';
|
2885
|
-
/**
|
2886
|
-
True when there will be a continuation step with a continuation text.
|
2887
|
-
*/
|
2888
|
-
readonly isContinued: boolean;
|
2889
|
-
};
|
2890
|
-
|
2891
|
-
/**
|
2892
|
-
* Appends the ResponseMessage[] from the response to a Message[] (for useChat).
|
2893
|
-
* The messages are converted to Messages before being appended.
|
2894
|
-
* Timestamps are generated for the new messages.
|
2895
|
-
*
|
2896
|
-
* @returns A new Message[] with the response messages appended.
|
2897
|
-
*/
|
2898
|
-
declare function appendResponseMessages({ messages, responseMessages, _internal: { currentDate }, }: {
|
2899
|
-
messages: UIMessage[];
|
2900
|
-
responseMessages: ResponseMessage[];
|
2901
|
-
/**
|
2902
|
-
Internal. For test use only. May change without notice.
|
2903
|
-
*/
|
2904
|
-
_internal?: {
|
2905
|
-
currentDate?: () => Date;
|
2906
|
-
};
|
2907
|
-
}): UIMessage[];
|
2908
|
-
|
2909
|
-
type ChatRequestOptions = {
|
2910
|
-
/**
|
2911
|
-
Additional headers that should be to be passed to the API endpoint.
|
2912
|
-
*/
|
2913
|
-
headers?: Record<string, string> | Headers;
|
2914
|
-
/**
|
2915
|
-
Additional body JSON properties that should be sent to the API endpoint.
|
2916
|
-
*/
|
2917
|
-
body?: object;
|
2918
|
-
/**
|
2919
|
-
Additional data to be sent to the API endpoint.
|
2920
|
-
*/
|
2921
|
-
data?: JSONValue$1;
|
2922
|
-
/**
|
2923
|
-
* Allow submitting an empty message. Defaults to `false`.
|
2924
|
-
*/
|
2925
|
-
allowEmptySubmit?: boolean;
|
2926
|
-
};
|
2927
|
-
type UseChatOptions = {
|
2928
|
-
/**
|
2929
|
-
* The API endpoint that accepts a `{ messages: Message[] }` object and returns
|
2930
|
-
* a stream of tokens of the AI chat response. Defaults to `/api/chat`.
|
2931
|
-
*/
|
2932
|
-
api?: string;
|
2933
|
-
/**
|
2934
|
-
* A unique identifier for the chat. If not provided, a random one will be
|
2935
|
-
* generated. When provided, the `useChat` hook with the same `id` will
|
2936
|
-
* have shared states across components.
|
2937
|
-
*/
|
2938
|
-
id?: string;
|
2683
|
+
* A unique identifier for the chat. If not provided, a random one will be
|
2684
|
+
* generated. When provided, the `useChat` hook with the same `id` will
|
2685
|
+
* have shared states across components.
|
2686
|
+
*/
|
2687
|
+
id?: string;
|
2939
2688
|
/**
|
2940
2689
|
* Initial messages of the chat. Useful to load an existing chat history.
|
2941
2690
|
*/
|
2942
|
-
initialMessages?: UIMessage[];
|
2691
|
+
initialMessages?: UIMessage<NoInfer<MESSAGE_METADATA>>[];
|
2943
2692
|
/**
|
2944
2693
|
* Initial input of the chat.
|
2945
2694
|
*/
|
@@ -2962,12 +2711,9 @@ type UseChatOptions = {
|
|
2962
2711
|
* Optional callback function that is called when the assistant message is finished streaming.
|
2963
2712
|
*
|
2964
2713
|
* @param message The message that was streamed.
|
2965
|
-
* @param options.usage The token usage of the message.
|
2966
|
-
* @param options.finishReason The finish reason of the message.
|
2967
2714
|
*/
|
2968
|
-
onFinish?: (
|
2969
|
-
|
2970
|
-
finishReason: LanguageModelV2FinishReason;
|
2715
|
+
onFinish?: (options: {
|
2716
|
+
message: UIMessage<NoInfer<MESSAGE_METADATA>>;
|
2971
2717
|
}) => void;
|
2972
2718
|
/**
|
2973
2719
|
* Callback function to be called when an error is encountered.
|
@@ -3022,7 +2768,7 @@ type UseChatOptions = {
|
|
3022
2768
|
};
|
3023
2769
|
|
3024
2770
|
declare const getOriginalFetch$1: () => typeof fetch;
|
3025
|
-
declare function callChatApi({ api, body, streamProtocol, credentials, headers, abortController, onResponse, onUpdate, onFinish, onToolCall, generateId, fetch, lastMessage,
|
2771
|
+
declare function callChatApi<MESSAGE_METADATA>({ api, body, streamProtocol, credentials, headers, abortController, onResponse, onUpdate, onFinish, onToolCall, generateId, fetch, lastMessage, requestType, messageMetadataSchema, }: {
|
3026
2772
|
api: string;
|
3027
2773
|
body: Record<string, any>;
|
3028
2774
|
streamProtocol: 'data' | 'text' | undefined;
|
@@ -3031,21 +2777,19 @@ declare function callChatApi({ api, body, streamProtocol, credentials, headers,
|
|
3031
2777
|
abortController: (() => AbortController | null) | undefined;
|
3032
2778
|
onResponse: ((response: Response) => void | Promise<void>) | undefined;
|
3033
2779
|
onUpdate: (options: {
|
3034
|
-
message: UIMessage
|
3035
|
-
data: JSONValue$1[] | undefined;
|
3036
|
-
replaceLastMessage: boolean;
|
2780
|
+
message: UIMessage<MESSAGE_METADATA>;
|
3037
2781
|
}) => void;
|
3038
|
-
onFinish: UseChatOptions['onFinish'];
|
3039
|
-
onToolCall: UseChatOptions['onToolCall'];
|
2782
|
+
onFinish: UseChatOptions<MESSAGE_METADATA>['onFinish'];
|
2783
|
+
onToolCall: UseChatOptions<MESSAGE_METADATA>['onToolCall'];
|
3040
2784
|
generateId: IdGenerator;
|
3041
2785
|
fetch: ReturnType<typeof getOriginalFetch$1> | undefined;
|
3042
|
-
lastMessage: UIMessage | undefined;
|
3043
|
-
getCurrentDate: () => Date;
|
2786
|
+
lastMessage: UIMessage<MESSAGE_METADATA> | undefined;
|
3044
2787
|
requestType?: 'generate' | 'resume';
|
2788
|
+
messageMetadataSchema?: Schema<MESSAGE_METADATA>;
|
3045
2789
|
}): Promise<void>;
|
3046
2790
|
|
3047
2791
|
declare const getOriginalFetch: () => typeof fetch;
|
3048
|
-
declare function callCompletionApi({ api, prompt, credentials, headers, body, streamProtocol, setCompletion, setLoading, setError, setAbortController, onResponse, onFinish, onError,
|
2792
|
+
declare function callCompletionApi({ api, prompt, credentials, headers, body, streamProtocol, setCompletion, setLoading, setError, setAbortController, onResponse, onFinish, onError, fetch, }: {
|
3049
2793
|
api: string;
|
3050
2794
|
prompt: string;
|
3051
2795
|
credentials: RequestCredentials | undefined;
|
@@ -3059,7 +2803,6 @@ declare function callCompletionApi({ api, prompt, credentials, headers, body, st
|
|
3059
2803
|
onResponse: ((response: Response) => void | Promise<void>) | undefined;
|
3060
2804
|
onFinish: ((prompt: string, completion: string) => void) | undefined;
|
3061
2805
|
onError: ((error: Error) => void) | undefined;
|
3062
|
-
onData: ((data: JSONValue$1[]) => void) | undefined;
|
3063
2806
|
fetch: ReturnType<typeof getOriginalFetch> | undefined;
|
3064
2807
|
}): Promise<string | null | undefined>;
|
3065
2808
|
|
@@ -3430,6 +3173,87 @@ declare function embedMany<VALUE>({ model, values, maxParallelCalls, maxRetries:
|
|
3430
3173
|
maxParallelCalls?: number;
|
3431
3174
|
}): Promise<EmbedManyResult<VALUE>>;
|
3432
3175
|
|
3176
|
+
/**
|
3177
|
+
A message that was generated during the generation process.
|
3178
|
+
It can be either an assistant message or a tool message.
|
3179
|
+
*/
|
3180
|
+
type ResponseMessage = AssistantModelMessage | ToolModelMessage;
|
3181
|
+
|
3182
|
+
/**
|
3183
|
+
* The result of a single step in the generation process.
|
3184
|
+
*/
|
3185
|
+
type StepResult<TOOLS extends ToolSet> = {
|
3186
|
+
/**
|
3187
|
+
The content that was generated in the last step.
|
3188
|
+
*/
|
3189
|
+
readonly content: Array<ContentPart<TOOLS>>;
|
3190
|
+
/**
|
3191
|
+
The generated text.
|
3192
|
+
*/
|
3193
|
+
readonly text: string;
|
3194
|
+
/**
|
3195
|
+
The reasoning that was generated during the generation.
|
3196
|
+
*/
|
3197
|
+
readonly reasoning: Array<ReasoningPart>;
|
3198
|
+
/**
|
3199
|
+
The reasoning text that was generated during the generation.
|
3200
|
+
*/
|
3201
|
+
readonly reasoningText: string | undefined;
|
3202
|
+
/**
|
3203
|
+
The files that were generated during the generation.
|
3204
|
+
*/
|
3205
|
+
readonly files: Array<GeneratedFile>;
|
3206
|
+
/**
|
3207
|
+
The sources that were used to generate the text.
|
3208
|
+
*/
|
3209
|
+
readonly sources: Array<Source>;
|
3210
|
+
/**
|
3211
|
+
The tool calls that were made during the generation.
|
3212
|
+
*/
|
3213
|
+
readonly toolCalls: ToolCallArray<TOOLS>;
|
3214
|
+
/**
|
3215
|
+
The results of the tool calls.
|
3216
|
+
*/
|
3217
|
+
readonly toolResults: ToolResultArray<TOOLS>;
|
3218
|
+
/**
|
3219
|
+
The reason why the generation finished.
|
3220
|
+
*/
|
3221
|
+
readonly finishReason: FinishReason;
|
3222
|
+
/**
|
3223
|
+
The token usage of the generated text.
|
3224
|
+
*/
|
3225
|
+
readonly usage: LanguageModelUsage;
|
3226
|
+
/**
|
3227
|
+
Warnings from the model provider (e.g. unsupported settings).
|
3228
|
+
*/
|
3229
|
+
readonly warnings: CallWarning[] | undefined;
|
3230
|
+
/**
|
3231
|
+
Additional request information.
|
3232
|
+
*/
|
3233
|
+
readonly request: LanguageModelRequestMetadata;
|
3234
|
+
/**
|
3235
|
+
Additional response information.
|
3236
|
+
*/
|
3237
|
+
readonly response: LanguageModelResponseMetadata & {
|
3238
|
+
/**
|
3239
|
+
The response messages that were generated during the call.
|
3240
|
+
Response messages can be either assistant messages or tool messages.
|
3241
|
+
They contain a generated id.
|
3242
|
+
*/
|
3243
|
+
readonly messages: Array<ResponseMessage>;
|
3244
|
+
/**
|
3245
|
+
Response body (available only for providers that use HTTP requests).
|
3246
|
+
*/
|
3247
|
+
body?: unknown;
|
3248
|
+
};
|
3249
|
+
/**
|
3250
|
+
Additional provider-specific metadata. They are passed through
|
3251
|
+
from the provider to the AI SDK and enable provider-specific
|
3252
|
+
results that can be fully encapsulated in the provider.
|
3253
|
+
*/
|
3254
|
+
readonly providerMetadata: ProviderMetadata | undefined;
|
3255
|
+
};
|
3256
|
+
|
3433
3257
|
/**
|
3434
3258
|
The result of a `generateText` call.
|
3435
3259
|
It contains the generated text, the tool calls that were made during the generation, and the results of the tool calls.
|
@@ -3440,15 +3264,15 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT> {
|
|
3440
3264
|
*/
|
3441
3265
|
readonly content: Array<ContentPart<TOOLS>>;
|
3442
3266
|
/**
|
3443
|
-
The
|
3267
|
+
The text that was generated in the last step.
|
3444
3268
|
*/
|
3445
3269
|
readonly text: string;
|
3446
3270
|
/**
|
3447
|
-
The full reasoning that the model has generated.
|
3271
|
+
The full reasoning that the model has generated in the last step.
|
3448
3272
|
*/
|
3449
3273
|
readonly reasoning: Array<ReasoningPart>;
|
3450
3274
|
/**
|
3451
|
-
The reasoning text that the model has generated. Can be undefined if the model
|
3275
|
+
The reasoning text that the model has generated in the last step. Can be undefined if the model
|
3452
3276
|
has only generated text.
|
3453
3277
|
*/
|
3454
3278
|
readonly reasoningText: string | undefined;
|
@@ -3458,28 +3282,32 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT> {
|
|
3458
3282
|
*/
|
3459
3283
|
readonly files: Array<GeneratedFile>;
|
3460
3284
|
/**
|
3461
|
-
Sources that have been used as
|
3462
|
-
For multi-step generation, the sources are accumulated from all steps.
|
3285
|
+
Sources that have been used as references in the last step.
|
3463
3286
|
*/
|
3464
3287
|
readonly sources: Array<Source>;
|
3465
3288
|
/**
|
3466
|
-
|
3289
|
+
The tool calls that were made in the last step.
|
3467
3290
|
*/
|
3468
3291
|
readonly toolCalls: ToolCallArray<TOOLS>;
|
3469
3292
|
/**
|
3470
|
-
|
3293
|
+
The results of the tool calls from the last step.
|
3471
3294
|
*/
|
3472
3295
|
readonly toolResults: ToolResultArray<TOOLS>;
|
3473
3296
|
/**
|
3474
|
-
|
3297
|
+
The reason why the generation finished.
|
3475
3298
|
*/
|
3476
3299
|
readonly finishReason: FinishReason;
|
3477
3300
|
/**
|
3478
|
-
|
3301
|
+
The token usage of the last step.
|
3479
3302
|
*/
|
3480
3303
|
readonly usage: LanguageModelUsage;
|
3481
3304
|
/**
|
3482
|
-
|
3305
|
+
The total token usage of all steps.
|
3306
|
+
When there are multiple steps, the usage is the sum of all step usages.
|
3307
|
+
*/
|
3308
|
+
readonly totalUsage: LanguageModelUsage;
|
3309
|
+
/**
|
3310
|
+
Warnings from the model provider (e.g. unsupported settings)
|
3483
3311
|
*/
|
3484
3312
|
readonly warnings: CallWarning[] | undefined;
|
3485
3313
|
/**
|
@@ -3606,7 +3434,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
3606
3434
|
@returns
|
3607
3435
|
A result object that contains the generated text, the results of the tool calls, and additional information.
|
3608
3436
|
*/
|
3609
|
-
declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, maxSteps,
|
3437
|
+
declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, maxSteps, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools: activeTools, experimental_prepareStep: prepareStep, experimental_repairToolCall: repairToolCall, _internal: { generateId, currentDate, }, onStepFinish, ...settings }: CallSettings & Prompt & {
|
3610
3438
|
/**
|
3611
3439
|
The language model to use.
|
3612
3440
|
*/
|
@@ -3628,16 +3456,6 @@ By default, it's set to 1, which means that only a single LLM call is made.
|
|
3628
3456
|
*/
|
3629
3457
|
maxSteps?: number;
|
3630
3458
|
/**
|
3631
|
-
Generate a unique ID for each message.
|
3632
|
-
*/
|
3633
|
-
experimental_generateMessageId?: IdGenerator;
|
3634
|
-
/**
|
3635
|
-
When enabled, the model will perform additional steps if the finish reason is "length" (experimental).
|
3636
|
-
|
3637
|
-
By default, it's set to false.
|
3638
|
-
*/
|
3639
|
-
experimental_continueSteps?: boolean;
|
3640
|
-
/**
|
3641
3459
|
Optional telemetry configuration (experimental).
|
3642
3460
|
*/
|
3643
3461
|
experimental_telemetry?: TelemetrySettings;
|
@@ -3699,16 +3517,42 @@ type AsyncIterableStream<T> = AsyncIterable<T> & ReadableStream<T>;
|
|
3699
3517
|
|
3700
3518
|
type DataStreamOptions = {
|
3701
3519
|
/**
|
3702
|
-
*
|
3703
|
-
*
|
3704
|
-
*
|
3520
|
+
* Message ID that is sent to the client if a new message is created.
|
3521
|
+
* This is intended to be used for the UI message,
|
3522
|
+
* if the last original message is not an assistant message
|
3523
|
+
* (in which case that message ID is used).
|
3705
3524
|
*/
|
3706
|
-
|
3525
|
+
newMessageId?: string;
|
3707
3526
|
/**
|
3708
|
-
*
|
3709
|
-
|
3527
|
+
* The original messages.
|
3528
|
+
*/
|
3529
|
+
originalMessages?: UIMessage[];
|
3530
|
+
onFinish?: (options: {
|
3531
|
+
/**
|
3532
|
+
* The updates list of UI messages.
|
3533
|
+
*/
|
3534
|
+
messages: UIMessage[];
|
3535
|
+
/**
|
3536
|
+
* Indicates whether the response message is a continuation of the last original message,
|
3537
|
+
* or if a new message was created.
|
3538
|
+
*/
|
3539
|
+
isContinuation: boolean;
|
3540
|
+
/**
|
3541
|
+
* The message that was sent to the client as a response
|
3542
|
+
* (including the original message if it was extended).
|
3543
|
+
*/
|
3544
|
+
responseMessage: UIMessage;
|
3545
|
+
}) => void;
|
3546
|
+
/**
|
3547
|
+
* Extracts message metadata that will be send to the client.
|
3548
|
+
*
|
3549
|
+
* Called on `start` and `finish` events.
|
3710
3550
|
*/
|
3711
|
-
|
3551
|
+
messageMetadata?: (options: {
|
3552
|
+
part: TextStreamPart<ToolSet> & {
|
3553
|
+
type: 'start' | 'finish' | 'start-step' | 'finish-step';
|
3554
|
+
};
|
3555
|
+
}) => unknown;
|
3712
3556
|
/**
|
3713
3557
|
* Send reasoning parts to the client.
|
3714
3558
|
* Default to false.
|
@@ -3738,6 +3582,12 @@ type DataStreamOptions = {
|
|
3738
3582
|
* the message start event from being sent multiple times.
|
3739
3583
|
*/
|
3740
3584
|
experimental_sendStart?: boolean;
|
3585
|
+
/**
|
3586
|
+
* Process an error, e.g. to log it. Default to `() => 'An error occurred.'`.
|
3587
|
+
*
|
3588
|
+
* @return error message to include in the data stream.
|
3589
|
+
*/
|
3590
|
+
onError?: (error: unknown) => string;
|
3741
3591
|
};
|
3742
3592
|
type ConsumeStreamOptions = {
|
3743
3593
|
onError?: (error: unknown) => void;
|
@@ -3777,8 +3627,7 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> {
|
|
3777
3627
|
*/
|
3778
3628
|
readonly files: Promise<GeneratedFile[]>;
|
3779
3629
|
/**
|
3780
|
-
Sources that have been used as
|
3781
|
-
For multi-step generation, the sources are accumulated from all steps.
|
3630
|
+
Sources that have been used as references in the last step.
|
3782
3631
|
|
3783
3632
|
Resolved when the response is finished.
|
3784
3633
|
*/
|
@@ -3802,12 +3651,18 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> {
|
|
3802
3651
|
*/
|
3803
3652
|
readonly finishReason: Promise<FinishReason>;
|
3804
3653
|
/**
|
3654
|
+
The token usage of the last step.
|
3655
|
+
|
3656
|
+
Resolved when the response is finished.
|
3657
|
+
*/
|
3658
|
+
readonly usage: Promise<LanguageModelUsage>;
|
3659
|
+
/**
|
3805
3660
|
The total token usage of the generated response.
|
3806
3661
|
When there are multiple steps, the usage is the sum of all step usages.
|
3807
3662
|
|
3808
3663
|
Resolved when the response is finished.
|
3809
3664
|
*/
|
3810
|
-
readonly
|
3665
|
+
readonly totalUsage: Promise<LanguageModelUsage>;
|
3811
3666
|
/**
|
3812
3667
|
Warnings from the model provider (e.g. unsupported settings) for the first step.
|
3813
3668
|
*/
|
@@ -3933,29 +3788,21 @@ type TextStreamPart<TOOLS extends ToolSet> = ContentPart<TOOLS> | {
|
|
3933
3788
|
toolName: string;
|
3934
3789
|
argsTextDelta: string;
|
3935
3790
|
} | {
|
3936
|
-
type: 'step
|
3937
|
-
messageId: string;
|
3791
|
+
type: 'start-step';
|
3938
3792
|
request: LanguageModelRequestMetadata;
|
3939
3793
|
warnings: CallWarning[];
|
3940
3794
|
} | {
|
3941
|
-
type: 'step
|
3942
|
-
messageId: string;
|
3943
|
-
request: LanguageModelRequestMetadata;
|
3944
|
-
warnings: CallWarning[] | undefined;
|
3795
|
+
type: 'finish-step';
|
3945
3796
|
response: LanguageModelResponseMetadata;
|
3946
3797
|
usage: LanguageModelUsage;
|
3947
3798
|
finishReason: FinishReason;
|
3948
3799
|
providerMetadata: ProviderMetadata | undefined;
|
3949
|
-
|
3800
|
+
} | {
|
3801
|
+
type: 'start';
|
3950
3802
|
} | {
|
3951
3803
|
type: 'finish';
|
3952
3804
|
finishReason: FinishReason;
|
3953
|
-
|
3954
|
-
providerMetadata: ProviderMetadata | undefined;
|
3955
|
-
/**
|
3956
|
-
* @deprecated use response on step-finish instead
|
3957
|
-
*/
|
3958
|
-
response: LanguageModelResponseMetadata;
|
3805
|
+
totalUsage: LanguageModelUsage;
|
3959
3806
|
} | {
|
3960
3807
|
type: 'error';
|
3961
3808
|
error: unknown;
|
@@ -4029,11 +3876,15 @@ Callback that is set using the `onFinish` option.
|
|
4029
3876
|
|
4030
3877
|
@param event - The event that is passed to the callback.
|
4031
3878
|
*/
|
4032
|
-
type StreamTextOnFinishCallback<TOOLS extends ToolSet> = (event:
|
3879
|
+
type StreamTextOnFinishCallback<TOOLS extends ToolSet> = (event: StepResult<TOOLS> & {
|
4033
3880
|
/**
|
4034
3881
|
Details for all steps.
|
4035
3882
|
*/
|
4036
3883
|
readonly steps: StepResult<TOOLS>[];
|
3884
|
+
/**
|
3885
|
+
Total usage for all steps. This is the sum of the usage of all steps.
|
3886
|
+
*/
|
3887
|
+
readonly totalUsage: LanguageModelUsage;
|
4037
3888
|
}) => Promise<void> | void;
|
4038
3889
|
/**
|
4039
3890
|
Generate a text and call tools for a given prompt using a language model.
|
@@ -4073,7 +3924,6 @@ If set and supported by the model, calls will generate deterministic results.
|
|
4073
3924
|
@param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
|
4074
3925
|
|
4075
3926
|
@param maxSteps - Maximum number of sequential LLM calls (steps), e.g. when you use tool calls.
|
4076
|
-
@param experimental_generateMessageId - Generate a unique ID for each message.
|
4077
3927
|
|
4078
3928
|
@param onChunk - Callback that is called for each chunk of the stream. The stream processing will pause until the callback promise is resolved.
|
4079
3929
|
@param onError - Callback that is called when an error occurs during streaming. You can use it to log errors.
|
@@ -4084,7 +3934,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
4084
3934
|
@return
|
4085
3935
|
A result object for accessing different stream types and additional information.
|
4086
3936
|
*/
|
4087
|
-
declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxSteps,
|
3937
|
+
declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxSteps, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_toolCallStreaming, toolCallStreaming, experimental_activeTools: activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, onChunk, onError, onFinish, onStepFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
4088
3938
|
/**
|
4089
3939
|
The language model to use.
|
4090
3940
|
*/
|
@@ -4106,16 +3956,6 @@ By default, it's set to 1, which means that only a single LLM call is made.
|
|
4106
3956
|
*/
|
4107
3957
|
maxSteps?: number;
|
4108
3958
|
/**
|
4109
|
-
Generate a unique ID for each message.
|
4110
|
-
*/
|
4111
|
-
experimental_generateMessageId?: IdGenerator;
|
4112
|
-
/**
|
4113
|
-
When enabled, the model will perform additional steps if the finish reason is "length" (experimental).
|
4114
|
-
|
4115
|
-
By default, it's set to false.
|
4116
|
-
*/
|
4117
|
-
experimental_continueSteps?: boolean;
|
4118
|
-
/**
|
4119
3959
|
Optional telemetry configuration (experimental).
|
4120
3960
|
*/
|
4121
3961
|
experimental_telemetry?: TelemetrySettings;
|
@@ -4229,7 +4069,7 @@ as body parameters.
|
|
4229
4069
|
|
4230
4070
|
@returns A result object that contains the generated images.
|
4231
4071
|
*/
|
4232
|
-
declare function generateImage({ model, prompt, n, size, aspectRatio, seed, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, }: {
|
4072
|
+
declare function generateImage({ model, prompt, n, maxImagesPerCall, size, aspectRatio, seed, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, }: {
|
4233
4073
|
/**
|
4234
4074
|
The image model to use.
|
4235
4075
|
*/
|
@@ -4243,6 +4083,10 @@ declare function generateImage({ model, prompt, n, size, aspectRatio, seed, prov
|
|
4243
4083
|
*/
|
4244
4084
|
n?: number;
|
4245
4085
|
/**
|
4086
|
+
Number of images to generate.
|
4087
|
+
*/
|
4088
|
+
maxImagesPerCall?: number;
|
4089
|
+
/**
|
4246
4090
|
Size of the images to generate. Must have the format `{width}x{height}`. If not provided, the default size will be used.
|
4247
4091
|
*/
|
4248
4092
|
size?: `${number}x${number}`;
|
@@ -4347,6 +4191,62 @@ Generate a structured, typed object for a given prompt and schema using a langua
|
|
4347
4191
|
|
4348
4192
|
This function does not stream the output. If you want to stream the output, use `streamObject` instead.
|
4349
4193
|
|
4194
|
+
@param model - The language model to use.
|
4195
|
+
@param tools - Tools that are accessible to and can be called by the model. The model needs to support calling tools.
|
4196
|
+
|
4197
|
+
@param system - A system message that will be part of the prompt.
|
4198
|
+
@param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
|
4199
|
+
@param messages - A list of messages. You can either use `prompt` or `messages` but not both.
|
4200
|
+
|
4201
|
+
@param maxOutputTokens - Maximum number of tokens to generate.
|
4202
|
+
@param temperature - Temperature setting.
|
4203
|
+
The value is passed through to the provider. The range depends on the provider and model.
|
4204
|
+
It is recommended to set either `temperature` or `topP`, but not both.
|
4205
|
+
@param topP - Nucleus sampling.
|
4206
|
+
The value is passed through to the provider. The range depends on the provider and model.
|
4207
|
+
It is recommended to set either `temperature` or `topP`, but not both.
|
4208
|
+
@param topK - Only sample from the top K options for each subsequent token.
|
4209
|
+
Used to remove "long tail" low probability responses.
|
4210
|
+
Recommended for advanced use cases only. You usually only need to use temperature.
|
4211
|
+
@param presencePenalty - Presence penalty setting.
|
4212
|
+
It affects the likelihood of the model to repeat information that is already in the prompt.
|
4213
|
+
The value is passed through to the provider. The range depends on the provider and model.
|
4214
|
+
@param frequencyPenalty - Frequency penalty setting.
|
4215
|
+
It affects the likelihood of the model to repeatedly use the same words or phrases.
|
4216
|
+
The value is passed through to the provider. The range depends on the provider and model.
|
4217
|
+
@param stopSequences - Stop sequences.
|
4218
|
+
If set, the model will stop generating text when one of the stop sequences is generated.
|
4219
|
+
@param seed - The seed (integer) to use for random sampling.
|
4220
|
+
If set and supported by the model, calls will generate deterministic results.
|
4221
|
+
|
4222
|
+
@param maxRetries - Maximum number of retries. Set to 0 to disable retries. Default: 2.
|
4223
|
+
@param abortSignal - An optional abort signal that can be used to cancel the call.
|
4224
|
+
@param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
|
4225
|
+
|
4226
|
+
@param schema - The schema of the object that the model should generate.
|
4227
|
+
@param schemaName - Optional name of the output that should be generated.
|
4228
|
+
Used by some providers for additional LLM guidance, e.g.
|
4229
|
+
via tool or schema name.
|
4230
|
+
@param schemaDescription - Optional description of the output that should be generated.
|
4231
|
+
Used by some providers for additional LLM guidance, e.g.
|
4232
|
+
via tool or schema description.
|
4233
|
+
|
4234
|
+
@param output - The type of the output.
|
4235
|
+
|
4236
|
+
- 'object': The output is an object.
|
4237
|
+
- 'array': The output is an array.
|
4238
|
+
- 'enum': The output is an enum.
|
4239
|
+
- 'no-schema': The output is not a schema.
|
4240
|
+
|
4241
|
+
@param experimental_repairText - A function that attempts to repair the raw output of the mode
|
4242
|
+
to enable JSON parsing.
|
4243
|
+
|
4244
|
+
@param experimental_telemetry - Optional telemetry configuration (experimental).
|
4245
|
+
|
4246
|
+
@param providerOptions - Additional provider-specific options. They are passed through
|
4247
|
+
to the provider from the AI SDK and enable provider-specific
|
4248
|
+
functionality that can be fully encapsulated in the provider.
|
4249
|
+
|
4350
4250
|
@returns
|
4351
4251
|
A result object that contains the generated object, the finish reason, the token usage, and additional information.
|
4352
4252
|
*/
|
@@ -4548,8 +4448,63 @@ type StreamObjectOnFinishCallback<RESULT> = (event: {
|
|
4548
4448
|
}) => Promise<void> | void;
|
4549
4449
|
/**
|
4550
4450
|
Generate a structured, typed object for a given prompt and schema using a language model.
|
4451
|
+
|
4551
4452
|
This function streams the output. If you do not want to stream the output, use `generateObject` instead.
|
4552
|
-
|
4453
|
+
|
4454
|
+
@param model - The language model to use.
|
4455
|
+
@param tools - Tools that are accessible to and can be called by the model. The model needs to support calling tools.
|
4456
|
+
|
4457
|
+
@param system - A system message that will be part of the prompt.
|
4458
|
+
@param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
|
4459
|
+
@param messages - A list of messages. You can either use `prompt` or `messages` but not both.
|
4460
|
+
|
4461
|
+
@param maxOutputTokens - Maximum number of tokens to generate.
|
4462
|
+
@param temperature - Temperature setting.
|
4463
|
+
The value is passed through to the provider. The range depends on the provider and model.
|
4464
|
+
It is recommended to set either `temperature` or `topP`, but not both.
|
4465
|
+
@param topP - Nucleus sampling.
|
4466
|
+
The value is passed through to the provider. The range depends on the provider and model.
|
4467
|
+
It is recommended to set either `temperature` or `topP`, but not both.
|
4468
|
+
@param topK - Only sample from the top K options for each subsequent token.
|
4469
|
+
Used to remove "long tail" low probability responses.
|
4470
|
+
Recommended for advanced use cases only. You usually only need to use temperature.
|
4471
|
+
@param presencePenalty - Presence penalty setting.
|
4472
|
+
It affects the likelihood of the model to repeat information that is already in the prompt.
|
4473
|
+
The value is passed through to the provider. The range depends on the provider and model.
|
4474
|
+
@param frequencyPenalty - Frequency penalty setting.
|
4475
|
+
It affects the likelihood of the model to repeatedly use the same words or phrases.
|
4476
|
+
The value is passed through to the provider. The range depends on the provider and model.
|
4477
|
+
@param stopSequences - Stop sequences.
|
4478
|
+
If set, the model will stop generating text when one of the stop sequences is generated.
|
4479
|
+
@param seed - The seed (integer) to use for random sampling.
|
4480
|
+
If set and supported by the model, calls will generate deterministic results.
|
4481
|
+
|
4482
|
+
@param maxRetries - Maximum number of retries. Set to 0 to disable retries. Default: 2.
|
4483
|
+
@param abortSignal - An optional abort signal that can be used to cancel the call.
|
4484
|
+
@param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
|
4485
|
+
|
4486
|
+
@param schema - The schema of the object that the model should generate.
|
4487
|
+
@param schemaName - Optional name of the output that should be generated.
|
4488
|
+
Used by some providers for additional LLM guidance, e.g.
|
4489
|
+
via tool or schema name.
|
4490
|
+
@param schemaDescription - Optional description of the output that should be generated.
|
4491
|
+
Used by some providers for additional LLM guidance, e.g.
|
4492
|
+
via tool or schema description.
|
4493
|
+
|
4494
|
+
@param output - The type of the output.
|
4495
|
+
|
4496
|
+
- 'object': The output is an object.
|
4497
|
+
- 'array': The output is an array.
|
4498
|
+
- 'enum': The output is an enum.
|
4499
|
+
- 'no-schema': The output is not a schema.
|
4500
|
+
|
4501
|
+
@param experimental_telemetry - Optional telemetry configuration (experimental).
|
4502
|
+
|
4503
|
+
@param providerOptions - Additional provider-specific options. They are passed through
|
4504
|
+
to the provider from the AI SDK and enable provider-specific
|
4505
|
+
functionality that can be fully encapsulated in the provider.
|
4506
|
+
|
4507
|
+
@returns
|
4553
4508
|
A result object for accessing the partial object stream and additional information.
|
4554
4509
|
*/
|
4555
4510
|
declare function streamObject<RESULT extends SCHEMA extends z.Schema ? Output extends 'array' ? Array<z.infer<SCHEMA>> : z.infer<SCHEMA> : SCHEMA extends Schema<infer T> ? Output extends 'array' ? Array<T> : T : never, SCHEMA extends z.Schema | Schema = z.Schema<JSONValue$1>, Output extends 'object' | 'array' | 'enum' | 'no-schema' = RESULT extends string ? 'enum' : 'object'>(options: Omit<CallSettings, 'stopSequences'> & Prompt & (Output extends 'enum' ? {
|
@@ -4736,17 +4691,17 @@ declare function generateSpeech({ model, text, voice, outputFormat, instructions
|
|
4736
4691
|
*/
|
4737
4692
|
declare function defaultSettingsMiddleware({ settings, }: {
|
4738
4693
|
settings: Partial<{
|
4739
|
-
maxOutputTokens?: LanguageModelV2CallOptions['maxOutputTokens']
|
4740
|
-
temperature?: LanguageModelV2CallOptions['temperature']
|
4741
|
-
stopSequences?: LanguageModelV2CallOptions['stopSequences']
|
4742
|
-
topP?: LanguageModelV2CallOptions['topP']
|
4743
|
-
topK?: LanguageModelV2CallOptions['topK']
|
4744
|
-
presencePenalty?: LanguageModelV2CallOptions['presencePenalty']
|
4745
|
-
frequencyPenalty?: LanguageModelV2CallOptions['frequencyPenalty']
|
4746
|
-
responseFormat?: LanguageModelV2CallOptions['responseFormat']
|
4747
|
-
seed?: LanguageModelV2CallOptions['seed']
|
4748
|
-
tools?: LanguageModelV2CallOptions['tools']
|
4749
|
-
toolChoice?: LanguageModelV2CallOptions['toolChoice']
|
4694
|
+
maxOutputTokens?: LanguageModelV2CallOptions['maxOutputTokens'];
|
4695
|
+
temperature?: LanguageModelV2CallOptions['temperature'];
|
4696
|
+
stopSequences?: LanguageModelV2CallOptions['stopSequences'];
|
4697
|
+
topP?: LanguageModelV2CallOptions['topP'];
|
4698
|
+
topK?: LanguageModelV2CallOptions['topK'];
|
4699
|
+
presencePenalty?: LanguageModelV2CallOptions['presencePenalty'];
|
4700
|
+
frequencyPenalty?: LanguageModelV2CallOptions['frequencyPenalty'];
|
4701
|
+
responseFormat?: LanguageModelV2CallOptions['responseFormat'];
|
4702
|
+
seed?: LanguageModelV2CallOptions['seed'];
|
4703
|
+
tools?: LanguageModelV2CallOptions['tools'];
|
4704
|
+
toolChoice?: LanguageModelV2CallOptions['toolChoice'];
|
4750
4705
|
headers?: LanguageModelV2CallOptions['headers'];
|
4751
4706
|
providerOptions?: LanguageModelV2CallOptions['providerOptions'];
|
4752
4707
|
}>;
|
@@ -4958,4 +4913,4 @@ declare function transcribe({ model, audio, providerOptions, maxRetries: maxRetr
|
|
4958
4913
|
headers?: Record<string, string>;
|
4959
4914
|
}): Promise<TranscriptionResult>;
|
4960
4915
|
|
4961
|
-
export { AssistantContent, AssistantModelMessage, CallSettings, CallWarning, ChatRequestOptions, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataContent, DataStreamOptions, DataStreamPart, DataStreamWriter, DeepPartial, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, ImagePart, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, ModelMessage, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, Prompt, Provider, ProviderMetadata, ProviderOptions, ProviderRegistryProvider, ReasoningUIPart, RepairTextFunction, RetryError, SourceUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StepResult, StepStartUIPart, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, SystemModelMessage, TelemetrySettings, TextPart, TextStreamPart, TextUIPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolInvocation, ToolInvocationUIPart, ToolModelMessage, ToolResultPart, ToolResultUnion, ToolSet, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, UIMessage, UIMessagePart, UseChatOptions, UseCompletionOptions, UserContent, UserModelMessage, appendClientMessage,
|
4916
|
+
export { AssistantContent, AssistantModelMessage, CallSettings, CallWarning, ChatRequestOptions, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataContent, DataStreamOptions, DataStreamPart, DataStreamWriter, DeepPartial, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, ImagePart, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, ModelMessage, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, Prompt, Provider, ProviderMetadata, ProviderOptions, ProviderRegistryProvider, ReasoningUIPart, RepairTextFunction, RetryError, SourceUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StepResult, StepStartUIPart, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, SystemModelMessage, TelemetrySettings, TextPart, TextStreamPart, TextUIPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolInvocation, ToolInvocationUIPart, ToolModelMessage, ToolResultPart, ToolResultUnion, ToolSet, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, UIMessage, UIMessagePart, UseChatOptions, UseCompletionOptions, UserContent, UserModelMessage, appendClientMessage, assistantModelMessageSchema, callChatApi, callCompletionApi, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createDataStream, createDataStreamResponse, createProviderRegistry, createTextStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractMaxToolInvocationStep, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolInvocations, isAssistantMessageWithCompletedToolCalls, isDeepEqualData, modelMessageSchema, parsePartialJson, pipeDataStreamToResponse, pipeTextStreamToResponse, processTextStream, shouldResubmitMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, streamObject, streamText, systemModelMessageSchema, tool, toolModelMessageSchema, updateToolCallResult, userModelMessageSchema, wrapLanguageModel };
|