ai 3.1.0-canary.3 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.mts +982 -24
  3. package/dist/index.d.ts +982 -24
  4. package/dist/index.js +1748 -175
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +1723 -174
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +14 -31
  9. package/prompts/dist/index.d.mts +13 -1
  10. package/prompts/dist/index.d.ts +13 -1
  11. package/prompts/dist/index.js +13 -0
  12. package/prompts/dist/index.js.map +1 -1
  13. package/prompts/dist/index.mjs +12 -0
  14. package/prompts/dist/index.mjs.map +1 -1
  15. package/react/dist/index.d.mts +27 -6
  16. package/react/dist/index.d.ts +31 -8
  17. package/react/dist/index.js +155 -141
  18. package/react/dist/index.js.map +1 -1
  19. package/react/dist/index.mjs +154 -141
  20. package/react/dist/index.mjs.map +1 -1
  21. package/react/dist/index.server.d.mts +4 -2
  22. package/react/dist/index.server.d.ts +4 -2
  23. package/react/dist/index.server.js.map +1 -1
  24. package/react/dist/index.server.mjs.map +1 -1
  25. package/rsc/dist/index.d.ts +385 -20
  26. package/rsc/dist/rsc-client.d.mts +1 -1
  27. package/rsc/dist/rsc-client.mjs +2 -0
  28. package/rsc/dist/rsc-client.mjs.map +1 -1
  29. package/rsc/dist/rsc-server.d.mts +367 -20
  30. package/rsc/dist/rsc-server.mjs +676 -35
  31. package/rsc/dist/rsc-server.mjs.map +1 -1
  32. package/rsc/dist/rsc-shared.d.mts +24 -9
  33. package/rsc/dist/rsc-shared.mjs +98 -4
  34. package/rsc/dist/rsc-shared.mjs.map +1 -1
  35. package/solid/dist/index.d.mts +7 -3
  36. package/solid/dist/index.d.ts +7 -3
  37. package/solid/dist/index.js +106 -107
  38. package/solid/dist/index.js.map +1 -1
  39. package/solid/dist/index.mjs +106 -107
  40. package/solid/dist/index.mjs.map +1 -1
  41. package/svelte/dist/index.d.mts +7 -3
  42. package/svelte/dist/index.d.ts +7 -3
  43. package/svelte/dist/index.js +109 -109
  44. package/svelte/dist/index.js.map +1 -1
  45. package/svelte/dist/index.mjs +109 -109
  46. package/svelte/dist/index.mjs.map +1 -1
  47. package/vue/dist/index.d.mts +7 -3
  48. package/vue/dist/index.d.ts +7 -3
  49. package/vue/dist/index.js +106 -107
  50. package/vue/dist/index.js.map +1 -1
  51. package/vue/dist/index.mjs +106 -107
  52. package/vue/dist/index.mjs.map +1 -1
  53. package/ai-model-specification/dist/index.d.mts +0 -606
  54. package/ai-model-specification/dist/index.d.ts +0 -606
  55. package/ai-model-specification/dist/index.js +0 -617
  56. package/ai-model-specification/dist/index.js.map +0 -1
  57. package/ai-model-specification/dist/index.mjs +0 -560
  58. package/ai-model-specification/dist/index.mjs.map +0 -1
  59. package/core/dist/index.d.mts +0 -590
  60. package/core/dist/index.d.ts +0 -590
  61. package/core/dist/index.js +0 -1528
  62. package/core/dist/index.js.map +0 -1
  63. package/core/dist/index.mjs +0 -1481
  64. package/core/dist/index.mjs.map +0 -1
  65. package/provider/dist/index.d.mts +0 -429
  66. package/provider/dist/index.d.ts +0 -429
  67. package/provider/dist/index.js +0 -1194
  68. package/provider/dist/index.js.map +0 -1
  69. package/provider/dist/index.mjs +0 -1158
  70. package/provider/dist/index.mjs.map +0 -1
@@ -1,590 +0,0 @@
1
- import { z } from 'zod';
2
- import { PartialDeep, ValueOf } from 'type-fest';
3
-
4
- type JsonSchema = Record<string, unknown>;
5
-
6
- type LanguageModelV1CallSettings = {
7
- /**
8
- * Maximum number of tokens to generate.
9
- */
10
- maxTokens?: number;
11
- /**
12
- * Temperature setting. This is a number between 0 (almost no randomness) and
13
- * 1 (very random).
14
- *
15
- * Different LLM providers have different temperature
16
- * scales, so they'd need to map it (without mapping, the same temperature has
17
- * different effects on different models). The provider can also chose to map
18
- * this to topP, potentially even using a custom setting on their model.
19
- *
20
- * Note: This is an example of a setting that requires a clear specification of
21
- * the semantics.
22
- */
23
- temperature?: number;
24
- /**
25
- * Nucleus sampling. This is a number between 0 and 1.
26
- *
27
- * E.g. 0.1 would mean that only tokens with the top 10% probability mass
28
- * are considered.
29
- *
30
- * It is recommended to set either `temperature` or `topP`, but not both.
31
- */
32
- topP?: number;
33
- /**
34
- * Presence penalty setting. It affects the likelihood of the model to
35
- * repeat information that is already in the prompt.
36
- *
37
- * The presence penalty is a number between -1 (increase repetition)
38
- * and 1 (maximum penalty, decrease repetition). 0 means no penalty.
39
- */
40
- presencePenalty?: number;
41
- /**
42
- * Frequency penalty setting. It affects the likelihood of the model
43
- * to repeatedly use the same words or phrases.
44
- *
45
- * The frequency penalty is a number between -1 (increase repetition)
46
- * and 1 (maximum penalty, decrease repetition). 0 means no penalty.
47
- */
48
- frequencyPenalty?: number;
49
- /**
50
- * The seed (integer) to use for random sampling. If set and supported
51
- * by the model, calls will generate deterministic results.
52
- */
53
- seed?: number;
54
- /**
55
- * Abort signal for cancelling the operation.
56
- */
57
- abortSignal?: AbortSignal;
58
- };
59
-
60
- /**
61
- * A tool has a name, a description, and a set of parameters.
62
- *
63
- * Note: this is **not** the user-facing tool definition. The AI SDK methods will
64
- * map the user-facing tool definitions to this format.
65
- */
66
- type LanguageModelV1FunctionTool = {
67
- /**
68
- * The type of the tool. Only functions for now, but this gives us room to
69
- * add more specific tool types in the future and use a discriminated union.
70
- */
71
- type: 'function';
72
- /**
73
- * The name of the tool. Unique within this model call.
74
- */
75
- name: string;
76
- description?: string;
77
- parameters: JsonSchema;
78
- };
79
-
80
- /**
81
- * A prompt is a list of messages.
82
- *
83
- * Note: Not all models and prompt formats support multi-modal inputs and
84
- * tool calls. The validation happens at runtime.
85
- *
86
- * Note: This is not a user-facing prompt. The AI SDK methods will map the
87
- * user-facing prompt types such as chat or instruction prompts to this format.
88
- */
89
- type LanguageModelV1Prompt = Array<LanguageModelV1Message>;
90
- type LanguageModelV1Message = {
91
- role: 'system';
92
- content: string;
93
- } | {
94
- role: 'user';
95
- content: Array<LanguageModelV1TextPart | LanguageModelV1ImagePart>;
96
- } | {
97
- role: 'assistant';
98
- content: Array<LanguageModelV1TextPart | LanguageModelV1ToolCallPart>;
99
- } | {
100
- role: 'tool';
101
- content: Array<LanguageModelV1ToolResultPart>;
102
- };
103
- interface LanguageModelV1TextPart {
104
- type: 'text';
105
- /**
106
- * The text content.
107
- */
108
- text: string;
109
- }
110
- interface LanguageModelV1ImagePart {
111
- type: 'image';
112
- /**
113
- * Image data as a Uint8Array (e.g. from a Blob or Buffer) or a URL.
114
- */
115
- image: Uint8Array | URL;
116
- /**
117
- * Optional mime type of the image.
118
- */
119
- mimeType?: string;
120
- }
121
- interface LanguageModelV1ToolCallPart {
122
- type: 'tool-call';
123
- toolCallId: string;
124
- toolName: string;
125
- args: unknown;
126
- }
127
- interface LanguageModelV1ToolResultPart {
128
- type: 'tool-result';
129
- toolCallId: string;
130
- toolName: string;
131
- result: unknown;
132
- }
133
-
134
- type LanguageModelV1CallOptions = LanguageModelV1CallSettings & {
135
- /**
136
- * Whether the user provided the input as messages or as
137
- * a prompt. This can help guide non-chat models in the
138
- * expansion, bc different expansions can be needed for
139
- * chat/non-chat use cases.
140
- */
141
- inputFormat: 'messages' | 'prompt';
142
- /**
143
- * The mode affects the behavior of the language model. It is required to
144
- * support provider-independent streaming and generation of structured objects.
145
- * The model can take this information and e.g. configure json mode, the correct
146
- * low level grammar, etc. It can also be used to optimize the efficiency of the
147
- * streaming, e.g. tool-delta stream parts are only needed in the
148
- * object-tool mode.
149
- */
150
- mode: {
151
- type: 'regular';
152
- tools?: Array<LanguageModelV1FunctionTool>;
153
- } | {
154
- type: 'object-json';
155
- } | {
156
- type: 'object-grammar';
157
- schema: JsonSchema;
158
- } | {
159
- type: 'object-tool';
160
- tool: LanguageModelV1FunctionTool;
161
- };
162
- /**
163
- * A language mode prompt is a standardized prompt type.
164
- *
165
- * Note: This is **not** the user-facing prompt. The AI SDK methods will map the
166
- * user-facing prompt types such as chat or instruction prompts to this format.
167
- * That approach allows us to evolve the user facing prompts without breaking
168
- * the language model interface.
169
- */
170
- prompt: LanguageModelV1Prompt;
171
- };
172
-
173
- /**
174
- * Warning from the model provider for this call. The call will proceed, but e.g.
175
- * some settings might not be supported, which can lead to suboptimal results.
176
- */
177
- type LanguageModelV1CallWarning = {
178
- type: 'unsupported-setting';
179
- setting: keyof LanguageModelV1CallSettings;
180
- } | {
181
- type: 'other';
182
- message: string;
183
- };
184
-
185
- type LanguageModelV1FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
186
-
187
- type LanguageModelV1FunctionToolCall = {
188
- toolCallType: 'function';
189
- toolCallId: string;
190
- toolName: string;
191
- /**
192
- * Stringified JSON object with the tool call arguments. Must match the
193
- * parameters schema of the tool.
194
- */
195
- args: string;
196
- };
197
-
198
- type LanguageModelV1 = {
199
- /**
200
- * The language model must specify which language model interface
201
- * version it implements. This will allow us to evolve the language
202
- * model interface and retain backwards compatibility. The different
203
- * implementation versions can be handled as a discriminated union
204
- * on our side.
205
- */
206
- readonly specificationVersion: 'v1';
207
- /**
208
- * Name of the provider for logging purposes.
209
- */
210
- readonly provider: string;
211
- /**
212
- * Provider-specific model ID for logging purposes.
213
- */
214
- readonly modelId: string;
215
- /**
216
- * Default object generation mode that should be used with this model when
217
- * no mode is specified. Should be the mode with the best results for this
218
- * model. `undefined` can be returned if object generation is not supported.
219
- *
220
- * This is needed to generate the best objects possible w/o requiring the
221
- * user to explicitly specify the object generation mode.
222
- */
223
- readonly defaultObjectGenerationMode: 'json' | 'tool' | 'grammar' | undefined;
224
- /**
225
- * Generates a language model output (non-streaming).
226
- *
227
- * Naming: "do" prefix to prevent accidental direct usage of the method
228
- * by the user.
229
- */
230
- doGenerate(options: LanguageModelV1CallOptions): PromiseLike<{
231
- /**
232
- * Text that the model has generated. Can be undefined if the model
233
- * has only generated tool calls.
234
- */
235
- text?: string;
236
- /**
237
- * Tool calls that the model has generated. Can be undefined if the
238
- * model has only generated text.
239
- */
240
- toolCalls?: Array<LanguageModelV1FunctionToolCall>;
241
- /**
242
- * Finish reason.
243
- */
244
- finishReason: LanguageModelV1FinishReason;
245
- /**
246
- * Usage information.
247
- */
248
- usage: {
249
- promptTokens: number;
250
- completionTokens: number;
251
- };
252
- /**
253
- * Raw prompt and setting information for observability provider integration.
254
- */
255
- rawCall: {
256
- /**
257
- * Raw prompt after expansion and conversion to the format that the
258
- * provider uses to send the information to their API.
259
- */
260
- rawPrompt: unknown;
261
- /**
262
- * Raw settings that are used for the API call. Includes provider-specific
263
- * settings.
264
- */
265
- rawSettings: Record<string, unknown>;
266
- };
267
- warnings?: LanguageModelV1CallWarning[];
268
- }>;
269
- /**
270
- * Generates a language model output (streaming).
271
- *
272
- * Naming: "do" prefix to prevent accidental direct usage of the method
273
- * by the user.
274
- *
275
- * @return A stream of higher-level language model output parts.
276
- */
277
- doStream(options: LanguageModelV1CallOptions): PromiseLike<{
278
- stream: ReadableStream<LanguageModelV1StreamPart>;
279
- /**
280
- * Raw prompt and setting information for observability provider integration.
281
- */
282
- rawCall: {
283
- /**
284
- * Raw prompt after expansion and conversion to the format that the
285
- * provider uses to send the information to their API.
286
- */
287
- rawPrompt: unknown;
288
- /**
289
- * Raw settings that are used for the API call. Includes provider-specific
290
- * settings.
291
- */
292
- rawSettings: Record<string, unknown>;
293
- };
294
- warnings?: LanguageModelV1CallWarning[];
295
- }>;
296
- };
297
- type LanguageModelV1StreamPart = {
298
- type: 'text-delta';
299
- textDelta: string;
300
- } | ({
301
- type: 'tool-call';
302
- } & LanguageModelV1FunctionToolCall) | {
303
- type: 'tool-call-delta';
304
- toolCallId: string;
305
- toolName: string;
306
- argsTextDelta: string;
307
- } | {
308
- type: 'finish-metadata';
309
- finishReason: LanguageModelV1FinishReason;
310
- usage: {
311
- promptTokens: number;
312
- completionTokens: number;
313
- };
314
- } | {
315
- type: 'error';
316
- error: unknown;
317
- };
318
-
319
- type TokenUsage = {
320
- promptTokens: number;
321
- completionTokens: number;
322
- totalTokens: number;
323
- };
324
-
325
- type CallSettings = {
326
- /**
327
- * Maximum number of tokens to generate.
328
- */
329
- maxTokens?: number;
330
- /**
331
- * Temperature setting. This is a number between 0 (almost no randomness) and
332
- * 1 (very random).
333
- *
334
- * It is recommended to set either `temperature` or `topP`, but not both.
335
- */
336
- temperature?: number;
337
- /**
338
- * Nucleus sampling. This is a number between 0 and 1.
339
- *
340
- * E.g. 0.1 would mean that only tokens with the top 10% probability mass
341
- * are considered.
342
- *
343
- * It is recommended to set either `temperature` or `topP`, but not both.
344
- */
345
- topP?: number;
346
- /**
347
- * Presence penalty setting. It affects the likelihood of the model to
348
- * repeat information that is already in the prompt.
349
- *
350
- * The presence penalty is a number between -1 (increase repetition)
351
- * and 1 (maximum penalty, decrease repetition). 0 means no penalty.
352
- */
353
- presencePenalty?: number;
354
- /**
355
- * Frequency penalty setting. It affects the likelihood of the model
356
- * to repeatedly use the same words or phrases.
357
- *
358
- * The frequency penalty is a number between -1 (increase repetition)
359
- * and 1 (maximum penalty, decrease repetition). 0 means no penalty.
360
- */
361
- frequencyPenalty?: number;
362
- /**
363
- * The seed (integer) to use for random sampling. If set and supported
364
- * by the model, calls will generate deterministic results.
365
- */
366
- seed?: number;
367
- /**
368
- * Maximum number of retries. Set to 0 to disable retries. Default is 2.
369
- */
370
- maxRetries?: number;
371
- /**
372
- * Abort signal.
373
- */
374
- abortSignal?: AbortSignal;
375
- };
376
-
377
- /**
378
- * Data content. Can either be a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer.
379
- */
380
- type DataContent = string | Uint8Array | ArrayBuffer | Buffer;
381
- declare function convertDataContentToBase64String(content: DataContent): string;
382
- declare function convertDataContentToUint8Array(content: DataContent): Uint8Array;
383
-
384
- interface TextPart {
385
- type: 'text';
386
- /**
387
- * The text content.
388
- */
389
- text: string;
390
- }
391
- interface ImagePart {
392
- type: 'image';
393
- /**
394
- * Image data. Can either be:
395
- *
396
- * - data: a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer
397
- * - URL: a URL that points to the image
398
- */
399
- image: DataContent | URL;
400
- /**
401
- * Optional mime type of the image.
402
- */
403
- mimeType?: string;
404
- }
405
- interface ToolCallPart {
406
- type: 'tool-call';
407
- toolCallId: string;
408
- toolName: string;
409
- args: unknown;
410
- }
411
- interface ToolResultPart {
412
- type: 'tool-result';
413
- toolCallId: string;
414
- toolName: string;
415
- result: unknown;
416
- }
417
-
418
- type Message = UserMessage | AssistantMessage | ToolMessage;
419
- type UserMessage = {
420
- role: 'user';
421
- content: UserContent;
422
- };
423
- type AssistantMessage = {
424
- role: 'assistant';
425
- content: AssistantContent;
426
- };
427
- type ToolMessage = {
428
- role: 'tool';
429
- content: ToolContent;
430
- };
431
- type UserContent = string | Array<TextPart | ImagePart>;
432
- type AssistantContent = string | Array<TextPart | ToolCallPart>;
433
- type ToolContent = Array<ToolResultPart>;
434
-
435
- type Prompt = {
436
- system?: string;
437
- prompt?: string;
438
- messages?: Array<Message>;
439
- };
440
-
441
- /**
442
- * Generate a structured, typed object using a language model.
443
- */
444
- declare function generateObject<T>({ model, schema, mode, system, prompt, messages, maxRetries, abortSignal, ...settings }: CallSettings & Prompt & {
445
- model: LanguageModelV1;
446
- schema: z.Schema<T>;
447
- mode?: 'auto' | 'json' | 'tool' | 'grammar';
448
- }): Promise<GenerateObjectResult<T>>;
449
- declare class GenerateObjectResult<T> {
450
- readonly object: T;
451
- readonly finishReason: LanguageModelV1FinishReason;
452
- readonly usage: TokenUsage;
453
- constructor(options: {
454
- object: T;
455
- finishReason: LanguageModelV1FinishReason;
456
- usage: TokenUsage;
457
- });
458
- }
459
-
460
- /**
461
- * Stream an object as a partial object stream.
462
- */
463
- declare function streamObject<T>({ model, schema, mode, system, prompt, messages, maxRetries, abortSignal, ...settings }: CallSettings & Prompt & {
464
- model: LanguageModelV1;
465
- schema: z.Schema<T>;
466
- mode?: 'auto' | 'json' | 'tool' | 'grammar';
467
- }): Promise<StreamObjectResult<T>>;
468
- declare class StreamObjectResult<T> {
469
- readonly objectStream: AsyncIterable<PartialDeep<T, {
470
- recurseIntoArrays: true;
471
- }>>;
472
- constructor(modelStream: ReadableStream<string | ErrorStreamPart>);
473
- }
474
- type ErrorStreamPart = {
475
- type: 'error';
476
- error: unknown;
477
- };
478
-
479
- /**
480
- * A tool contains the description and the schema of the input that the tool expects.
481
- * This enables the language model to generate the input.
482
- *
483
- * The tool can also contain an optional execute function for the actual execution function of the tool.
484
- */
485
- interface Tool<PARAMETERS extends z.ZodTypeAny = any, RESULT = any> {
486
- /**
487
- * A optional description of what the tool does. Will be used by the language model to decide whether to use the tool.
488
- */
489
- description?: string;
490
- /**
491
- * The schema of the input that the tool expects. The language model will use this to generate the input.
492
- * Use descriptions to make the input understandable for the language model.
493
- */
494
- parameters: PARAMETERS;
495
- /**
496
- * An optional execute function for the actual execution function of the tool.
497
- * If not provided, the tool will not be executed automatically.
498
- */
499
- execute?: (args: z.infer<PARAMETERS>) => PromiseLike<RESULT>;
500
- }
501
- /**
502
- * Helper function for inferring the execute args of a tool.
503
- */
504
- declare function tool<PARAMETERS extends z.ZodTypeAny, RESULT>(tool: Tool<PARAMETERS, RESULT> & {
505
- execute: (args: z.infer<PARAMETERS>) => PromiseLike<RESULT>;
506
- }): Tool<PARAMETERS, RESULT> & {
507
- execute: (args: z.infer<PARAMETERS>) => PromiseLike<RESULT>;
508
- };
509
- declare function tool<PARAMETERS extends z.ZodTypeAny, RESULT>(tool: Tool<PARAMETERS, RESULT> & {
510
- execute?: undefined;
511
- }): Tool<PARAMETERS, RESULT> & {
512
- execute: undefined;
513
- };
514
-
515
- type ToToolCall<TOOLS extends Record<string, Tool>> = ValueOf<{
516
- [NAME in keyof TOOLS]: {
517
- toolCallId: string;
518
- toolName: NAME & string;
519
- args: z.infer<TOOLS[NAME]['parameters']>;
520
- };
521
- }>;
522
- type ToToolCallArray<TOOLS extends Record<string, Tool>> = Array<ToToolCall<TOOLS>>;
523
-
524
- type ToToolsWithExecute<TOOLS extends Record<string, Tool>> = {
525
- [K in keyof TOOLS as TOOLS[K] extends {
526
- execute: any;
527
- } ? K : never]: TOOLS[K];
528
- };
529
- type ToToolsWithDefinedExecute<TOOLS extends Record<string, Tool>> = {
530
- [K in keyof TOOLS as TOOLS[K]['execute'] extends undefined ? never : K]: TOOLS[K];
531
- };
532
- type ToToolResultObject<TOOLS extends Record<string, Tool>> = ValueOf<{
533
- [NAME in keyof TOOLS]: {
534
- toolCallId: string;
535
- toolName: NAME & string;
536
- args: z.infer<TOOLS[NAME]['parameters']>;
537
- result: Awaited<ReturnType<Exclude<TOOLS[NAME]['execute'], undefined>>>;
538
- };
539
- }>;
540
- type ToToolResult<TOOLS extends Record<string, Tool>> = ToToolResultObject<ToToolsWithDefinedExecute<ToToolsWithExecute<TOOLS>>>;
541
- type ToToolResultArray<TOOLS extends Record<string, Tool>> = Array<ToToolResult<TOOLS>>;
542
-
543
- /**
544
- * Generate a text and call tools using a language model.
545
- */
546
- declare function generateText<TOOLS extends Record<string, Tool>>({ model, tools, system, prompt, messages, maxRetries, abortSignal, ...settings }: CallSettings & Prompt & {
547
- model: LanguageModelV1;
548
- tools?: TOOLS;
549
- }): Promise<GenerateTextResult<TOOLS>>;
550
- declare class GenerateTextResult<TOOLS extends Record<string, Tool>> {
551
- readonly text: string;
552
- readonly toolCalls: ToToolCallArray<TOOLS>;
553
- readonly toolResults: ToToolResultArray<TOOLS>;
554
- readonly finishReason: LanguageModelV1FinishReason;
555
- readonly usage: TokenUsage;
556
- constructor(options: {
557
- text: string;
558
- toolCalls: ToToolCallArray<TOOLS>;
559
- toolResults: ToToolResultArray<TOOLS>;
560
- finishReason: LanguageModelV1FinishReason;
561
- usage: TokenUsage;
562
- });
563
- }
564
-
565
- /**
566
- * Stream text generated by a language model.
567
- */
568
- declare function streamText<TOOLS extends Record<string, Tool>>({ model, tools, system, prompt, messages, maxRetries, abortSignal, ...settings }: CallSettings & Prompt & {
569
- model: LanguageModelV1;
570
- tools?: TOOLS;
571
- }): Promise<StreamTextResult<TOOLS>>;
572
- type TextStreamPart<TOOLS extends Record<string, Tool>> = {
573
- type: 'text-delta';
574
- textDelta: string;
575
- } | ({
576
- type: 'tool-call';
577
- } & ToToolCall<TOOLS>) | {
578
- type: 'error';
579
- error: unknown;
580
- } | ({
581
- type: 'tool-result';
582
- } & ToToolResult<TOOLS>);
583
- declare class StreamTextResult<TOOLS extends Record<string, Tool>> {
584
- private readonly rootStream;
585
- readonly textStream: AsyncIterable<string>;
586
- readonly fullStream: AsyncIterable<TextStreamPart<TOOLS>>;
587
- constructor(stream: ReadableStream<TextStreamPart<TOOLS>>);
588
- }
589
-
590
- export { AssistantContent, AssistantMessage, DataContent, ErrorStreamPart, GenerateObjectResult, GenerateTextResult, ImagePart, Message, StreamObjectResult, StreamTextResult, TextPart, TextStreamPart, Tool, ToolCallPart, ToolContent, ToolMessage, ToolResultPart, UserContent, UserMessage, convertDataContentToBase64String, convertDataContentToUint8Array, generateObject, generateText, streamObject, streamText, tool };