ai 0.0.0-156c9f7b-20250115085202 → 0.0.0-677c097b-20250505090413
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 +774 -2
- package/README.md +22 -9
- package/dist/index.d.mts +3081 -1016
- package/dist/index.d.ts +3081 -1016
- package/dist/index.js +3120 -975
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3060 -931
- package/dist/index.mjs.map +1 -1
- package/mcp-stdio/dist/index.d.mts +169 -0
- package/mcp-stdio/dist/index.d.ts +169 -0
- package/mcp-stdio/dist/index.js +352 -0
- package/mcp-stdio/dist/index.js.map +1 -0
- package/mcp-stdio/dist/index.mjs +337 -0
- package/mcp-stdio/dist/index.mjs.map +1 -0
- package/package.json +15 -11
- package/react/dist/index.d.mts +13 -1
- package/react/dist/index.d.ts +13 -1
- package/react/dist/index.js.map +1 -1
- package/react/dist/index.mjs.map +1 -1
- package/rsc/dist/index.d.ts +108 -18
- package/rsc/dist/rsc-server.d.mts +108 -18
- package/rsc/dist/rsc-server.mjs +603 -274
- package/rsc/dist/rsc-server.mjs.map +1 -1
- package/rsc/dist/rsc-shared.mjs +1 -3
- package/rsc/dist/rsc-shared.mjs.map +1 -1
- package/test/dist/index.d.mts +2 -4
- package/test/dist/index.d.ts +2 -4
- package/test/dist/index.js +4 -14
- package/test/dist/index.js.map +1 -1
- package/test/dist/index.mjs +7 -14
- package/test/dist/index.mjs.map +1 -1
package/rsc/dist/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LanguageModelV1FinishReason, LanguageModelV1CallWarning, LanguageModelV1ProviderMetadata, LanguageModelV1 } from '@ai-sdk/provider';
|
2
2
|
import { ReactNode } from 'react';
|
3
3
|
import { z } from 'zod';
|
4
|
-
import {
|
4
|
+
import { Message } from '@ai-sdk/ui-utils';
|
5
5
|
|
6
6
|
type AIAction<T = any, R = any> = (...args: T[]) => Promise<R>;
|
7
7
|
type AIActions<T = any, R = any> = Record<string, AIAction<T, R>>;
|
@@ -199,17 +199,25 @@ Tool choice for the generation. It supports the following settings:
|
|
199
199
|
- `none`: the model must not call tools
|
200
200
|
- `{ type: 'tool', toolName: string (typed) }`: the model must call the specified tool
|
201
201
|
*/
|
202
|
-
type
|
202
|
+
type ToolChoice<TOOLS extends Record<string, unknown>> = 'auto' | 'none' | 'required' | {
|
203
203
|
type: 'tool';
|
204
204
|
toolName: keyof TOOLS;
|
205
205
|
};
|
206
206
|
|
207
207
|
/**
|
208
|
-
Additional provider-specific metadata
|
209
|
-
|
210
|
-
|
208
|
+
Additional provider-specific metadata that is returned from the provider.
|
209
|
+
|
210
|
+
This is needed to enable provider-specific functionality that can be
|
211
|
+
fully encapsulated in the provider.
|
211
212
|
*/
|
212
213
|
type ProviderMetadata = LanguageModelV1ProviderMetadata;
|
214
|
+
/**
|
215
|
+
Additional provider-specific options.
|
216
|
+
|
217
|
+
They are passed through to the provider from the AI SDK and enable
|
218
|
+
provider-specific functionality that can be fully encapsulated in the provider.
|
219
|
+
*/
|
220
|
+
type ProviderOptions = LanguageModelV1ProviderMetadata;
|
213
221
|
|
214
222
|
/**
|
215
223
|
Represents the number of tokens used in a prompt and completion.
|
@@ -256,6 +264,10 @@ interface TextPart {
|
|
256
264
|
Additional provider-specific metadata. They are passed through
|
257
265
|
to the provider from the AI SDK and enable provider-specific
|
258
266
|
functionality that can be fully encapsulated in the provider.
|
267
|
+
*/
|
268
|
+
providerOptions?: ProviderOptions;
|
269
|
+
/**
|
270
|
+
@deprecated Use `providerOptions` instead.
|
259
271
|
*/
|
260
272
|
experimental_providerMetadata?: ProviderMetadata;
|
261
273
|
}
|
@@ -279,6 +291,10 @@ interface ImagePart {
|
|
279
291
|
Additional provider-specific metadata. They are passed through
|
280
292
|
to the provider from the AI SDK and enable provider-specific
|
281
293
|
functionality that can be fully encapsulated in the provider.
|
294
|
+
*/
|
295
|
+
providerOptions?: ProviderOptions;
|
296
|
+
/**
|
297
|
+
@deprecated Use `providerOptions` instead.
|
282
298
|
*/
|
283
299
|
experimental_providerMetadata?: ProviderMetadata;
|
284
300
|
}
|
@@ -295,6 +311,10 @@ interface FilePart {
|
|
295
311
|
*/
|
296
312
|
data: DataContent | URL;
|
297
313
|
/**
|
314
|
+
Optional filename of the file.
|
315
|
+
*/
|
316
|
+
filename?: string;
|
317
|
+
/**
|
298
318
|
Mime type of the file.
|
299
319
|
*/
|
300
320
|
mimeType: string;
|
@@ -302,6 +322,54 @@ interface FilePart {
|
|
302
322
|
Additional provider-specific metadata. They are passed through
|
303
323
|
to the provider from the AI SDK and enable provider-specific
|
304
324
|
functionality that can be fully encapsulated in the provider.
|
325
|
+
*/
|
326
|
+
providerOptions?: ProviderOptions;
|
327
|
+
/**
|
328
|
+
@deprecated Use `providerOptions` instead.
|
329
|
+
*/
|
330
|
+
experimental_providerMetadata?: ProviderMetadata;
|
331
|
+
}
|
332
|
+
/**
|
333
|
+
* Reasoning content part of a prompt. It contains a reasoning.
|
334
|
+
*/
|
335
|
+
interface ReasoningPart {
|
336
|
+
type: 'reasoning';
|
337
|
+
/**
|
338
|
+
The reasoning text.
|
339
|
+
*/
|
340
|
+
text: string;
|
341
|
+
/**
|
342
|
+
An optional signature for verifying that the reasoning originated from the model.
|
343
|
+
*/
|
344
|
+
signature?: string;
|
345
|
+
/**
|
346
|
+
Additional provider-specific metadata. They are passed through
|
347
|
+
to the provider from the AI SDK and enable provider-specific
|
348
|
+
functionality that can be fully encapsulated in the provider.
|
349
|
+
*/
|
350
|
+
providerOptions?: ProviderOptions;
|
351
|
+
/**
|
352
|
+
@deprecated Use `providerOptions` instead.
|
353
|
+
*/
|
354
|
+
experimental_providerMetadata?: ProviderMetadata;
|
355
|
+
}
|
356
|
+
/**
|
357
|
+
Redacted reasoning content part of a prompt.
|
358
|
+
*/
|
359
|
+
interface RedactedReasoningPart {
|
360
|
+
type: 'redacted-reasoning';
|
361
|
+
/**
|
362
|
+
Redacted reasoning data.
|
363
|
+
*/
|
364
|
+
data: string;
|
365
|
+
/**
|
366
|
+
Additional provider-specific metadata. They are passed through
|
367
|
+
to the provider from the AI SDK and enable provider-specific
|
368
|
+
functionality that can be fully encapsulated in the provider.
|
369
|
+
*/
|
370
|
+
providerOptions?: ProviderOptions;
|
371
|
+
/**
|
372
|
+
@deprecated Use `providerOptions` instead.
|
305
373
|
*/
|
306
374
|
experimental_providerMetadata?: ProviderMetadata;
|
307
375
|
}
|
@@ -326,6 +394,10 @@ interface ToolCallPart {
|
|
326
394
|
Additional provider-specific metadata. They are passed through
|
327
395
|
to the provider from the AI SDK and enable provider-specific
|
328
396
|
functionality that can be fully encapsulated in the provider.
|
397
|
+
*/
|
398
|
+
providerOptions?: ProviderOptions;
|
399
|
+
/**
|
400
|
+
@deprecated Use `providerOptions` instead.
|
329
401
|
*/
|
330
402
|
experimental_providerMetadata?: ProviderMetadata;
|
331
403
|
}
|
@@ -358,6 +430,10 @@ interface ToolResultPart {
|
|
358
430
|
Additional provider-specific metadata. They are passed through
|
359
431
|
to the provider from the AI SDK and enable provider-specific
|
360
432
|
functionality that can be fully encapsulated in the provider.
|
433
|
+
*/
|
434
|
+
providerOptions?: ProviderOptions;
|
435
|
+
/**
|
436
|
+
@deprecated Use `providerOptions` instead.
|
361
437
|
*/
|
362
438
|
experimental_providerMetadata?: ProviderMetadata;
|
363
439
|
}
|
@@ -376,6 +452,10 @@ type CoreSystemMessage = {
|
|
376
452
|
Additional provider-specific metadata. They are passed through
|
377
453
|
to the provider from the AI SDK and enable provider-specific
|
378
454
|
functionality that can be fully encapsulated in the provider.
|
455
|
+
*/
|
456
|
+
providerOptions?: ProviderOptions;
|
457
|
+
/**
|
458
|
+
@deprecated Use `providerOptions` instead.
|
379
459
|
*/
|
380
460
|
experimental_providerMetadata?: ProviderMetadata;
|
381
461
|
};
|
@@ -390,6 +470,10 @@ type CoreUserMessage = {
|
|
390
470
|
to the provider from the AI SDK and enable provider-specific
|
391
471
|
functionality that can be fully encapsulated in the provider.
|
392
472
|
*/
|
473
|
+
providerOptions?: ProviderOptions;
|
474
|
+
/**
|
475
|
+
@deprecated Use `providerOptions` instead.
|
476
|
+
*/
|
393
477
|
experimental_providerMetadata?: ProviderMetadata;
|
394
478
|
};
|
395
479
|
/**
|
@@ -407,12 +491,17 @@ type CoreAssistantMessage = {
|
|
407
491
|
to the provider from the AI SDK and enable provider-specific
|
408
492
|
functionality that can be fully encapsulated in the provider.
|
409
493
|
*/
|
494
|
+
providerOptions?: ProviderOptions;
|
495
|
+
/**
|
496
|
+
@deprecated Use `providerOptions` instead.
|
497
|
+
*/
|
410
498
|
experimental_providerMetadata?: ProviderMetadata;
|
411
499
|
};
|
412
500
|
/**
|
413
|
-
Content of an assistant message.
|
501
|
+
Content of an assistant message.
|
502
|
+
It can be a string or an array of text, image, reasoning, redacted reasoning, and tool call parts.
|
414
503
|
*/
|
415
|
-
type AssistantContent = string | Array<TextPart | ToolCallPart>;
|
504
|
+
type AssistantContent = string | Array<TextPart | FilePart | ReasoningPart | RedactedReasoningPart | ToolCallPart>;
|
416
505
|
/**
|
417
506
|
A tool message. It contains the result of one or more tool calls.
|
418
507
|
*/
|
@@ -424,6 +513,10 @@ type CoreToolMessage = {
|
|
424
513
|
to the provider from the AI SDK and enable provider-specific
|
425
514
|
functionality that can be fully encapsulated in the provider.
|
426
515
|
*/
|
516
|
+
providerOptions?: ProviderOptions;
|
517
|
+
/**
|
518
|
+
@deprecated Use `providerOptions` instead.
|
519
|
+
*/
|
427
520
|
experimental_providerMetadata?: ProviderMetadata;
|
428
521
|
};
|
429
522
|
/**
|
@@ -436,13 +529,6 @@ It can be a user message, an assistant message, or a tool message.
|
|
436
529
|
*/
|
437
530
|
type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage | CoreToolMessage;
|
438
531
|
|
439
|
-
type UIMessage = {
|
440
|
-
role: 'system' | 'user' | 'assistant' | 'data';
|
441
|
-
content: string;
|
442
|
-
toolInvocations?: ToolInvocation[];
|
443
|
-
experimental_attachments?: Attachment[];
|
444
|
-
};
|
445
|
-
|
446
532
|
/**
|
447
533
|
Prompt part of the AI function options.
|
448
534
|
It contains a system message, a simple text prompt, or a list of messages.
|
@@ -459,7 +545,7 @@ type Prompt = {
|
|
459
545
|
/**
|
460
546
|
A list of messages. You can either use `prompt` or `messages` but not both.
|
461
547
|
*/
|
462
|
-
messages?: Array<CoreMessage> | Array<
|
548
|
+
messages?: Array<CoreMessage> | Array<Omit<Message, 'id'>>;
|
463
549
|
};
|
464
550
|
|
465
551
|
type Streamable = ReactNode | Promise<ReactNode>;
|
@@ -500,7 +586,7 @@ type RenderResult = {
|
|
500
586
|
*/
|
501
587
|
declare function streamUI<TOOLS extends {
|
502
588
|
[name: string]: z.ZodTypeAny;
|
503
|
-
} = {}>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, initial, text, experimental_providerMetadata
|
589
|
+
} = {}>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, initial, text, experimental_providerMetadata, providerOptions, onFinish, ...settings }: CallSettings & Prompt & {
|
504
590
|
/**
|
505
591
|
* The language model to use.
|
506
592
|
*/
|
@@ -514,14 +600,18 @@ declare function streamUI<TOOLS extends {
|
|
514
600
|
/**
|
515
601
|
* The tool choice strategy. Default: 'auto'.
|
516
602
|
*/
|
517
|
-
toolChoice?:
|
603
|
+
toolChoice?: ToolChoice<TOOLS>;
|
518
604
|
text?: RenderText;
|
519
605
|
initial?: ReactNode;
|
520
606
|
/**
|
521
|
-
Additional provider-specific
|
607
|
+
Additional provider-specific options. They are passed through
|
522
608
|
to the provider from the AI SDK and enable provider-specific
|
523
609
|
functionality that can be fully encapsulated in the provider.
|
524
610
|
*/
|
611
|
+
providerOptions?: ProviderOptions;
|
612
|
+
/**
|
613
|
+
@deprecated Use `providerOptions` instead.
|
614
|
+
*/
|
525
615
|
experimental_providerMetadata?: ProviderMetadata;
|
526
616
|
/**
|
527
617
|
* Callback that is called when the LLM response and the final object validation are finished.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LanguageModelV1FinishReason, LanguageModelV1CallWarning, LanguageModelV1ProviderMetadata, LanguageModelV1 } from '@ai-sdk/provider';
|
2
2
|
import { ReactNode } from 'react';
|
3
3
|
import { z } from 'zod';
|
4
|
-
import {
|
4
|
+
import { Message } from '@ai-sdk/ui-utils';
|
5
5
|
|
6
6
|
type AIAction<T = any, R = any> = (...args: T[]) => Promise<R>;
|
7
7
|
type AIActions<T = any, R = any> = Record<string, AIAction<T, R>>;
|
@@ -197,17 +197,25 @@ Tool choice for the generation. It supports the following settings:
|
|
197
197
|
- `none`: the model must not call tools
|
198
198
|
- `{ type: 'tool', toolName: string (typed) }`: the model must call the specified tool
|
199
199
|
*/
|
200
|
-
type
|
200
|
+
type ToolChoice<TOOLS extends Record<string, unknown>> = 'auto' | 'none' | 'required' | {
|
201
201
|
type: 'tool';
|
202
202
|
toolName: keyof TOOLS;
|
203
203
|
};
|
204
204
|
|
205
205
|
/**
|
206
|
-
Additional provider-specific metadata
|
207
|
-
|
208
|
-
|
206
|
+
Additional provider-specific metadata that is returned from the provider.
|
207
|
+
|
208
|
+
This is needed to enable provider-specific functionality that can be
|
209
|
+
fully encapsulated in the provider.
|
209
210
|
*/
|
210
211
|
type ProviderMetadata = LanguageModelV1ProviderMetadata;
|
212
|
+
/**
|
213
|
+
Additional provider-specific options.
|
214
|
+
|
215
|
+
They are passed through to the provider from the AI SDK and enable
|
216
|
+
provider-specific functionality that can be fully encapsulated in the provider.
|
217
|
+
*/
|
218
|
+
type ProviderOptions = LanguageModelV1ProviderMetadata;
|
211
219
|
|
212
220
|
/**
|
213
221
|
Represents the number of tokens used in a prompt and completion.
|
@@ -254,6 +262,10 @@ interface TextPart {
|
|
254
262
|
Additional provider-specific metadata. They are passed through
|
255
263
|
to the provider from the AI SDK and enable provider-specific
|
256
264
|
functionality that can be fully encapsulated in the provider.
|
265
|
+
*/
|
266
|
+
providerOptions?: ProviderOptions;
|
267
|
+
/**
|
268
|
+
@deprecated Use `providerOptions` instead.
|
257
269
|
*/
|
258
270
|
experimental_providerMetadata?: ProviderMetadata;
|
259
271
|
}
|
@@ -277,6 +289,10 @@ interface ImagePart {
|
|
277
289
|
Additional provider-specific metadata. They are passed through
|
278
290
|
to the provider from the AI SDK and enable provider-specific
|
279
291
|
functionality that can be fully encapsulated in the provider.
|
292
|
+
*/
|
293
|
+
providerOptions?: ProviderOptions;
|
294
|
+
/**
|
295
|
+
@deprecated Use `providerOptions` instead.
|
280
296
|
*/
|
281
297
|
experimental_providerMetadata?: ProviderMetadata;
|
282
298
|
}
|
@@ -293,6 +309,10 @@ interface FilePart {
|
|
293
309
|
*/
|
294
310
|
data: DataContent | URL;
|
295
311
|
/**
|
312
|
+
Optional filename of the file.
|
313
|
+
*/
|
314
|
+
filename?: string;
|
315
|
+
/**
|
296
316
|
Mime type of the file.
|
297
317
|
*/
|
298
318
|
mimeType: string;
|
@@ -300,6 +320,54 @@ interface FilePart {
|
|
300
320
|
Additional provider-specific metadata. They are passed through
|
301
321
|
to the provider from the AI SDK and enable provider-specific
|
302
322
|
functionality that can be fully encapsulated in the provider.
|
323
|
+
*/
|
324
|
+
providerOptions?: ProviderOptions;
|
325
|
+
/**
|
326
|
+
@deprecated Use `providerOptions` instead.
|
327
|
+
*/
|
328
|
+
experimental_providerMetadata?: ProviderMetadata;
|
329
|
+
}
|
330
|
+
/**
|
331
|
+
* Reasoning content part of a prompt. It contains a reasoning.
|
332
|
+
*/
|
333
|
+
interface ReasoningPart {
|
334
|
+
type: 'reasoning';
|
335
|
+
/**
|
336
|
+
The reasoning text.
|
337
|
+
*/
|
338
|
+
text: string;
|
339
|
+
/**
|
340
|
+
An optional signature for verifying that the reasoning originated from the model.
|
341
|
+
*/
|
342
|
+
signature?: string;
|
343
|
+
/**
|
344
|
+
Additional provider-specific metadata. They are passed through
|
345
|
+
to the provider from the AI SDK and enable provider-specific
|
346
|
+
functionality that can be fully encapsulated in the provider.
|
347
|
+
*/
|
348
|
+
providerOptions?: ProviderOptions;
|
349
|
+
/**
|
350
|
+
@deprecated Use `providerOptions` instead.
|
351
|
+
*/
|
352
|
+
experimental_providerMetadata?: ProviderMetadata;
|
353
|
+
}
|
354
|
+
/**
|
355
|
+
Redacted reasoning content part of a prompt.
|
356
|
+
*/
|
357
|
+
interface RedactedReasoningPart {
|
358
|
+
type: 'redacted-reasoning';
|
359
|
+
/**
|
360
|
+
Redacted reasoning data.
|
361
|
+
*/
|
362
|
+
data: string;
|
363
|
+
/**
|
364
|
+
Additional provider-specific metadata. They are passed through
|
365
|
+
to the provider from the AI SDK and enable provider-specific
|
366
|
+
functionality that can be fully encapsulated in the provider.
|
367
|
+
*/
|
368
|
+
providerOptions?: ProviderOptions;
|
369
|
+
/**
|
370
|
+
@deprecated Use `providerOptions` instead.
|
303
371
|
*/
|
304
372
|
experimental_providerMetadata?: ProviderMetadata;
|
305
373
|
}
|
@@ -324,6 +392,10 @@ interface ToolCallPart {
|
|
324
392
|
Additional provider-specific metadata. They are passed through
|
325
393
|
to the provider from the AI SDK and enable provider-specific
|
326
394
|
functionality that can be fully encapsulated in the provider.
|
395
|
+
*/
|
396
|
+
providerOptions?: ProviderOptions;
|
397
|
+
/**
|
398
|
+
@deprecated Use `providerOptions` instead.
|
327
399
|
*/
|
328
400
|
experimental_providerMetadata?: ProviderMetadata;
|
329
401
|
}
|
@@ -356,6 +428,10 @@ interface ToolResultPart {
|
|
356
428
|
Additional provider-specific metadata. They are passed through
|
357
429
|
to the provider from the AI SDK and enable provider-specific
|
358
430
|
functionality that can be fully encapsulated in the provider.
|
431
|
+
*/
|
432
|
+
providerOptions?: ProviderOptions;
|
433
|
+
/**
|
434
|
+
@deprecated Use `providerOptions` instead.
|
359
435
|
*/
|
360
436
|
experimental_providerMetadata?: ProviderMetadata;
|
361
437
|
}
|
@@ -374,6 +450,10 @@ type CoreSystemMessage = {
|
|
374
450
|
Additional provider-specific metadata. They are passed through
|
375
451
|
to the provider from the AI SDK and enable provider-specific
|
376
452
|
functionality that can be fully encapsulated in the provider.
|
453
|
+
*/
|
454
|
+
providerOptions?: ProviderOptions;
|
455
|
+
/**
|
456
|
+
@deprecated Use `providerOptions` instead.
|
377
457
|
*/
|
378
458
|
experimental_providerMetadata?: ProviderMetadata;
|
379
459
|
};
|
@@ -388,6 +468,10 @@ type CoreUserMessage = {
|
|
388
468
|
to the provider from the AI SDK and enable provider-specific
|
389
469
|
functionality that can be fully encapsulated in the provider.
|
390
470
|
*/
|
471
|
+
providerOptions?: ProviderOptions;
|
472
|
+
/**
|
473
|
+
@deprecated Use `providerOptions` instead.
|
474
|
+
*/
|
391
475
|
experimental_providerMetadata?: ProviderMetadata;
|
392
476
|
};
|
393
477
|
/**
|
@@ -405,12 +489,17 @@ type CoreAssistantMessage = {
|
|
405
489
|
to the provider from the AI SDK and enable provider-specific
|
406
490
|
functionality that can be fully encapsulated in the provider.
|
407
491
|
*/
|
492
|
+
providerOptions?: ProviderOptions;
|
493
|
+
/**
|
494
|
+
@deprecated Use `providerOptions` instead.
|
495
|
+
*/
|
408
496
|
experimental_providerMetadata?: ProviderMetadata;
|
409
497
|
};
|
410
498
|
/**
|
411
|
-
Content of an assistant message.
|
499
|
+
Content of an assistant message.
|
500
|
+
It can be a string or an array of text, image, reasoning, redacted reasoning, and tool call parts.
|
412
501
|
*/
|
413
|
-
type AssistantContent = string | Array<TextPart | ToolCallPart>;
|
502
|
+
type AssistantContent = string | Array<TextPart | FilePart | ReasoningPart | RedactedReasoningPart | ToolCallPart>;
|
414
503
|
/**
|
415
504
|
A tool message. It contains the result of one or more tool calls.
|
416
505
|
*/
|
@@ -422,6 +511,10 @@ type CoreToolMessage = {
|
|
422
511
|
to the provider from the AI SDK and enable provider-specific
|
423
512
|
functionality that can be fully encapsulated in the provider.
|
424
513
|
*/
|
514
|
+
providerOptions?: ProviderOptions;
|
515
|
+
/**
|
516
|
+
@deprecated Use `providerOptions` instead.
|
517
|
+
*/
|
425
518
|
experimental_providerMetadata?: ProviderMetadata;
|
426
519
|
};
|
427
520
|
/**
|
@@ -434,13 +527,6 @@ It can be a user message, an assistant message, or a tool message.
|
|
434
527
|
*/
|
435
528
|
type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage | CoreToolMessage;
|
436
529
|
|
437
|
-
type UIMessage = {
|
438
|
-
role: 'system' | 'user' | 'assistant' | 'data';
|
439
|
-
content: string;
|
440
|
-
toolInvocations?: ToolInvocation[];
|
441
|
-
experimental_attachments?: Attachment[];
|
442
|
-
};
|
443
|
-
|
444
530
|
/**
|
445
531
|
Prompt part of the AI function options.
|
446
532
|
It contains a system message, a simple text prompt, or a list of messages.
|
@@ -457,7 +543,7 @@ type Prompt = {
|
|
457
543
|
/**
|
458
544
|
A list of messages. You can either use `prompt` or `messages` but not both.
|
459
545
|
*/
|
460
|
-
messages?: Array<CoreMessage> | Array<
|
546
|
+
messages?: Array<CoreMessage> | Array<Omit<Message, 'id'>>;
|
461
547
|
};
|
462
548
|
|
463
549
|
type Streamable = ReactNode | Promise<ReactNode>;
|
@@ -498,7 +584,7 @@ type RenderResult = {
|
|
498
584
|
*/
|
499
585
|
declare function streamUI<TOOLS extends {
|
500
586
|
[name: string]: z.ZodTypeAny;
|
501
|
-
} = {}>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, initial, text, experimental_providerMetadata
|
587
|
+
} = {}>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, initial, text, experimental_providerMetadata, providerOptions, onFinish, ...settings }: CallSettings & Prompt & {
|
502
588
|
/**
|
503
589
|
* The language model to use.
|
504
590
|
*/
|
@@ -512,14 +598,18 @@ declare function streamUI<TOOLS extends {
|
|
512
598
|
/**
|
513
599
|
* The tool choice strategy. Default: 'auto'.
|
514
600
|
*/
|
515
|
-
toolChoice?:
|
601
|
+
toolChoice?: ToolChoice<TOOLS>;
|
516
602
|
text?: RenderText;
|
517
603
|
initial?: ReactNode;
|
518
604
|
/**
|
519
|
-
Additional provider-specific
|
605
|
+
Additional provider-specific options. They are passed through
|
520
606
|
to the provider from the AI SDK and enable provider-specific
|
521
607
|
functionality that can be fully encapsulated in the provider.
|
522
608
|
*/
|
609
|
+
providerOptions?: ProviderOptions;
|
610
|
+
/**
|
611
|
+
@deprecated Use `providerOptions` instead.
|
612
|
+
*/
|
523
613
|
experimental_providerMetadata?: ProviderMetadata;
|
524
614
|
/**
|
525
615
|
* Callback that is called when the LLM response and the final object validation are finished.
|