@mastra/schema-compat 1.2.9-alpha.1 → 1.2.10-alpha.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.
- package/CHANGELOG.md +14 -0
- package/dist/_types/@internal_ai-sdk-v4/dist/index.d.ts +51 -5
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +487 -1773
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +357 -1772
- package/dist/index.cjs +32 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -28
- package/dist/index.js.map +1 -1
- package/dist/provider-compats/google.d.ts +1 -0
- package/dist/provider-compats/google.d.ts.map +1 -1
- package/package.json +16 -16
|
@@ -76,33 +76,9 @@ export declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
76
76
|
*/
|
|
77
77
|
clearError: () => void;
|
|
78
78
|
addToolApprovalResponse: ChatAddToolApproveResponseFunction;
|
|
79
|
-
addToolOutput: <
|
|
80
|
-
state?: "output-available";
|
|
81
|
-
tool: TOOL;
|
|
82
|
-
toolCallId: string;
|
|
83
|
-
output: InferUIMessageTools<UI_MESSAGE>[TOOL]["output"];
|
|
84
|
-
errorText?: never;
|
|
85
|
-
} | {
|
|
86
|
-
state: "output-error";
|
|
87
|
-
tool: TOOL;
|
|
88
|
-
toolCallId: string;
|
|
89
|
-
output?: never;
|
|
90
|
-
errorText: string;
|
|
91
|
-
}) => Promise<void>;
|
|
79
|
+
addToolOutput: ChatAddToolOutputFunction<UI_MESSAGE>;
|
|
92
80
|
/** @deprecated Use addToolOutput */
|
|
93
|
-
addToolResult: <
|
|
94
|
-
state?: "output-available";
|
|
95
|
-
tool: TOOL;
|
|
96
|
-
toolCallId: string;
|
|
97
|
-
output: InferUIMessageTools<UI_MESSAGE>[TOOL]["output"];
|
|
98
|
-
errorText?: never;
|
|
99
|
-
} | {
|
|
100
|
-
state: "output-error";
|
|
101
|
-
tool: TOOL;
|
|
102
|
-
toolCallId: string;
|
|
103
|
-
output?: never;
|
|
104
|
-
errorText: string;
|
|
105
|
-
}) => Promise<void>;
|
|
81
|
+
addToolResult: ChatAddToolOutputFunction<UI_MESSAGE>;
|
|
106
82
|
/**
|
|
107
83
|
* Abort the current request immediately, keep the generated tokens if any.
|
|
108
84
|
*/
|
|
@@ -229,30 +205,10 @@ CALL_OPTIONS
|
|
|
229
205
|
* Timeout in milliseconds. Can be specified as a number or as an object with `totalMs`.
|
|
230
206
|
*/
|
|
231
207
|
timeout?: TimeoutConfiguration;
|
|
232
|
-
/**
|
|
233
|
-
* Callback that is called when the agent operation begins, before any LLM calls.
|
|
234
|
-
*/
|
|
235
|
-
experimental_onStart?: ToolLoopAgentOnStartCallback<TOOLS>;
|
|
236
|
-
/**
|
|
237
|
-
* Callback that is called when a step (LLM call) begins, before the provider is called.
|
|
238
|
-
*/
|
|
239
|
-
experimental_onStepStart?: ToolLoopAgentOnStepStartCallback<TOOLS>;
|
|
240
|
-
/**
|
|
241
|
-
* Callback that is called before each tool execution begins.
|
|
242
|
-
*/
|
|
243
|
-
experimental_onToolCallStart?: ToolLoopAgentOnToolCallStartCallback<TOOLS>;
|
|
244
|
-
/**
|
|
245
|
-
* Callback that is called after each tool execution completes.
|
|
246
|
-
*/
|
|
247
|
-
experimental_onToolCallFinish?: ToolLoopAgentOnToolCallFinishCallback<TOOLS>;
|
|
248
208
|
/**
|
|
249
209
|
* Callback that is called when each step (LLM call) is finished, including intermediate steps.
|
|
250
210
|
*/
|
|
251
211
|
onStepFinish?: ToolLoopAgentOnStepFinishCallback<TOOLS>;
|
|
252
|
-
/**
|
|
253
|
-
* Callback that is called when all steps are finished and the response is complete.
|
|
254
|
-
*/
|
|
255
|
-
onFinish?: ToolLoopAgentOnFinishCallback<TOOLS>;
|
|
256
212
|
};
|
|
257
213
|
|
|
258
214
|
/**
|
|
@@ -387,7 +343,7 @@ declare namespace _ai_sdk_provider {
|
|
|
387
343
|
TypeValidationContext,
|
|
388
344
|
TypeValidationError,
|
|
389
345
|
UnsupportedFunctionalityError,
|
|
390
|
-
|
|
346
|
+
getErrorMessage_2 as getErrorMessage,
|
|
391
347
|
isJSONArray,
|
|
392
348
|
isJSONObject,
|
|
393
349
|
isJSONValue
|
|
@@ -398,23 +354,23 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
398
354
|
export {
|
|
399
355
|
EventSourceMessage,
|
|
400
356
|
EventSourceParserStream,
|
|
401
|
-
|
|
402
|
-
|
|
357
|
+
AssistantContent,
|
|
358
|
+
AssistantModelMessage,
|
|
403
359
|
DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
404
|
-
|
|
360
|
+
DataContent,
|
|
405
361
|
DelayedPromise,
|
|
406
|
-
|
|
362
|
+
DownloadError,
|
|
407
363
|
FetchFunction,
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
364
|
+
FilePart,
|
|
365
|
+
FlexibleSchema,
|
|
366
|
+
IdGenerator,
|
|
367
|
+
ImagePart,
|
|
368
|
+
InferSchema,
|
|
369
|
+
InferToolInput,
|
|
370
|
+
InferToolOutput,
|
|
415
371
|
LazySchema,
|
|
416
372
|
MaybePromiseLike,
|
|
417
|
-
|
|
373
|
+
ModelMessage,
|
|
418
374
|
ParseResult,
|
|
419
375
|
ProviderOptions,
|
|
420
376
|
ProviderToolFactory,
|
|
@@ -422,29 +378,29 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
422
378
|
ReasoningPart,
|
|
423
379
|
Resolvable,
|
|
424
380
|
ResponseHandler,
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
381
|
+
Schema,
|
|
382
|
+
SystemModelMessage,
|
|
383
|
+
TextPart,
|
|
384
|
+
Tool,
|
|
385
|
+
ToolApprovalRequest,
|
|
386
|
+
ToolApprovalResponse,
|
|
431
387
|
ToolCall,
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
388
|
+
ToolCallOptions,
|
|
389
|
+
ToolCallPart,
|
|
390
|
+
ToolContent,
|
|
391
|
+
ToolExecuteFunction,
|
|
392
|
+
ToolExecutionOptions,
|
|
393
|
+
ToolModelMessage,
|
|
438
394
|
ToolNameMapping,
|
|
439
395
|
ToolNeedsApprovalFunction,
|
|
440
396
|
ToolResult,
|
|
441
397
|
ToolResultOutput,
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
398
|
+
ToolResultPart,
|
|
399
|
+
UserContent,
|
|
400
|
+
UserModelMessage,
|
|
445
401
|
VERSION,
|
|
446
402
|
ValidationResult,
|
|
447
|
-
|
|
403
|
+
asSchema,
|
|
448
404
|
combineHeaders,
|
|
449
405
|
convertAsyncIteratorToReadableStream,
|
|
450
406
|
convertBase64ToUint8Array,
|
|
@@ -454,7 +410,7 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
454
410
|
convertUint8ArrayToBase64,
|
|
455
411
|
createBinaryResponseHandler,
|
|
456
412
|
createEventSourceResponseHandler,
|
|
457
|
-
|
|
413
|
+
createIdGenerator,
|
|
458
414
|
createJsonErrorResponseHandler,
|
|
459
415
|
createJsonResponseHandler,
|
|
460
416
|
createProviderToolFactory,
|
|
@@ -463,10 +419,10 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
463
419
|
createToolNameMapping,
|
|
464
420
|
delay,
|
|
465
421
|
downloadBlob,
|
|
466
|
-
|
|
422
|
+
dynamicTool,
|
|
467
423
|
executeTool,
|
|
468
424
|
extractResponseHeaders,
|
|
469
|
-
|
|
425
|
+
generateId,
|
|
470
426
|
getErrorMessage,
|
|
471
427
|
getFromApi,
|
|
472
428
|
getRuntimeEnvironmentUserAgent,
|
|
@@ -475,7 +431,7 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
475
431
|
isNonNullable,
|
|
476
432
|
isParsableJson,
|
|
477
433
|
isUrlSupported,
|
|
478
|
-
|
|
434
|
+
jsonSchema,
|
|
479
435
|
lazySchema,
|
|
480
436
|
loadApiKey,
|
|
481
437
|
loadOptionalSetting,
|
|
@@ -483,7 +439,7 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
483
439
|
mediaTypeToExtension,
|
|
484
440
|
normalizeHeaders,
|
|
485
441
|
parseJSON,
|
|
486
|
-
|
|
442
|
+
parseJsonEventStream,
|
|
487
443
|
parseProviderOptions,
|
|
488
444
|
postFormDataToApi,
|
|
489
445
|
postJsonToApi,
|
|
@@ -494,123 +450,11 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
494
450
|
safeParseJSON,
|
|
495
451
|
safeValidateTypes,
|
|
496
452
|
stripFileExtension,
|
|
497
|
-
|
|
453
|
+
tool,
|
|
498
454
|
validateDownloadUrl,
|
|
499
455
|
validateTypes,
|
|
500
456
|
withUserAgentSuffix,
|
|
501
457
|
withoutTrailingSlash,
|
|
502
|
-
zodSchema_2 as zodSchema,
|
|
503
|
-
StandardJSONSchemaV1,
|
|
504
|
-
StandardSchemaV1,
|
|
505
|
-
StandardTypedV1
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
declare namespace _ai_sdk_provider_utils_2 {
|
|
510
|
-
export {
|
|
511
|
-
EventSourceMessage,
|
|
512
|
-
EventSourceParserStream,
|
|
513
|
-
AssistantContent,
|
|
514
|
-
AssistantModelMessage,
|
|
515
|
-
DEFAULT_MAX_DOWNLOAD_SIZE_2 as DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
516
|
-
DataContent,
|
|
517
|
-
DelayedPromise_2 as DelayedPromise,
|
|
518
|
-
DownloadError,
|
|
519
|
-
FetchFunction_2 as FetchFunction,
|
|
520
|
-
FilePart,
|
|
521
|
-
FlexibleSchema,
|
|
522
|
-
IdGenerator,
|
|
523
|
-
ImagePart,
|
|
524
|
-
InferSchema,
|
|
525
|
-
InferToolInput,
|
|
526
|
-
InferToolOutput,
|
|
527
|
-
LazySchema_2 as LazySchema,
|
|
528
|
-
MaybePromiseLike_2 as MaybePromiseLike,
|
|
529
|
-
ModelMessage,
|
|
530
|
-
ParseResult_2 as ParseResult,
|
|
531
|
-
ProviderOptions_2 as ProviderOptions,
|
|
532
|
-
ProviderToolFactory_2 as ProviderToolFactory,
|
|
533
|
-
ProviderToolFactoryWithOutputSchema_2 as ProviderToolFactoryWithOutputSchema,
|
|
534
|
-
ReasoningPart_2 as ReasoningPart,
|
|
535
|
-
Resolvable_2 as Resolvable,
|
|
536
|
-
ResponseHandler_2 as ResponseHandler,
|
|
537
|
-
Schema,
|
|
538
|
-
SystemModelMessage,
|
|
539
|
-
TextPart,
|
|
540
|
-
Tool,
|
|
541
|
-
ToolApprovalRequest,
|
|
542
|
-
ToolApprovalResponse,
|
|
543
|
-
ToolCall_2 as ToolCall,
|
|
544
|
-
ToolCallOptions,
|
|
545
|
-
ToolCallPart,
|
|
546
|
-
ToolContent,
|
|
547
|
-
ToolExecuteFunction,
|
|
548
|
-
ToolExecutionOptions,
|
|
549
|
-
ToolModelMessage,
|
|
550
|
-
ToolNameMapping_2 as ToolNameMapping,
|
|
551
|
-
ToolNeedsApprovalFunction_2 as ToolNeedsApprovalFunction,
|
|
552
|
-
ToolResult_2 as ToolResult,
|
|
553
|
-
ToolResultOutput_2 as ToolResultOutput,
|
|
554
|
-
ToolResultPart,
|
|
555
|
-
UserContent,
|
|
556
|
-
UserModelMessage,
|
|
557
|
-
VERSION_2 as VERSION,
|
|
558
|
-
ValidationResult_2 as ValidationResult,
|
|
559
|
-
asSchema,
|
|
560
|
-
combineHeaders_2 as combineHeaders,
|
|
561
|
-
convertAsyncIteratorToReadableStream_2 as convertAsyncIteratorToReadableStream,
|
|
562
|
-
convertBase64ToUint8Array_2 as convertBase64ToUint8Array,
|
|
563
|
-
convertImageModelFileToDataUri_2 as convertImageModelFileToDataUri,
|
|
564
|
-
convertToBase64_2 as convertToBase64,
|
|
565
|
-
convertToFormData_2 as convertToFormData,
|
|
566
|
-
convertUint8ArrayToBase64_2 as convertUint8ArrayToBase64,
|
|
567
|
-
createBinaryResponseHandler_2 as createBinaryResponseHandler,
|
|
568
|
-
createEventSourceResponseHandler_2 as createEventSourceResponseHandler,
|
|
569
|
-
createIdGenerator,
|
|
570
|
-
createJsonErrorResponseHandler_2 as createJsonErrorResponseHandler,
|
|
571
|
-
createJsonResponseHandler_2 as createJsonResponseHandler,
|
|
572
|
-
createProviderToolFactory_2 as createProviderToolFactory,
|
|
573
|
-
createProviderToolFactoryWithOutputSchema_2 as createProviderToolFactoryWithOutputSchema,
|
|
574
|
-
createStatusCodeErrorResponseHandler_2 as createStatusCodeErrorResponseHandler,
|
|
575
|
-
createToolNameMapping_2 as createToolNameMapping,
|
|
576
|
-
delay_2 as delay,
|
|
577
|
-
downloadBlob_2 as downloadBlob,
|
|
578
|
-
dynamicTool,
|
|
579
|
-
executeTool_2 as executeTool,
|
|
580
|
-
extractResponseHeaders_2 as extractResponseHeaders,
|
|
581
|
-
generateId,
|
|
582
|
-
getErrorMessage_2 as getErrorMessage,
|
|
583
|
-
getFromApi_2 as getFromApi,
|
|
584
|
-
getRuntimeEnvironmentUserAgent_2 as getRuntimeEnvironmentUserAgent,
|
|
585
|
-
injectJsonInstructionIntoMessages_2 as injectJsonInstructionIntoMessages,
|
|
586
|
-
isAbortError_2 as isAbortError,
|
|
587
|
-
isNonNullable_2 as isNonNullable,
|
|
588
|
-
isParsableJson_2 as isParsableJson,
|
|
589
|
-
isUrlSupported_2 as isUrlSupported,
|
|
590
|
-
jsonSchema,
|
|
591
|
-
lazySchema_2 as lazySchema,
|
|
592
|
-
loadApiKey_2 as loadApiKey,
|
|
593
|
-
loadOptionalSetting_2 as loadOptionalSetting,
|
|
594
|
-
loadSetting_2 as loadSetting,
|
|
595
|
-
mediaTypeToExtension_2 as mediaTypeToExtension,
|
|
596
|
-
normalizeHeaders_2 as normalizeHeaders,
|
|
597
|
-
parseJSON_2 as parseJSON,
|
|
598
|
-
parseJsonEventStream,
|
|
599
|
-
parseProviderOptions_2 as parseProviderOptions,
|
|
600
|
-
postFormDataToApi_2 as postFormDataToApi,
|
|
601
|
-
postJsonToApi_2 as postJsonToApi,
|
|
602
|
-
postToApi_2 as postToApi,
|
|
603
|
-
readResponseWithSizeLimit_2 as readResponseWithSizeLimit,
|
|
604
|
-
removeUndefinedEntries_2 as removeUndefinedEntries,
|
|
605
|
-
resolve_2 as resolve,
|
|
606
|
-
safeParseJSON_2 as safeParseJSON,
|
|
607
|
-
safeValidateTypes_2 as safeValidateTypes,
|
|
608
|
-
stripFileExtension_2 as stripFileExtension,
|
|
609
|
-
tool,
|
|
610
|
-
validateDownloadUrl_2 as validateDownloadUrl,
|
|
611
|
-
validateTypes_2 as validateTypes,
|
|
612
|
-
withUserAgentSuffix_2 as withUserAgentSuffix,
|
|
613
|
-
withoutTrailingSlash_2 as withoutTrailingSlash,
|
|
614
458
|
zodSchema,
|
|
615
459
|
StandardJSONSchemaV1,
|
|
616
460
|
StandardSchemaV1,
|
|
@@ -676,19 +520,11 @@ export declare class APICallError extends AISDKError {
|
|
|
676
520
|
|
|
677
521
|
export declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
|
|
678
522
|
|
|
679
|
-
declare function asSchema_2<OBJECT>(schema: FlexibleSchema_2<OBJECT> | undefined): Schema_2<OBJECT>;
|
|
680
|
-
|
|
681
|
-
/**
|
|
682
|
-
* Content of an assistant message.
|
|
683
|
-
* It can be a string or an array of text, image, reasoning, redacted reasoning, and tool call parts.
|
|
684
|
-
*/
|
|
685
|
-
export declare type AssistantContent = string | Array<TextPart | FilePart | ReasoningPart_2 | ToolCallPart | ToolResultPart | ToolApprovalRequest>;
|
|
686
|
-
|
|
687
523
|
/**
|
|
688
524
|
* Content of an assistant message.
|
|
689
525
|
* It can be a string or an array of text, image, reasoning, redacted reasoning, and tool call parts.
|
|
690
526
|
*/
|
|
691
|
-
declare type
|
|
527
|
+
export declare type AssistantContent = string | Array<TextPart | FilePart | ReasoningPart | ToolCallPart | ToolResultPart | ToolApprovalRequest>;
|
|
692
528
|
|
|
693
529
|
/**
|
|
694
530
|
* An assistant message. It can contain text, tool calls, or a combination of text and tool calls.
|
|
@@ -696,20 +532,6 @@ declare type AssistantContent_2 = string | Array<TextPart_2 | FilePart_2 | Reaso
|
|
|
696
532
|
export declare type AssistantModelMessage = {
|
|
697
533
|
role: 'assistant';
|
|
698
534
|
content: AssistantContent;
|
|
699
|
-
/**
|
|
700
|
-
* Additional provider-specific metadata. They are passed through
|
|
701
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
702
|
-
* functionality that can be fully encapsulated in the provider.
|
|
703
|
-
*/
|
|
704
|
-
providerOptions?: ProviderOptions_2;
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
/**
|
|
708
|
-
* An assistant message. It can contain text, tool calls, or a combination of text and tool calls.
|
|
709
|
-
*/
|
|
710
|
-
declare type AssistantModelMessage_2 = {
|
|
711
|
-
role: 'assistant';
|
|
712
|
-
content: AssistantContent_2;
|
|
713
535
|
/**
|
|
714
536
|
* Additional provider-specific metadata. They are passed through
|
|
715
537
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -732,6 +554,8 @@ export declare type AsyncIterableStream<T> = AsyncIterable<T> & ReadableStream<T
|
|
|
732
554
|
* Attributes is a map from string to attribute values.
|
|
733
555
|
*
|
|
734
556
|
* Note: only the own enumerable keys are counted as valid attribute keys.
|
|
557
|
+
*
|
|
558
|
+
* @since 1.3.0
|
|
735
559
|
*/
|
|
736
560
|
declare interface Attributes {
|
|
737
561
|
[attributeKey: string]: AttributeValue | undefined;
|
|
@@ -741,6 +565,8 @@ declare interface Attributes {
|
|
|
741
565
|
* Attribute values may be any non-nullish primitive value except an object.
|
|
742
566
|
*
|
|
743
567
|
* null or undefined attribute values are invalid and will result in undefined behavior.
|
|
568
|
+
*
|
|
569
|
+
* @since 1.3.0
|
|
744
570
|
*/
|
|
745
571
|
declare type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
|
|
746
572
|
|
|
@@ -871,7 +697,7 @@ export declare type CallWarning = SharedV3Warning;
|
|
|
871
697
|
/**
|
|
872
698
|
* Function that can be called to add a tool approval response to the chat.
|
|
873
699
|
*/
|
|
874
|
-
export declare type ChatAddToolApproveResponseFunction = ({ id, approved, reason, }: {
|
|
700
|
+
export declare type ChatAddToolApproveResponseFunction = ({ id, approved, reason, options, }: {
|
|
875
701
|
id: string;
|
|
876
702
|
/**
|
|
877
703
|
* Flag indicating whether the approval was granted or denied.
|
|
@@ -881,8 +707,38 @@ export declare type ChatAddToolApproveResponseFunction = ({ id, approved, reason
|
|
|
881
707
|
* Optional reason for the approval or denial.
|
|
882
708
|
*/
|
|
883
709
|
reason?: string;
|
|
710
|
+
/**
|
|
711
|
+
* Optional request options to be used if `sendAutomaticallyWhen` callback returns true.
|
|
712
|
+
*/
|
|
713
|
+
options?: ChatRequestOptions;
|
|
884
714
|
}) => void | PromiseLike<void>;
|
|
885
715
|
|
|
716
|
+
/**
|
|
717
|
+
* Function that can be called to add a tool output to the chat.
|
|
718
|
+
*/
|
|
719
|
+
export declare type ChatAddToolOutputFunction<UI_MESSAGE extends UIMessage> = <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ state, tool, toolCallId, output, errorText, options, }: {
|
|
720
|
+
/**
|
|
721
|
+
* Name of the tool that was called.
|
|
722
|
+
*/
|
|
723
|
+
tool: TOOL;
|
|
724
|
+
/**
|
|
725
|
+
* Identifier of the tool call to add output for.
|
|
726
|
+
*/
|
|
727
|
+
toolCallId: string;
|
|
728
|
+
/**
|
|
729
|
+
* Optional request options to be used if `sendAutomaticallyWhen` callback returns true.
|
|
730
|
+
*/
|
|
731
|
+
options?: ChatRequestOptions;
|
|
732
|
+
} & ({
|
|
733
|
+
state?: 'output-available';
|
|
734
|
+
output: InferUIMessageTools<UI_MESSAGE>[TOOL]['output'];
|
|
735
|
+
errorText?: never;
|
|
736
|
+
} | {
|
|
737
|
+
state: 'output-error';
|
|
738
|
+
output?: never;
|
|
739
|
+
errorText: string;
|
|
740
|
+
})) => void | PromiseLike<void>;
|
|
741
|
+
|
|
886
742
|
export declare interface ChatInit<UI_MESSAGE extends UIMessage> {
|
|
887
743
|
/**
|
|
888
744
|
* A unique identifier for the chat. If not provided, a random one will be
|
|
@@ -1067,8 +923,6 @@ export declare type ChunkDetector = (buffer: string) => string | undefined | nul
|
|
|
1067
923
|
|
|
1068
924
|
declare function combineHeaders(...headers: Array<Record<string, string | undefined> | undefined>): Record<string, string | undefined>;
|
|
1069
925
|
|
|
1070
|
-
declare function combineHeaders_2(...headers: Array<Record<string, string | undefined> | undefined>): Record<string, string | undefined>;
|
|
1071
|
-
|
|
1072
926
|
export declare type CompletionRequestOptions = {
|
|
1073
927
|
/**
|
|
1074
928
|
* An optional object of headers to be passed to the API endpoint.
|
|
@@ -1125,6 +979,9 @@ export declare type ContentPart<TOOLS extends ToolSet> = {
|
|
|
1125
979
|
providerMetadata?: ProviderMetadata;
|
|
1126
980
|
}) | ToolApprovalRequestOutput<TOOLS>;
|
|
1127
981
|
|
|
982
|
+
/**
|
|
983
|
+
* @since 1.0.0
|
|
984
|
+
*/
|
|
1128
985
|
declare interface Context {
|
|
1129
986
|
/**
|
|
1130
987
|
* Get a value from the context.
|
|
@@ -1158,19 +1015,8 @@ declare interface Context {
|
|
|
1158
1015
|
*/
|
|
1159
1016
|
declare function convertAsyncIteratorToReadableStream<T>(iterator: AsyncIterator<T>): ReadableStream<T>;
|
|
1160
1017
|
|
|
1161
|
-
/**
|
|
1162
|
-
* Converts an AsyncIterator to a ReadableStream.
|
|
1163
|
-
*
|
|
1164
|
-
* @template T - The type of elements produced by the AsyncIterator.
|
|
1165
|
-
* @param { <T>} iterator - The AsyncIterator to convert.
|
|
1166
|
-
* @returns {ReadableStream<T>} - A ReadableStream that provides the same data as the AsyncIterator.
|
|
1167
|
-
*/
|
|
1168
|
-
declare function convertAsyncIteratorToReadableStream_2<T>(iterator: AsyncIterator<T>): ReadableStream<T>;
|
|
1169
|
-
|
|
1170
1018
|
declare function convertBase64ToUint8Array(base64String: string): Uint8Array<ArrayBuffer>;
|
|
1171
1019
|
|
|
1172
|
-
declare function convertBase64ToUint8Array_2(base64String: string): Uint8Array<ArrayBuffer>;
|
|
1173
|
-
|
|
1174
1020
|
export declare function convertFileListToFileUIParts(files: FileList | undefined): Promise<Array<FileUIPart>>;
|
|
1175
1021
|
|
|
1176
1022
|
/**
|
|
@@ -1182,19 +1028,8 @@ export declare function convertFileListToFileUIParts(files: FileList | undefined
|
|
|
1182
1028
|
*/
|
|
1183
1029
|
declare function convertImageModelFileToDataUri(file: ImageModelV3File): string;
|
|
1184
1030
|
|
|
1185
|
-
/**
|
|
1186
|
-
* Convert an ImageModelV3File to a URL or data URI string.
|
|
1187
|
-
*
|
|
1188
|
-
* If the file is a URL, it returns the URL as-is.
|
|
1189
|
-
* If the file is base64 data, it returns a data URI with the base64 data.
|
|
1190
|
-
* If the file is a Uint8Array, it converts it to base64 and returns a data URI.
|
|
1191
|
-
*/
|
|
1192
|
-
declare function convertImageModelFileToDataUri_2(file: ImageModelV3File): string;
|
|
1193
|
-
|
|
1194
1031
|
declare function convertToBase64(value: string | Uint8Array): string;
|
|
1195
1032
|
|
|
1196
|
-
declare function convertToBase64_2(value: string | Uint8Array): string;
|
|
1197
|
-
|
|
1198
1033
|
/**
|
|
1199
1034
|
* Converts an input object to FormData for multipart/form-data requests.
|
|
1200
1035
|
*
|
|
@@ -1230,41 +1065,6 @@ declare function convertToFormData<T extends Record<string, unknown>>(input: T,
|
|
|
1230
1065
|
useArrayBrackets?: boolean;
|
|
1231
1066
|
}): FormData;
|
|
1232
1067
|
|
|
1233
|
-
/**
|
|
1234
|
-
* Converts an input object to FormData for multipart/form-data requests.
|
|
1235
|
-
*
|
|
1236
|
-
* Handles the following cases:
|
|
1237
|
-
* - `null` or `undefined` values are skipped
|
|
1238
|
-
* - Arrays with a single element are appended as a single value
|
|
1239
|
-
* - Arrays with multiple elements are appended with `[]` suffix (e.g., `image[]`)
|
|
1240
|
-
* unless `useArrayBrackets` is set to `false`
|
|
1241
|
-
* - All other values are appended directly
|
|
1242
|
-
*
|
|
1243
|
-
* @param input - The input object to convert. Use a generic type for type validation.
|
|
1244
|
-
* @param options - Optional configuration object.
|
|
1245
|
-
* @param options.useArrayBrackets - Whether to add `[]` suffix for multi-element arrays.
|
|
1246
|
-
* Defaults to `true`. Set to `false` for APIs that expect repeated keys without brackets.
|
|
1247
|
-
* @returns A FormData object containing the input values.
|
|
1248
|
-
*
|
|
1249
|
-
* @example
|
|
1250
|
-
* ```ts
|
|
1251
|
-
* type MyInput = {
|
|
1252
|
-
* model: string;
|
|
1253
|
-
* prompt: string;
|
|
1254
|
-
* images: Blob[];
|
|
1255
|
-
* };
|
|
1256
|
-
*
|
|
1257
|
-
* const formData = convertToFormData<MyInput>({
|
|
1258
|
-
* model: 'gpt-image-1',
|
|
1259
|
-
* prompt: 'A cat',
|
|
1260
|
-
* images: [blob1, blob2],
|
|
1261
|
-
* });
|
|
1262
|
-
* ```
|
|
1263
|
-
*/
|
|
1264
|
-
declare function convertToFormData_2<T extends Record<string, unknown>>(input: T, options?: {
|
|
1265
|
-
useArrayBrackets?: boolean;
|
|
1266
|
-
}): FormData;
|
|
1267
|
-
|
|
1268
1068
|
/**
|
|
1269
1069
|
* Converts an array of UI messages from useChat into an array of ModelMessages that can be used
|
|
1270
1070
|
* with the AI functions (e.g. `streamText`, `generateText`).
|
|
@@ -1284,8 +1084,6 @@ export declare function convertToModelMessages<UI_MESSAGE extends UIMessage>(mes
|
|
|
1284
1084
|
|
|
1285
1085
|
declare function convertUint8ArrayToBase64(array: Uint8Array): string;
|
|
1286
1086
|
|
|
1287
|
-
declare function convertUint8ArrayToBase64_2(array: Uint8Array): string;
|
|
1288
|
-
|
|
1289
1087
|
/**
|
|
1290
1088
|
* Calculates the cosine similarity between two vectors. This is a useful metric for
|
|
1291
1089
|
* comparing the similarity of two vectors such as embeddings.
|
|
@@ -1351,8 +1149,6 @@ export declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS
|
|
|
1351
1149
|
|
|
1352
1150
|
declare const createBinaryResponseHandler: () => ResponseHandler<Uint8Array>;
|
|
1353
1151
|
|
|
1354
|
-
declare const createBinaryResponseHandler_2: () => ResponseHandler_2<Uint8Array>;
|
|
1355
|
-
|
|
1356
1152
|
/**
|
|
1357
1153
|
* Creates a download function with configurable options.
|
|
1358
1154
|
*
|
|
@@ -1370,9 +1166,7 @@ export declare function createDownload(options?: {
|
|
|
1370
1166
|
mediaType: string | undefined;
|
|
1371
1167
|
}>;
|
|
1372
1168
|
|
|
1373
|
-
declare const createEventSourceResponseHandler: <T>(chunkSchema:
|
|
1374
|
-
|
|
1375
|
-
declare const createEventSourceResponseHandler_2: <T>(chunkSchema: FlexibleSchema<T>) => ResponseHandler_2<ReadableStream<ParseResult_2<T>>>;
|
|
1169
|
+
declare const createEventSourceResponseHandler: <T>(chunkSchema: FlexibleSchema<T>) => ResponseHandler<ReadableStream<ParseResult<T>>>;
|
|
1376
1170
|
|
|
1377
1171
|
/**
|
|
1378
1172
|
* Create a remote provider instance.
|
|
@@ -1396,38 +1190,13 @@ export declare const createIdGenerator: ({ prefix, size, alphabet, separator, }?
|
|
|
1396
1190
|
alphabet?: string;
|
|
1397
1191
|
}) => IdGenerator;
|
|
1398
1192
|
|
|
1399
|
-
/**
|
|
1400
|
-
* Creates an ID generator.
|
|
1401
|
-
* The total length of the ID is the sum of the prefix, separator, and random part length.
|
|
1402
|
-
* Not cryptographically secure.
|
|
1403
|
-
*
|
|
1404
|
-
* @param alphabet - The alphabet to use for the ID. Default: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.
|
|
1405
|
-
* @param prefix - The prefix of the ID to generate. Optional.
|
|
1406
|
-
* @param separator - The separator between the prefix and the random part of the ID. Default: '-'.
|
|
1407
|
-
* @param size - The size of the random part of the ID to generate. Default: 16.
|
|
1408
|
-
*/
|
|
1409
|
-
declare const createIdGenerator_2: ({ prefix, size, alphabet, separator, }?: {
|
|
1410
|
-
prefix?: string;
|
|
1411
|
-
separator?: string;
|
|
1412
|
-
size?: number;
|
|
1413
|
-
alphabet?: string;
|
|
1414
|
-
}) => IdGenerator_2;
|
|
1415
|
-
|
|
1416
1193
|
declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage, isRetryable, }: {
|
|
1417
|
-
errorSchema: FlexibleSchema_2<T>;
|
|
1418
|
-
errorToMessage: (error: T) => string;
|
|
1419
|
-
isRetryable?: (response: Response, error?: T) => boolean;
|
|
1420
|
-
}) => ResponseHandler<APICallError>;
|
|
1421
|
-
|
|
1422
|
-
declare const createJsonErrorResponseHandler_2: <T>({ errorSchema, errorToMessage, isRetryable, }: {
|
|
1423
1194
|
errorSchema: FlexibleSchema<T>;
|
|
1424
1195
|
errorToMessage: (error: T) => string;
|
|
1425
1196
|
isRetryable?: (response: Response, error?: T) => boolean;
|
|
1426
|
-
}) =>
|
|
1427
|
-
|
|
1428
|
-
declare const createJsonResponseHandler: <T>(responseSchema: FlexibleSchema_2<T>) => ResponseHandler<T>;
|
|
1197
|
+
}) => ResponseHandler<APICallError>;
|
|
1429
1198
|
|
|
1430
|
-
declare const
|
|
1199
|
+
declare const createJsonResponseHandler: <T>(responseSchema: FlexibleSchema<T>) => ResponseHandler<T>;
|
|
1431
1200
|
|
|
1432
1201
|
/**
|
|
1433
1202
|
* Creates a registry for the given providers with optional middleware functionality.
|
|
@@ -1449,33 +1218,11 @@ export declare function createProviderRegistry<PROVIDERS extends Record<string,
|
|
|
1449
1218
|
}): ProviderRegistryProvider<PROVIDERS, SEPARATOR>;
|
|
1450
1219
|
|
|
1451
1220
|
declare function createProviderToolFactory<INPUT, ARGS extends object>({ id, inputSchema, }: {
|
|
1452
|
-
id: `${string}.${string}`;
|
|
1453
|
-
inputSchema: FlexibleSchema_2<INPUT>;
|
|
1454
|
-
}): ProviderToolFactory<INPUT, ARGS>;
|
|
1455
|
-
|
|
1456
|
-
declare function createProviderToolFactory_2<INPUT, ARGS extends object>({ id, inputSchema, }: {
|
|
1457
1221
|
id: `${string}.${string}`;
|
|
1458
1222
|
inputSchema: FlexibleSchema<INPUT>;
|
|
1459
|
-
}):
|
|
1223
|
+
}): ProviderToolFactory<INPUT, ARGS>;
|
|
1460
1224
|
|
|
1461
1225
|
declare function createProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends object>({ id, inputSchema, outputSchema, supportsDeferredResults, }: {
|
|
1462
|
-
id: `${string}.${string}`;
|
|
1463
|
-
inputSchema: FlexibleSchema_2<INPUT>;
|
|
1464
|
-
outputSchema: FlexibleSchema_2<OUTPUT>;
|
|
1465
|
-
/**
|
|
1466
|
-
* Whether this provider-executed tool supports deferred results.
|
|
1467
|
-
*
|
|
1468
|
-
* When true, the tool result may not be returned in the same turn as the
|
|
1469
|
-
* tool call (e.g., when using programmatic tool calling where a server tool
|
|
1470
|
-
* triggers a client-executed tool, and the server tool's result is deferred
|
|
1471
|
-
* until the client tool is resolved).
|
|
1472
|
-
*
|
|
1473
|
-
* @default false
|
|
1474
|
-
*/
|
|
1475
|
-
supportsDeferredResults?: boolean;
|
|
1476
|
-
}): ProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS>;
|
|
1477
|
-
|
|
1478
|
-
declare function createProviderToolFactoryWithOutputSchema_2<INPUT, OUTPUT, ARGS extends object>({ id, inputSchema, outputSchema, supportsDeferredResults, }: {
|
|
1479
1226
|
id: `${string}.${string}`;
|
|
1480
1227
|
inputSchema: FlexibleSchema<INPUT>;
|
|
1481
1228
|
outputSchema: FlexibleSchema<OUTPUT>;
|
|
@@ -1490,12 +1237,10 @@ declare function createProviderToolFactoryWithOutputSchema_2<INPUT, OUTPUT, ARGS
|
|
|
1490
1237
|
* @default false
|
|
1491
1238
|
*/
|
|
1492
1239
|
supportsDeferredResults?: boolean;
|
|
1493
|
-
}):
|
|
1240
|
+
}): ProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS>;
|
|
1494
1241
|
|
|
1495
1242
|
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
|
|
1496
1243
|
|
|
1497
|
-
declare const createStatusCodeErrorResponseHandler_2: () => ResponseHandler_2<APICallError>;
|
|
1498
|
-
|
|
1499
1244
|
/**
|
|
1500
1245
|
* Creates a Response object from a text stream.
|
|
1501
1246
|
* Each text chunk is encoded as UTF-8 and sent as a separate chunk.
|
|
@@ -1532,26 +1277,6 @@ declare function createToolNameMapping({ tools, providerToolNames, resolveProvid
|
|
|
1532
1277
|
resolveProviderToolName?: (tool: LanguageModelV3ProviderTool) => string | undefined;
|
|
1533
1278
|
}): ToolNameMapping;
|
|
1534
1279
|
|
|
1535
|
-
/**
|
|
1536
|
-
* @param tools - Tools that were passed to the language model.
|
|
1537
|
-
* @param providerToolNames - Maps the provider tool ids to the provider tool names.
|
|
1538
|
-
*/
|
|
1539
|
-
declare function createToolNameMapping_2({ tools, providerToolNames, resolveProviderToolName, }: {
|
|
1540
|
-
/**
|
|
1541
|
-
* Tools that were passed to the language model.
|
|
1542
|
-
*/
|
|
1543
|
-
tools: Array<LanguageModelV3FunctionTool | LanguageModelV3ProviderTool> | undefined;
|
|
1544
|
-
/**
|
|
1545
|
-
* Maps the provider tool ids to the provider tool names.
|
|
1546
|
-
*/
|
|
1547
|
-
providerToolNames: Record<`${string}.${string}`, string>;
|
|
1548
|
-
/**
|
|
1549
|
-
* Optional resolver for provider tool names that cannot be represented as
|
|
1550
|
-
* static id -> name mappings (e.g. dynamic provider names).
|
|
1551
|
-
*/
|
|
1552
|
-
resolveProviderToolName?: (tool: LanguageModelV3ProviderTool) => string | undefined;
|
|
1553
|
-
}): ToolNameMapping_2;
|
|
1554
|
-
|
|
1555
1280
|
export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESSAGE, 'id' | 'role'> & {
|
|
1556
1281
|
id?: UI_MESSAGE['id'];
|
|
1557
1282
|
role?: UI_MESSAGE['role'];
|
|
@@ -1643,11 +1368,6 @@ export declare function customProvider<LANGUAGE_MODELS extends Record<string, La
|
|
|
1643
1368
|
*/
|
|
1644
1369
|
export declare type DataContent = string | Uint8Array | ArrayBuffer | Buffer;
|
|
1645
1370
|
|
|
1646
|
-
/**
|
|
1647
|
-
* Data content. Can either be a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer.
|
|
1648
|
-
*/
|
|
1649
|
-
declare type DataContent_2 = string | Uint8Array | ArrayBuffer | Buffer;
|
|
1650
|
-
|
|
1651
1371
|
declare type DataUIMessageChunk<DATA_TYPES extends UIDataTypes> = ValueOf<{
|
|
1652
1372
|
[NAME in keyof DATA_TYPES & string]: {
|
|
1653
1373
|
type: `data-${NAME}`;
|
|
@@ -1689,19 +1409,6 @@ declare type DeepPartialInternal<T> = T extends null | undefined | string | numb
|
|
|
1689
1409
|
*/
|
|
1690
1410
|
declare const DEFAULT_MAX_DOWNLOAD_SIZE: number;
|
|
1691
1411
|
|
|
1692
|
-
/**
|
|
1693
|
-
* Default maximum download size: 2 GiB.
|
|
1694
|
-
*
|
|
1695
|
-
* `fetch().arrayBuffer()` has ~2x peak memory overhead (undici buffers the
|
|
1696
|
-
* body internally, then creates the JS ArrayBuffer), so very large downloads
|
|
1697
|
-
* risk exceeding the default V8 heap limit on 64-bit systems and terminating
|
|
1698
|
-
* the process with an out-of-memory error.
|
|
1699
|
-
*
|
|
1700
|
-
* Setting this limit converts an unrecoverable OOM crash into a catchable
|
|
1701
|
-
* `DownloadError`.
|
|
1702
|
-
*/
|
|
1703
|
-
declare const DEFAULT_MAX_DOWNLOAD_SIZE_2: number;
|
|
1704
|
-
|
|
1705
1412
|
export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends HttpChatTransport<UI_MESSAGE> {
|
|
1706
1413
|
constructor(options?: HttpChatTransportInitOptions<UI_MESSAGE>);
|
|
1707
1414
|
protected processResponseStream(stream: ReadableStream<Uint8Array<ArrayBufferLike>>): ReadableStream<UIMessageChunk>;
|
|
@@ -1761,17 +1468,6 @@ declare function delay(delayInMs?: number | null, options?: {
|
|
|
1761
1468
|
abortSignal?: AbortSignal;
|
|
1762
1469
|
}): Promise<void>;
|
|
1763
1470
|
|
|
1764
|
-
/**
|
|
1765
|
-
* Creates a Promise that resolves after a specified delay
|
|
1766
|
-
* @param delayInMs - The delay duration in milliseconds. If null or undefined, resolves immediately.
|
|
1767
|
-
* @param signal - Optional AbortSignal to cancel the delay
|
|
1768
|
-
* @returns A Promise that resolves after the specified delay
|
|
1769
|
-
* @throws {DOMException} When the signal is aborted
|
|
1770
|
-
*/
|
|
1771
|
-
declare function delay_2(delayInMs?: number | null, options?: {
|
|
1772
|
-
abortSignal?: AbortSignal;
|
|
1773
|
-
}): Promise<void>;
|
|
1774
|
-
|
|
1775
1471
|
/**
|
|
1776
1472
|
* Delayed promise. It is only constructed once the value is accessed.
|
|
1777
1473
|
* This is useful to avoid unhandled promise rejections when the promise is created
|
|
@@ -1790,24 +1486,6 @@ declare class DelayedPromise<T> {
|
|
|
1790
1486
|
isPending(): boolean;
|
|
1791
1487
|
}
|
|
1792
1488
|
|
|
1793
|
-
/**
|
|
1794
|
-
* Delayed promise. It is only constructed once the value is accessed.
|
|
1795
|
-
* This is useful to avoid unhandled promise rejections when the promise is created
|
|
1796
|
-
* but not accessed.
|
|
1797
|
-
*/
|
|
1798
|
-
declare class DelayedPromise_2<T> {
|
|
1799
|
-
private status;
|
|
1800
|
-
private _promise;
|
|
1801
|
-
private _resolve;
|
|
1802
|
-
private _reject;
|
|
1803
|
-
get promise(): Promise<T>;
|
|
1804
|
-
resolve(value: T): void;
|
|
1805
|
-
reject(error: unknown): void;
|
|
1806
|
-
isResolved(): boolean;
|
|
1807
|
-
isRejected(): boolean;
|
|
1808
|
-
isPending(): boolean;
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
1489
|
/**
|
|
1812
1490
|
* A transport that directly communicates with an Agent in-process,
|
|
1813
1491
|
* without going through HTTP. This is useful for:
|
|
@@ -1871,22 +1549,6 @@ declare function downloadBlob(url: string, options?: {
|
|
|
1871
1549
|
abortSignal?: AbortSignal;
|
|
1872
1550
|
}): Promise<Blob>;
|
|
1873
1551
|
|
|
1874
|
-
/**
|
|
1875
|
-
* Download a file from a URL and return it as a Blob.
|
|
1876
|
-
*
|
|
1877
|
-
* @param url - The URL to download from.
|
|
1878
|
-
* @param options - Optional settings for the download.
|
|
1879
|
-
* @param options.maxBytes - Maximum allowed download size in bytes. Defaults to 100 MiB.
|
|
1880
|
-
* @param options.abortSignal - An optional abort signal to cancel the download.
|
|
1881
|
-
* @returns A Promise that resolves to the downloaded Blob.
|
|
1882
|
-
*
|
|
1883
|
-
* @throws DownloadError if the download fails or exceeds maxBytes.
|
|
1884
|
-
*/
|
|
1885
|
-
declare function downloadBlob_2(url: string, options?: {
|
|
1886
|
-
maxBytes?: number;
|
|
1887
|
-
abortSignal?: AbortSignal;
|
|
1888
|
-
}): Promise<Blob>;
|
|
1889
|
-
|
|
1890
1552
|
export declare class DownloadError extends AISDKError {
|
|
1891
1553
|
private readonly [symbol_2];
|
|
1892
1554
|
readonly url: string;
|
|
@@ -1902,66 +1564,16 @@ export declare class DownloadError extends AISDKError {
|
|
|
1902
1564
|
static isInstance(error: unknown): error is DownloadError;
|
|
1903
1565
|
}
|
|
1904
1566
|
|
|
1905
|
-
declare class DownloadError_2 extends AISDKError {
|
|
1906
|
-
private readonly [symbol];
|
|
1907
|
-
readonly url: string;
|
|
1908
|
-
readonly statusCode?: number;
|
|
1909
|
-
readonly statusText?: string;
|
|
1910
|
-
constructor({ url, statusCode, statusText, cause, message, }: {
|
|
1911
|
-
url: string;
|
|
1912
|
-
statusCode?: number;
|
|
1913
|
-
statusText?: string;
|
|
1914
|
-
message?: string;
|
|
1915
|
-
cause?: unknown;
|
|
1916
|
-
});
|
|
1917
|
-
static isInstance(error: unknown): error is DownloadError_2;
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
1567
|
/**
|
|
1921
1568
|
* Defines a dynamic tool.
|
|
1922
1569
|
*/
|
|
1923
1570
|
export declare function dynamicTool(tool: {
|
|
1924
1571
|
description?: string;
|
|
1925
1572
|
title?: string;
|
|
1926
|
-
providerOptions?:
|
|
1573
|
+
providerOptions?: ProviderOptions;
|
|
1574
|
+
providerMetadata?: SharedV3ProviderMetadata;
|
|
1927
1575
|
inputSchema: FlexibleSchema<unknown>;
|
|
1928
1576
|
execute: ToolExecuteFunction<unknown, unknown>;
|
|
1929
|
-
/**
|
|
1930
|
-
* Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
1931
|
-
*
|
|
1932
|
-
* If not provided, the tool result will be sent as a JSON object.
|
|
1933
|
-
*/
|
|
1934
|
-
toModelOutput?: (options: {
|
|
1935
|
-
/**
|
|
1936
|
-
* The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
|
|
1937
|
-
*/
|
|
1938
|
-
toolCallId: string;
|
|
1939
|
-
/**
|
|
1940
|
-
* The input of the tool call.
|
|
1941
|
-
*/
|
|
1942
|
-
input: unknown;
|
|
1943
|
-
/**
|
|
1944
|
-
* The output of the tool call.
|
|
1945
|
-
*/
|
|
1946
|
-
output: unknown;
|
|
1947
|
-
}) => ToolResultOutput_2 | PromiseLike<ToolResultOutput_2>;
|
|
1948
|
-
/**
|
|
1949
|
-
* Whether the tool needs approval before it can be executed.
|
|
1950
|
-
*/
|
|
1951
|
-
needsApproval?: boolean | ToolNeedsApprovalFunction_2<unknown>;
|
|
1952
|
-
}): Tool<unknown, unknown> & {
|
|
1953
|
-
type: 'dynamic';
|
|
1954
|
-
};
|
|
1955
|
-
|
|
1956
|
-
/**
|
|
1957
|
-
* Defines a dynamic tool.
|
|
1958
|
-
*/
|
|
1959
|
-
declare function dynamicTool_2(tool: {
|
|
1960
|
-
description?: string;
|
|
1961
|
-
title?: string;
|
|
1962
|
-
providerOptions?: ProviderOptions;
|
|
1963
|
-
inputSchema: FlexibleSchema_2<unknown>;
|
|
1964
|
-
execute: ToolExecuteFunction_2<unknown, unknown>;
|
|
1965
1577
|
/**
|
|
1966
1578
|
* Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
1967
1579
|
*
|
|
@@ -1985,7 +1597,7 @@ declare function dynamicTool_2(tool: {
|
|
|
1985
1597
|
* Whether the tool needs approval before it can be executed.
|
|
1986
1598
|
*/
|
|
1987
1599
|
needsApproval?: boolean | ToolNeedsApprovalFunction<unknown>;
|
|
1988
|
-
}):
|
|
1600
|
+
}): Tool<unknown, unknown> & {
|
|
1989
1601
|
type: 'dynamic';
|
|
1990
1602
|
};
|
|
1991
1603
|
|
|
@@ -2087,6 +1699,7 @@ export declare type DynamicToolUIPart = {
|
|
|
2087
1699
|
output: unknown;
|
|
2088
1700
|
errorText?: never;
|
|
2089
1701
|
callProviderMetadata?: ProviderMetadata;
|
|
1702
|
+
resultProviderMetadata?: ProviderMetadata;
|
|
2090
1703
|
preliminary?: boolean;
|
|
2091
1704
|
approval?: {
|
|
2092
1705
|
id: string;
|
|
@@ -2099,6 +1712,7 @@ export declare type DynamicToolUIPart = {
|
|
|
2099
1712
|
output?: never;
|
|
2100
1713
|
errorText: string;
|
|
2101
1714
|
callProviderMetadata?: ProviderMetadata;
|
|
1715
|
+
resultProviderMetadata?: ProviderMetadata;
|
|
2102
1716
|
approval?: {
|
|
2103
1717
|
id: string;
|
|
2104
1718
|
approved: true;
|
|
@@ -2164,7 +1778,7 @@ export declare function embed({ model: modelArg, value, providerOptions, maxRetr
|
|
|
2164
1778
|
* to the provider from the AI SDK and enable provider-specific
|
|
2165
1779
|
* functionality that can be fully encapsulated in the provider.
|
|
2166
1780
|
*/
|
|
2167
|
-
providerOptions?:
|
|
1781
|
+
providerOptions?: ProviderOptions;
|
|
2168
1782
|
/**
|
|
2169
1783
|
* Optional telemetry configuration (experimental).
|
|
2170
1784
|
*/
|
|
@@ -2524,7 +2138,7 @@ export declare function embedMany({ model: modelArg, values, maxParallelCalls, m
|
|
|
2524
2138
|
* to the provider from the AI SDK and enable provider-specific
|
|
2525
2139
|
* functionality that can be fully encapsulated in the provider.
|
|
2526
2140
|
*/
|
|
2527
|
-
providerOptions?:
|
|
2141
|
+
providerOptions?: ProviderOptions;
|
|
2528
2142
|
/**
|
|
2529
2143
|
* Maximum number of concurrent requests.
|
|
2530
2144
|
*
|
|
@@ -2639,16 +2253,16 @@ declare interface EventSourceMessage {
|
|
|
2639
2253
|
* implementation in that browsers will default this to `message`, whereas this parser will
|
|
2640
2254
|
* leave this as `undefined` if not explicitly declared.
|
|
2641
2255
|
*/
|
|
2642
|
-
event?: string | undefined
|
|
2256
|
+
event?: string | undefined;
|
|
2643
2257
|
/**
|
|
2644
2258
|
* ID of the message, if any was provided by the server. Can be used by clients to keep the
|
|
2645
2259
|
* last received message ID in sync when reconnecting.
|
|
2646
2260
|
*/
|
|
2647
|
-
id?: string | undefined
|
|
2261
|
+
id?: string | undefined;
|
|
2648
2262
|
/**
|
|
2649
2263
|
* The data received for this message
|
|
2650
2264
|
*/
|
|
2651
|
-
data: string
|
|
2265
|
+
data: string;
|
|
2652
2266
|
}
|
|
2653
2267
|
|
|
2654
2268
|
/**
|
|
@@ -2672,14 +2286,19 @@ declare interface EventSourceMessage {
|
|
|
2672
2286
|
*
|
|
2673
2287
|
* @public
|
|
2674
2288
|
*/
|
|
2675
|
-
declare class EventSourceParserStream extends TransformStream<
|
|
2676
|
-
|
|
2289
|
+
declare class EventSourceParserStream extends TransformStream<
|
|
2290
|
+
string,
|
|
2291
|
+
EventSourceMessage
|
|
2292
|
+
> {
|
|
2293
|
+
constructor({ onError, onRetry, onComment }?: StreamOptions);
|
|
2677
2294
|
}
|
|
2678
2295
|
|
|
2679
2296
|
/**
|
|
2680
2297
|
* Defines Exception.
|
|
2681
2298
|
*
|
|
2682
2299
|
* string or an object with one of (message or name or code) and optional stack
|
|
2300
|
+
*
|
|
2301
|
+
* @since 1.0.0
|
|
2683
2302
|
*/
|
|
2684
2303
|
declare type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
|
|
2685
2304
|
|
|
@@ -2705,18 +2324,6 @@ declare interface ExceptionWithName {
|
|
|
2705
2324
|
}
|
|
2706
2325
|
|
|
2707
2326
|
declare function executeTool<INPUT, OUTPUT>({ execute, input, options, }: {
|
|
2708
|
-
execute: ToolExecuteFunction_2<INPUT, OUTPUT>;
|
|
2709
|
-
input: INPUT;
|
|
2710
|
-
options: ToolExecutionOptions_2;
|
|
2711
|
-
}): AsyncGenerator<{
|
|
2712
|
-
type: 'preliminary';
|
|
2713
|
-
output: OUTPUT;
|
|
2714
|
-
} | {
|
|
2715
|
-
type: 'final';
|
|
2716
|
-
output: OUTPUT;
|
|
2717
|
-
}>;
|
|
2718
|
-
|
|
2719
|
-
declare function executeTool_2<INPUT, OUTPUT>({ execute, input, options, }: {
|
|
2720
2327
|
execute: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
2721
2328
|
input: INPUT;
|
|
2722
2329
|
options: ToolExecutionOptions;
|
|
@@ -2833,7 +2440,7 @@ export declare function experimental_generateSpeech({ model, text, voice, output
|
|
|
2833
2440
|
* }
|
|
2834
2441
|
* ```
|
|
2835
2442
|
*/
|
|
2836
|
-
providerOptions?:
|
|
2443
|
+
providerOptions?: ProviderOptions;
|
|
2837
2444
|
/**
|
|
2838
2445
|
* Maximum number of retries per speech model call. Set to 0 to disable retries.
|
|
2839
2446
|
*
|
|
@@ -2892,7 +2499,7 @@ export declare function experimental_generateVideo({ model: modelArg, prompt: pr
|
|
|
2892
2499
|
* Additional provider-specific options that are passed through to the provider
|
|
2893
2500
|
* as body parameters.
|
|
2894
2501
|
*/
|
|
2895
|
-
providerOptions?:
|
|
2502
|
+
providerOptions?: ProviderOptions;
|
|
2896
2503
|
/**
|
|
2897
2504
|
* Maximum number of retries per video model call. Set to 0 to disable retries.
|
|
2898
2505
|
*
|
|
@@ -2969,7 +2576,7 @@ export declare function experimental_transcribe({ model, audio, providerOptions,
|
|
|
2969
2576
|
* }
|
|
2970
2577
|
* ```
|
|
2971
2578
|
*/
|
|
2972
|
-
providerOptions?:
|
|
2579
|
+
providerOptions?: ProviderOptions;
|
|
2973
2580
|
/**
|
|
2974
2581
|
* Maximum number of retries per transcript model call. Set to 0 to disable retries.
|
|
2975
2582
|
*
|
|
@@ -3099,26 +2706,11 @@ declare function extractResponseHeaders(response: Response): {
|
|
|
3099
2706
|
[k: string]: string;
|
|
3100
2707
|
};
|
|
3101
2708
|
|
|
3102
|
-
/**
|
|
3103
|
-
* Extracts the headers from a response object and returns them as a key-value object.
|
|
3104
|
-
*
|
|
3105
|
-
* @param response - The response object to extract headers from.
|
|
3106
|
-
* @returns The headers as a key-value object.
|
|
3107
|
-
*/
|
|
3108
|
-
declare function extractResponseHeaders_2(response: Response): {
|
|
3109
|
-
[k: string]: string;
|
|
3110
|
-
};
|
|
3111
|
-
|
|
3112
2709
|
/**
|
|
3113
2710
|
* Fetch function type (standardizes the version of fetch used).
|
|
3114
2711
|
*/
|
|
3115
2712
|
declare type FetchFunction = typeof globalThis.fetch;
|
|
3116
2713
|
|
|
3117
|
-
/**
|
|
3118
|
-
* Fetch function type (standardizes the version of fetch used).
|
|
3119
|
-
*/
|
|
3120
|
-
declare type FetchFunction_2 = typeof globalThis.fetch;
|
|
3121
|
-
|
|
3122
2714
|
/**
|
|
3123
2715
|
* File content part of a prompt. It contains a file.
|
|
3124
2716
|
*/
|
|
@@ -3141,36 +2733,6 @@ export declare interface FilePart {
|
|
|
3141
2733
|
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
3142
2734
|
*/
|
|
3143
2735
|
mediaType: string;
|
|
3144
|
-
/**
|
|
3145
|
-
* Additional provider-specific metadata. They are passed through
|
|
3146
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
3147
|
-
* functionality that can be fully encapsulated in the provider.
|
|
3148
|
-
*/
|
|
3149
|
-
providerOptions?: ProviderOptions_2;
|
|
3150
|
-
}
|
|
3151
|
-
|
|
3152
|
-
/**
|
|
3153
|
-
* File content part of a prompt. It contains a file.
|
|
3154
|
-
*/
|
|
3155
|
-
declare interface FilePart_2 {
|
|
3156
|
-
type: 'file';
|
|
3157
|
-
/**
|
|
3158
|
-
* File data. Can either be:
|
|
3159
|
-
*
|
|
3160
|
-
* - data: a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer
|
|
3161
|
-
* - URL: a URL that points to the image
|
|
3162
|
-
*/
|
|
3163
|
-
data: DataContent_2 | URL;
|
|
3164
|
-
/**
|
|
3165
|
-
* Optional filename of the file.
|
|
3166
|
-
*/
|
|
3167
|
-
filename?: string;
|
|
3168
|
-
/**
|
|
3169
|
-
* IANA media type of the file.
|
|
3170
|
-
*
|
|
3171
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
3172
|
-
*/
|
|
3173
|
-
mediaType: string;
|
|
3174
2736
|
/**
|
|
3175
2737
|
* Additional provider-specific metadata. They are passed through
|
|
3176
2738
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -3218,9 +2780,7 @@ export declare type FileUIPart = {
|
|
|
3218
2780
|
*/
|
|
3219
2781
|
export declare type FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
|
|
3220
2782
|
|
|
3221
|
-
export declare type FlexibleSchema<SCHEMA = any> = Schema<SCHEMA> |
|
|
3222
|
-
|
|
3223
|
-
declare type FlexibleSchema_2<SCHEMA = any> = Schema_2<SCHEMA> | LazySchema<SCHEMA> | ZodSchema<SCHEMA> | StandardSchema<SCHEMA>;
|
|
2783
|
+
export declare type FlexibleSchema<SCHEMA = any> = Schema<SCHEMA> | LazySchema<SCHEMA> | ZodSchema<SCHEMA> | StandardSchema<SCHEMA>;
|
|
3224
2784
|
|
|
3225
2785
|
export declare const gateway: GatewayProvider;
|
|
3226
2786
|
|
|
@@ -3231,13 +2791,57 @@ declare interface GatewayCreditsResponse {
|
|
|
3231
2791
|
totalUsed: string;
|
|
3232
2792
|
}
|
|
3233
2793
|
|
|
3234
|
-
declare type GatewayEmbeddingModelId = 'alibaba/qwen3-embedding-0.6b' | 'alibaba/qwen3-embedding-4b' | 'alibaba/qwen3-embedding-8b' | 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-4' | 'voyage/voyage-4-large' | 'voyage/voyage-4-lite' | 'voyage/voyage-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
|
|
2794
|
+
declare type GatewayEmbeddingModelId = 'alibaba/qwen3-embedding-0.6b' | 'alibaba/qwen3-embedding-4b' | 'alibaba/qwen3-embedding-8b' | 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/gemini-embedding-2' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-4' | 'voyage/voyage-4-large' | 'voyage/voyage-4-lite' | 'voyage/voyage-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
|
|
3235
2795
|
|
|
3236
2796
|
declare interface GatewayFetchMetadataResponse {
|
|
3237
2797
|
models: GatewayLanguageModelEntry[];
|
|
3238
2798
|
}
|
|
3239
2799
|
|
|
3240
|
-
declare
|
|
2800
|
+
declare interface GatewayGenerationInfo {
|
|
2801
|
+
/** The generation ID */
|
|
2802
|
+
id: string;
|
|
2803
|
+
/** Total cost in USD */
|
|
2804
|
+
totalCost: number;
|
|
2805
|
+
/** Upstream inference cost in USD (BYOK only) */
|
|
2806
|
+
upstreamInferenceCost: number;
|
|
2807
|
+
/** Usage cost in USD (same as totalCost) */
|
|
2808
|
+
usage: number;
|
|
2809
|
+
/** ISO 8601 timestamp when the generation was created */
|
|
2810
|
+
createdAt: string;
|
|
2811
|
+
/** Model identifier */
|
|
2812
|
+
model: string;
|
|
2813
|
+
/** Whether BYOK credentials were used */
|
|
2814
|
+
isByok: boolean;
|
|
2815
|
+
/** Provider that served this generation */
|
|
2816
|
+
providerName: string;
|
|
2817
|
+
/** Whether streaming was used */
|
|
2818
|
+
streamed: boolean;
|
|
2819
|
+
/** Finish reason (e.g. 'stop') */
|
|
2820
|
+
finishReason: string;
|
|
2821
|
+
/** Time to first token in milliseconds */
|
|
2822
|
+
latency: number;
|
|
2823
|
+
/** Total generation time in milliseconds */
|
|
2824
|
+
generationTime: number;
|
|
2825
|
+
/** Number of prompt tokens */
|
|
2826
|
+
promptTokens: number;
|
|
2827
|
+
/** Number of completion tokens */
|
|
2828
|
+
completionTokens: number;
|
|
2829
|
+
/** Reasoning tokens used */
|
|
2830
|
+
reasoningTokens: number;
|
|
2831
|
+
/** Cached tokens used */
|
|
2832
|
+
cachedTokens: number;
|
|
2833
|
+
/** Cache creation input tokens */
|
|
2834
|
+
cacheCreationTokens: number;
|
|
2835
|
+
/** Billable web search calls */
|
|
2836
|
+
billableWebSearchCalls: number;
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2839
|
+
declare interface GatewayGenerationInfoParams {
|
|
2840
|
+
/** The generation ID to look up (format: gen_<ulid>) */
|
|
2841
|
+
id: string;
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2844
|
+
declare type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'prodia/flux-fast-schnell' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'xai/grok-imagine-image' | 'xai/grok-imagine-image-pro' | (string & {});
|
|
3241
2845
|
|
|
3242
2846
|
declare interface GatewayLanguageModelEntry {
|
|
3243
2847
|
/**
|
|
@@ -3283,12 +2887,12 @@ declare interface GatewayLanguageModelEntry {
|
|
|
3283
2887
|
/**
|
|
3284
2888
|
* Optional field to differentiate between model types.
|
|
3285
2889
|
*/
|
|
3286
|
-
modelType?:
|
|
2890
|
+
modelType?: KnownModelType | null;
|
|
3287
2891
|
}
|
|
3288
2892
|
|
|
3289
2893
|
declare type GatewayLanguageModelSpecification = Pick<LanguageModelV3, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
3290
2894
|
|
|
3291
|
-
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | '
|
|
2895
|
+
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.7-sonnet' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'arcee-ai/trinity-large-preview' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking-2601' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'xai/grok-3' | 'xai/grok-3-fast' | 'xai/grok-3-mini' | 'xai/grok-3-mini-fast' | 'xai/grok-4' | 'xai/grok-4-fast-non-reasoning' | 'xai/grok-4-fast-reasoning' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-code-fast-1' | 'xiaomi/mimo-v2-flash' | 'xiaomi/mimo-v2-pro' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5v-turbo' | (string & {});
|
|
3292
2896
|
|
|
3293
2897
|
declare interface GatewayProvider extends ProviderV3 {
|
|
3294
2898
|
(modelId: GatewayModelId): LanguageModelV3;
|
|
@@ -3308,6 +2912,16 @@ declare interface GatewayProvider extends ProviderV3 {
|
|
|
3308
2912
|
* Returns credit information for the authenticated user.
|
|
3309
2913
|
*/
|
|
3310
2914
|
getCredits(): Promise<GatewayCreditsResponse>;
|
|
2915
|
+
/**
|
|
2916
|
+
* Returns a spend report with cost, token, and request count data,
|
|
2917
|
+
* aggregated by the specified dimension.
|
|
2918
|
+
*/
|
|
2919
|
+
getSpendReport(params: GatewaySpendReportParams): Promise<GatewaySpendReportResponse>;
|
|
2920
|
+
/**
|
|
2921
|
+
* Returns detailed information about a specific generation by its ID,
|
|
2922
|
+
* including cost, token usage, latency, and provider details.
|
|
2923
|
+
*/
|
|
2924
|
+
getGenerationInfo(params: GatewayGenerationInfoParams): Promise<GatewayGenerationInfo>;
|
|
3311
2925
|
/**
|
|
3312
2926
|
* Creates a model for generating text embeddings.
|
|
3313
2927
|
*/
|
|
@@ -3336,6 +2950,14 @@ declare interface GatewayProvider extends ProviderV3 {
|
|
|
3336
2950
|
* Creates a model for generating videos.
|
|
3337
2951
|
*/
|
|
3338
2952
|
videoModel(modelId: GatewayVideoModelId): VideoModelV3;
|
|
2953
|
+
/**
|
|
2954
|
+
* Creates a model for reranking documents.
|
|
2955
|
+
*/
|
|
2956
|
+
reranking(modelId: GatewayRerankingModelId): RerankingModelV3;
|
|
2957
|
+
/**
|
|
2958
|
+
* Creates a model for reranking documents.
|
|
2959
|
+
*/
|
|
2960
|
+
rerankingModel(modelId: GatewayRerankingModelId): RerankingModelV3;
|
|
3339
2961
|
/**
|
|
3340
2962
|
* Gateway-specific tools executed server-side.
|
|
3341
2963
|
*/
|
|
@@ -3366,6 +2988,66 @@ declare interface GatewayProviderSettings {
|
|
|
3366
2988
|
metadataCacheRefreshMillis?: number;
|
|
3367
2989
|
}
|
|
3368
2990
|
|
|
2991
|
+
declare type GatewayRerankingModelId = 'cohere/rerank-v3.5' | 'cohere/rerank-v4-fast' | 'cohere/rerank-v4-pro' | 'voyage/rerank-2.5' | 'voyage/rerank-2.5-lite' | (string & {});
|
|
2992
|
+
|
|
2993
|
+
declare interface GatewaySpendReportParams {
|
|
2994
|
+
/** Start date in YYYY-MM-DD format (inclusive) */
|
|
2995
|
+
startDate: string;
|
|
2996
|
+
/** End date in YYYY-MM-DD format (inclusive) */
|
|
2997
|
+
endDate: string;
|
|
2998
|
+
/** Primary aggregation dimension. Defaults to 'day'. */
|
|
2999
|
+
groupBy?: 'day' | 'user' | 'model' | 'tag' | 'provider' | 'credential_type';
|
|
3000
|
+
/** Time granularity when groupBy is 'day'. */
|
|
3001
|
+
datePart?: 'day' | 'hour';
|
|
3002
|
+
/** Filter to a specific user's spend. */
|
|
3003
|
+
userId?: string;
|
|
3004
|
+
/** Filter to a specific model (e.g. 'anthropic/claude-sonnet-4.5'). */
|
|
3005
|
+
model?: string;
|
|
3006
|
+
/** Filter to a specific provider (e.g. 'anthropic'). */
|
|
3007
|
+
provider?: string;
|
|
3008
|
+
/** Filter to BYOK or system credentials. */
|
|
3009
|
+
credentialType?: 'byok' | 'system';
|
|
3010
|
+
/** Filter to requests with these tags. */
|
|
3011
|
+
tags?: string[];
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
declare interface GatewaySpendReportResponse {
|
|
3015
|
+
results: GatewaySpendReportRow[];
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
declare interface GatewaySpendReportRow {
|
|
3019
|
+
/** Date string (present when groupBy is 'day') */
|
|
3020
|
+
day?: string;
|
|
3021
|
+
/** Hour timestamp (present when groupBy is 'day' and datePart is 'hour') */
|
|
3022
|
+
hour?: string;
|
|
3023
|
+
/** User identifier (present when groupBy is 'user') */
|
|
3024
|
+
user?: string;
|
|
3025
|
+
/** Model identifier (present when groupBy is 'model') */
|
|
3026
|
+
model?: string;
|
|
3027
|
+
/** Tag value (present when groupBy is 'tag') */
|
|
3028
|
+
tag?: string;
|
|
3029
|
+
/** Provider name (present when groupBy is 'provider') */
|
|
3030
|
+
provider?: string;
|
|
3031
|
+
/** Credential type (present when groupBy is 'credential_type') */
|
|
3032
|
+
credentialType?: 'byok' | 'system';
|
|
3033
|
+
/** Total cost in USD */
|
|
3034
|
+
totalCost: number;
|
|
3035
|
+
/** Market cost in USD */
|
|
3036
|
+
marketCost?: number;
|
|
3037
|
+
/** Number of input tokens */
|
|
3038
|
+
inputTokens?: number;
|
|
3039
|
+
/** Number of output tokens */
|
|
3040
|
+
outputTokens?: number;
|
|
3041
|
+
/** Number of cached input tokens */
|
|
3042
|
+
cachedInputTokens?: number;
|
|
3043
|
+
/** Number of cache creation input tokens */
|
|
3044
|
+
cacheCreationInputTokens?: number;
|
|
3045
|
+
/** Number of reasoning tokens */
|
|
3046
|
+
reasoningTokens?: number;
|
|
3047
|
+
/** Number of requests */
|
|
3048
|
+
requestCount?: number;
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3369
3051
|
/**
|
|
3370
3052
|
* Gateway-specific provider-defined tools.
|
|
3371
3053
|
*/
|
|
@@ -3389,7 +3071,7 @@ declare const gatewayTools: {
|
|
|
3389
3071
|
perplexitySearch: (config?: PerplexitySearchConfig) => ReturnType<typeof perplexitySearchToolFactory>;
|
|
3390
3072
|
};
|
|
3391
3073
|
|
|
3392
|
-
declare type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'bytedance/seedance-v1.0-lite-i2v' | 'bytedance/seedance-v1.0-lite-t2v' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-t2v' | 'xai/grok-imagine-video' | (string & {});
|
|
3074
|
+
declare type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'bytedance/seedance-2.0' | 'bytedance/seedance-2.0-fast' | 'bytedance/seedance-v1.0-lite-i2v' | 'bytedance/seedance-v1.0-lite-t2v' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-t2v' | 'xai/grok-imagine-video' | (string & {});
|
|
3393
3075
|
|
|
3394
3076
|
/**
|
|
3395
3077
|
* A generated audio file.
|
|
@@ -3429,12 +3111,6 @@ export { GeneratedFile }
|
|
|
3429
3111
|
*/
|
|
3430
3112
|
export declare const generateId: IdGenerator;
|
|
3431
3113
|
|
|
3432
|
-
/**
|
|
3433
|
-
* Generates a 16-character random string to use for IDs.
|
|
3434
|
-
* Not cryptographically secure.
|
|
3435
|
-
*/
|
|
3436
|
-
declare const generateId_2: IdGenerator_2;
|
|
3437
|
-
|
|
3438
3114
|
/**
|
|
3439
3115
|
* Generates images using an image model.
|
|
3440
3116
|
*
|
|
@@ -3496,7 +3172,7 @@ export declare function generateImage({ model: modelArg, prompt: promptArg, n, m
|
|
|
3496
3172
|
* }
|
|
3497
3173
|
* ```
|
|
3498
3174
|
*/
|
|
3499
|
-
providerOptions?:
|
|
3175
|
+
providerOptions?: ProviderOptions;
|
|
3500
3176
|
/**
|
|
3501
3177
|
* Maximum number of retries per image model call. Set to 0 to disable retries.
|
|
3502
3178
|
*
|
|
@@ -3562,6 +3238,7 @@ export declare interface GenerateImageResult {
|
|
|
3562
3238
|
* @param system - A system message that will be part of the prompt.
|
|
3563
3239
|
* @param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
|
|
3564
3240
|
* @param messages - A list of messages. You can either use `prompt` or `messages` but not both.
|
|
3241
|
+
* @param allowSystemInMessages - Whether system messages are allowed in the `prompt` or `messages` fields. When unset, system messages are allowed with a warning.
|
|
3565
3242
|
*
|
|
3566
3243
|
* @param maxOutputTokens - Maximum number of tokens to generate.
|
|
3567
3244
|
* @param temperature - Temperature setting.
|
|
@@ -3666,7 +3343,7 @@ export declare function generateObject<SCHEMA extends FlexibleSchema<unknown> =
|
|
|
3666
3343
|
* to the provider from the AI SDK and enable provider-specific
|
|
3667
3344
|
* functionality that can be fully encapsulated in the provider.
|
|
3668
3345
|
*/
|
|
3669
|
-
providerOptions?:
|
|
3346
|
+
providerOptions?: ProviderOptions;
|
|
3670
3347
|
/**
|
|
3671
3348
|
* Internal. For test use only. May change without notice.
|
|
3672
3349
|
*/
|
|
@@ -3740,6 +3417,7 @@ export declare interface GenerateObjectResult<OBJECT> {
|
|
|
3740
3417
|
* @param system - A system message that will be part of the prompt.
|
|
3741
3418
|
* @param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
|
|
3742
3419
|
* @param messages - A list of messages. You can either use `prompt` or `messages` but not both.
|
|
3420
|
+
* @param allowSystemInMessages - Whether system messages are allowed in the `prompt` or `messages` fields. When unset, system messages are allowed with a warning.
|
|
3743
3421
|
*
|
|
3744
3422
|
* @param maxOutputTokens - Maximum number of tokens to generate.
|
|
3745
3423
|
* @param temperature - Temperature setting.
|
|
@@ -3781,7 +3459,7 @@ export declare interface GenerateObjectResult<OBJECT> {
|
|
|
3781
3459
|
* @returns
|
|
3782
3460
|
* A result object that contains the generated text, the results of the tool calls, and additional information.
|
|
3783
3461
|
*/
|
|
3784
|
-
export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string>>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, experimental_include: include, _internal: { generateId }, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
|
|
3462
|
+
export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string>>({ model: modelArg, tools, toolChoice, system, prompt, messages, allowSystemInMessages, maxRetries: maxRetriesArg, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, experimental_include: include, _internal: { generateId }, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
|
|
3785
3463
|
/**
|
|
3786
3464
|
* The language model to use.
|
|
3787
3465
|
*/
|
|
@@ -3810,7 +3488,7 @@ export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Outpu
|
|
|
3810
3488
|
* to the provider from the AI SDK and enable provider-specific
|
|
3811
3489
|
* functionality that can be fully encapsulated in the provider.
|
|
3812
3490
|
*/
|
|
3813
|
-
providerOptions?:
|
|
3491
|
+
providerOptions?: ProviderOptions;
|
|
3814
3492
|
/**
|
|
3815
3493
|
* @deprecated Use `activeTools` instead.
|
|
3816
3494
|
*/
|
|
@@ -4145,8 +3823,6 @@ declare function getErrorMessage(error: unknown | undefined): string;
|
|
|
4145
3823
|
|
|
4146
3824
|
declare function getErrorMessage_2(error: unknown | undefined): string;
|
|
4147
3825
|
|
|
4148
|
-
declare function getErrorMessage_3(error: unknown | undefined): string;
|
|
4149
|
-
|
|
4150
3826
|
declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
4151
3827
|
url: string;
|
|
4152
3828
|
headers?: Record<string, string | undefined>;
|
|
@@ -4160,19 +3836,6 @@ declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedR
|
|
|
4160
3836
|
responseHeaders?: Record<string, string>;
|
|
4161
3837
|
}>;
|
|
4162
3838
|
|
|
4163
|
-
declare const getFromApi_2: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
4164
|
-
url: string;
|
|
4165
|
-
headers?: Record<string, string | undefined>;
|
|
4166
|
-
failedResponseHandler: ResponseHandler_2<Error>;
|
|
4167
|
-
successfulResponseHandler: ResponseHandler_2<T>;
|
|
4168
|
-
abortSignal?: AbortSignal;
|
|
4169
|
-
fetch?: FetchFunction_2;
|
|
4170
|
-
}) => Promise<{
|
|
4171
|
-
value: T;
|
|
4172
|
-
rawValue?: unknown;
|
|
4173
|
-
responseHeaders?: Record<string, string>;
|
|
4174
|
-
}>;
|
|
4175
|
-
|
|
4176
3839
|
declare type GetMaxImagesPerCallFunction$1 = (options: {
|
|
4177
3840
|
modelId: string;
|
|
4178
3841
|
}) => PromiseLike<number | undefined> | number | undefined;
|
|
@@ -4189,8 +3852,6 @@ declare const getOriginalFetch: () => typeof fetch;
|
|
|
4189
3852
|
|
|
4190
3853
|
declare function getRuntimeEnvironmentUserAgent(globalThisAny?: any): string;
|
|
4191
3854
|
|
|
4192
|
-
declare function getRuntimeEnvironmentUserAgent_2(globalThisAny?: any): string;
|
|
4193
|
-
|
|
4194
3855
|
/**
|
|
4195
3856
|
* Returns the name of the static tool.
|
|
4196
3857
|
*
|
|
@@ -4237,6 +3898,8 @@ export declare function hasToolCall(toolName: string): StopCondition<any>;
|
|
|
4237
3898
|
* The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
|
|
4238
3899
|
* HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
|
|
4239
3900
|
* This is represented in HrTime format as [1609504210, 150000000].
|
|
3901
|
+
*
|
|
3902
|
+
* @since 1.0.0
|
|
4240
3903
|
*/
|
|
4241
3904
|
declare type HrTime = [number, number];
|
|
4242
3905
|
|
|
@@ -4245,7 +3908,7 @@ export declare abstract class HttpChatTransport<UI_MESSAGE extends UIMessage> im
|
|
|
4245
3908
|
protected credentials: HttpChatTransportInitOptions<UI_MESSAGE>['credentials'];
|
|
4246
3909
|
protected headers: HttpChatTransportInitOptions<UI_MESSAGE>['headers'];
|
|
4247
3910
|
protected body: HttpChatTransportInitOptions<UI_MESSAGE>['body'];
|
|
4248
|
-
protected fetch?:
|
|
3911
|
+
protected fetch?: FetchFunction;
|
|
4249
3912
|
protected prepareSendMessagesRequest?: PrepareSendMessagesRequest<UI_MESSAGE>;
|
|
4250
3913
|
protected prepareReconnectToStreamRequest?: PrepareReconnectToStreamRequest;
|
|
4251
3914
|
constructor({ api, credentials, headers, body, fetch, prepareSendMessagesRequest, prepareReconnectToStreamRequest, }: HttpChatTransportInitOptions<UI_MESSAGE>);
|
|
@@ -4270,11 +3933,11 @@ export declare type HttpChatTransportInitOptions<UI_MESSAGE extends UIMessage> =
|
|
|
4270
3933
|
* Possible values are: 'omit', 'same-origin', 'include'.
|
|
4271
3934
|
* Defaults to 'same-origin'.
|
|
4272
3935
|
*/
|
|
4273
|
-
credentials?:
|
|
3936
|
+
credentials?: Resolvable<RequestCredentials>;
|
|
4274
3937
|
/**
|
|
4275
3938
|
* HTTP headers to be sent with the API request.
|
|
4276
3939
|
*/
|
|
4277
|
-
headers?:
|
|
3940
|
+
headers?: Resolvable<Record<string, string> | Headers>;
|
|
4278
3941
|
/**
|
|
4279
3942
|
* Extra body object to be sent with the API request.
|
|
4280
3943
|
* @example
|
|
@@ -4287,12 +3950,12 @@ export declare type HttpChatTransportInitOptions<UI_MESSAGE extends UIMessage> =
|
|
|
4287
3950
|
* })
|
|
4288
3951
|
* ```
|
|
4289
3952
|
*/
|
|
4290
|
-
body?:
|
|
3953
|
+
body?: Resolvable<object>;
|
|
4291
3954
|
/**
|
|
4292
3955
|
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
4293
3956
|
* or to provide a custom fetch implementation for e.g. testing.
|
|
4294
3957
|
*/
|
|
4295
|
-
fetch?:
|
|
3958
|
+
fetch?: FetchFunction;
|
|
4296
3959
|
/**
|
|
4297
3960
|
* When a function is provided, it will be used
|
|
4298
3961
|
* to prepare the request body for the chat API. This can be useful for
|
|
@@ -4312,11 +3975,6 @@ export declare type HttpChatTransportInitOptions<UI_MESSAGE extends UIMessage> =
|
|
|
4312
3975
|
*/
|
|
4313
3976
|
export declare type IdGenerator = () => string;
|
|
4314
3977
|
|
|
4315
|
-
/**
|
|
4316
|
-
* A function that generates an ID.
|
|
4317
|
-
*/
|
|
4318
|
-
declare type IdGenerator_2 = () => string;
|
|
4319
|
-
|
|
4320
3978
|
/**
|
|
4321
3979
|
* Image model that is used by the AI SDK.
|
|
4322
3980
|
*/
|
|
@@ -4781,32 +4439,6 @@ export declare interface ImagePart {
|
|
|
4781
4439
|
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4782
4440
|
*/
|
|
4783
4441
|
mediaType?: string;
|
|
4784
|
-
/**
|
|
4785
|
-
* Additional provider-specific metadata. They are passed through
|
|
4786
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
4787
|
-
* functionality that can be fully encapsulated in the provider.
|
|
4788
|
-
*/
|
|
4789
|
-
providerOptions?: ProviderOptions_2;
|
|
4790
|
-
}
|
|
4791
|
-
|
|
4792
|
-
/**
|
|
4793
|
-
* Image content part of a prompt. It contains an image.
|
|
4794
|
-
*/
|
|
4795
|
-
declare interface ImagePart_2 {
|
|
4796
|
-
type: 'image';
|
|
4797
|
-
/**
|
|
4798
|
-
* Image data. Can either be:
|
|
4799
|
-
*
|
|
4800
|
-
* - data: a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer
|
|
4801
|
-
* - URL: a URL that points to the image
|
|
4802
|
-
*/
|
|
4803
|
-
image: DataContent_2 | URL;
|
|
4804
|
-
/**
|
|
4805
|
-
* Optional IANA media type of the image.
|
|
4806
|
-
*
|
|
4807
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4808
|
-
*/
|
|
4809
|
-
mediaType?: string;
|
|
4810
4442
|
/**
|
|
4811
4443
|
* Additional provider-specific metadata. They are passed through
|
|
4812
4444
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -4837,9 +4469,7 @@ declare type InferElementOutput<OUTPUT extends Output_2> = OUTPUT extends Output
|
|
|
4837
4469
|
*/
|
|
4838
4470
|
export declare type InferGenerateOutput<OUTPUT extends Output_2> = OUTPUT extends Output_2<infer COMPLETE_OUTPUT, any, any> ? COMPLETE_OUTPUT : never;
|
|
4839
4471
|
|
|
4840
|
-
export declare type InferSchema<SCHEMA> = SCHEMA extends
|
|
4841
|
-
|
|
4842
|
-
declare type InferSchema_2<SCHEMA> = SCHEMA extends ZodSchema<infer T> ? T : SCHEMA extends StandardSchema<infer T> ? T : SCHEMA extends LazySchema<infer T> ? T : SCHEMA extends Schema_2<infer T> ? T : never;
|
|
4472
|
+
export declare type InferSchema<SCHEMA> = SCHEMA extends ZodSchema<infer T> ? T : SCHEMA extends StandardSchema<infer T> ? T : SCHEMA extends LazySchema<infer T> ? T : SCHEMA extends Schema<infer T> ? T : never;
|
|
4843
4473
|
|
|
4844
4474
|
/**
|
|
4845
4475
|
* Infers the partial output type from the output specification.
|
|
@@ -4851,21 +4481,11 @@ export declare type InferStreamOutput<OUTPUT extends Output_2> = OUTPUT extends
|
|
|
4851
4481
|
*/
|
|
4852
4482
|
export declare type InferToolInput<TOOL extends Tool> = TOOL extends Tool<infer INPUT, any> ? INPUT : never;
|
|
4853
4483
|
|
|
4854
|
-
/**
|
|
4855
|
-
* Infer the input type of a tool.
|
|
4856
|
-
*/
|
|
4857
|
-
declare type InferToolInput_2<TOOL extends Tool_2> = TOOL extends Tool_2<infer INPUT, any> ? INPUT : never;
|
|
4858
|
-
|
|
4859
4484
|
/**
|
|
4860
4485
|
* Infer the output type of a tool.
|
|
4861
4486
|
*/
|
|
4862
4487
|
export declare type InferToolOutput<TOOL extends Tool> = TOOL extends Tool<any, infer OUTPUT> ? OUTPUT : never;
|
|
4863
4488
|
|
|
4864
|
-
/**
|
|
4865
|
-
* Infer the output type of a tool.
|
|
4866
|
-
*/
|
|
4867
|
-
declare type InferToolOutput_2<TOOL extends Tool_2> = TOOL extends Tool_2<any, infer OUTPUT> ? OUTPUT : never;
|
|
4868
|
-
|
|
4869
4489
|
export declare type InferUIDataParts<T extends UIDataPartSchemas> = {
|
|
4870
4490
|
[K in keyof T]: InferSchema<T[K]>;
|
|
4871
4491
|
};
|
|
@@ -4877,12 +4497,12 @@ declare type InferUIMessageData<T extends UIMessage> = T extends UIMessage<unkno
|
|
|
4877
4497
|
declare type InferUIMessageMetadata<T extends UIMessage> = T extends UIMessage<infer METADATA> ? METADATA : unknown;
|
|
4878
4498
|
|
|
4879
4499
|
declare type InferUIMessageToolCall<UI_MESSAGE extends UIMessage> = ValueOf<{
|
|
4880
|
-
[NAME in keyof InferUIMessageTools<UI_MESSAGE>]:
|
|
4500
|
+
[NAME in keyof InferUIMessageTools<UI_MESSAGE>]: ToolCall<NAME & string, InferUIMessageTools<UI_MESSAGE>[NAME] extends {
|
|
4881
4501
|
input: infer INPUT;
|
|
4882
4502
|
} ? INPUT : never> & {
|
|
4883
4503
|
dynamic?: false;
|
|
4884
4504
|
};
|
|
4885
|
-
}> | (
|
|
4505
|
+
}> | (ToolCall<string, unknown> & {
|
|
4886
4506
|
dynamic: true;
|
|
4887
4507
|
});
|
|
4888
4508
|
|
|
@@ -4910,13 +4530,6 @@ declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPre
|
|
|
4910
4530
|
schemaSuffix?: string;
|
|
4911
4531
|
}): LanguageModelV3Prompt;
|
|
4912
4532
|
|
|
4913
|
-
declare function injectJsonInstructionIntoMessages_2({ messages, schema, schemaPrefix, schemaSuffix, }: {
|
|
4914
|
-
messages: LanguageModelV3Prompt;
|
|
4915
|
-
schema?: JSONSchema7;
|
|
4916
|
-
schemaPrefix?: string;
|
|
4917
|
-
schemaSuffix?: string;
|
|
4918
|
-
}): LanguageModelV3Prompt;
|
|
4919
|
-
|
|
4920
4533
|
export declare class InvalidArgumentError extends AISDKError {
|
|
4921
4534
|
private readonly [symbol$h];
|
|
4922
4535
|
readonly parameter: string;
|
|
@@ -5027,8 +4640,6 @@ export declare class InvalidToolInputError extends AISDKError {
|
|
|
5027
4640
|
|
|
5028
4641
|
declare function isAbortError(error: unknown): error is Error;
|
|
5029
4642
|
|
|
5030
|
-
declare function isAbortError_2(error: unknown): error is Error;
|
|
5031
|
-
|
|
5032
4643
|
/**
|
|
5033
4644
|
* Check if a message part is a data part.
|
|
5034
4645
|
*/
|
|
@@ -5054,14 +4665,7 @@ declare function isJSONObject(value: unknown): value is JSONObject;
|
|
|
5054
4665
|
|
|
5055
4666
|
declare function isJSONValue(value: unknown): value is JSONValue_2;
|
|
5056
4667
|
|
|
5057
|
-
|
|
5058
|
-
* Type guard that checks whether a value is not `null` or `undefined`.
|
|
5059
|
-
*
|
|
5060
|
-
* @template T - The type of the value to check.
|
|
5061
|
-
* @param value - The value to check.
|
|
5062
|
-
* @returns `true` if the value is neither `null` nor `undefined`, otherwise `false`.
|
|
5063
|
-
*/
|
|
5064
|
-
declare function isNonNullable<T>(value: T | undefined | null): value is NonNullable<T>;
|
|
4668
|
+
export declare function isLoopFinished(): StopCondition<any>;
|
|
5065
4669
|
|
|
5066
4670
|
/**
|
|
5067
4671
|
* Type guard that checks whether a value is not `null` or `undefined`.
|
|
@@ -5070,12 +4674,10 @@ declare function isNonNullable<T>(value: T | undefined | null): value is NonNull
|
|
|
5070
4674
|
* @param value - The value to check.
|
|
5071
4675
|
* @returns `true` if the value is neither `null` nor `undefined`, otherwise `false`.
|
|
5072
4676
|
*/
|
|
5073
|
-
declare function
|
|
4677
|
+
declare function isNonNullable<T>(value: T | undefined | null): value is NonNullable<T>;
|
|
5074
4678
|
|
|
5075
4679
|
declare function isParsableJson(input: string): boolean;
|
|
5076
4680
|
|
|
5077
|
-
declare function isParsableJson_2(input: string): boolean;
|
|
5078
|
-
|
|
5079
4681
|
/**
|
|
5080
4682
|
* Type guard to check if a message part is a reasoning part.
|
|
5081
4683
|
*/
|
|
@@ -5124,23 +4726,6 @@ declare function isUrlSupported({ mediaType, url, supportedUrls, }: {
|
|
|
5124
4726
|
supportedUrls: Record<string, RegExp[]>;
|
|
5125
4727
|
}): boolean;
|
|
5126
4728
|
|
|
5127
|
-
/**
|
|
5128
|
-
* Checks if the given URL is supported natively by the model.
|
|
5129
|
-
*
|
|
5130
|
-
* @param mediaType - The media type of the URL. Case-sensitive.
|
|
5131
|
-
* @param url - The URL to check.
|
|
5132
|
-
* @param supportedUrls - A record where keys are case-sensitive media types (or '*')
|
|
5133
|
-
* and values are arrays of RegExp patterns for URLs.
|
|
5134
|
-
*
|
|
5135
|
-
* @returns `true` if the URL matches a pattern under the specific media type
|
|
5136
|
-
* or the wildcard '*', `false` otherwise.
|
|
5137
|
-
*/
|
|
5138
|
-
declare function isUrlSupported_2({ mediaType, url, supportedUrls, }: {
|
|
5139
|
-
mediaType: string;
|
|
5140
|
-
url: string;
|
|
5141
|
-
supportedUrls: Record<string, RegExp[]>;
|
|
5142
|
-
}): boolean;
|
|
5143
|
-
|
|
5144
4729
|
declare type Job = () => Promise<void>;
|
|
5145
4730
|
|
|
5146
4731
|
declare type JSONArray = JSONValue_2[];
|
|
@@ -5166,7 +4751,7 @@ export declare class JSONParseError extends AISDKError {
|
|
|
5166
4751
|
* @param options.validate Optional. A validation function for the schema.
|
|
5167
4752
|
*/
|
|
5168
4753
|
export declare function jsonSchema<OBJECT = unknown>(jsonSchema: JSONSchema7 | PromiseLike<JSONSchema7> | (() => JSONSchema7 | PromiseLike<JSONSchema7>), { validate, }?: {
|
|
5169
|
-
validate?: (value: unknown) =>
|
|
4754
|
+
validate?: (value: unknown) => ValidationResult<OBJECT> | PromiseLike<ValidationResult<OBJECT>>;
|
|
5170
4755
|
}): Schema<OBJECT>;
|
|
5171
4756
|
|
|
5172
4757
|
export declare interface JSONSchema7 {
|
|
@@ -5328,16 +4913,6 @@ declare type JSONSchema7TypeName =
|
|
|
5328
4913
|
*/
|
|
5329
4914
|
declare type JSONSchema7Version = string;
|
|
5330
4915
|
|
|
5331
|
-
/**
|
|
5332
|
-
* Create a schema using a JSON Schema.
|
|
5333
|
-
*
|
|
5334
|
-
* @param jsonSchema The JSON Schema for the schema.
|
|
5335
|
-
* @param options.validate Optional. A validation function for the schema.
|
|
5336
|
-
*/
|
|
5337
|
-
declare function jsonSchema_2<OBJECT = unknown>(jsonSchema: JSONSchema7 | PromiseLike<JSONSchema7> | (() => JSONSchema7 | PromiseLike<JSONSchema7>), { validate, }?: {
|
|
5338
|
-
validate?: (value: unknown) => ValidationResult<OBJECT> | PromiseLike<ValidationResult<OBJECT>>;
|
|
5339
|
-
}): Schema_2<OBJECT>;
|
|
5340
|
-
|
|
5341
4916
|
/**
|
|
5342
4917
|
* A TransformStream that converts JSON objects to Server-Sent Events (SSE) format.
|
|
5343
4918
|
* Each object is serialized to JSON and wrapped in `data: ...\n\n` format.
|
|
@@ -5355,6 +4930,10 @@ export declare type JSONValue = JSONValue_2;
|
|
|
5355
4930
|
*/
|
|
5356
4931
|
declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
|
|
5357
4932
|
|
|
4933
|
+
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "video"];
|
|
4934
|
+
|
|
4935
|
+
declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
|
|
4936
|
+
|
|
5358
4937
|
/**
|
|
5359
4938
|
* Language model that is used by the AI SDK.
|
|
5360
4939
|
*/
|
|
@@ -7407,19 +6986,7 @@ export declare function lastAssistantMessageIsCompleteWithToolCalls({ messages,
|
|
|
7407
6986
|
messages: UIMessage[];
|
|
7408
6987
|
}): boolean;
|
|
7409
6988
|
|
|
7410
|
-
declare type LazySchema<SCHEMA> = () =>
|
|
7411
|
-
|
|
7412
|
-
/**
|
|
7413
|
-
* Creates a schema with deferred creation.
|
|
7414
|
-
* This is important to reduce the startup time of the library
|
|
7415
|
-
* and to avoid initializing unused validators.
|
|
7416
|
-
*
|
|
7417
|
-
* @param createValidator A function that creates a schema.
|
|
7418
|
-
* @returns A function that returns a schema.
|
|
7419
|
-
*/
|
|
7420
|
-
declare function lazySchema<SCHEMA>(createSchema: () => Schema_2<SCHEMA>): LazySchema<SCHEMA>;
|
|
7421
|
-
|
|
7422
|
-
declare type LazySchema_2<SCHEMA> = () => Schema<SCHEMA>;
|
|
6989
|
+
declare type LazySchema<SCHEMA> = () => Schema<SCHEMA>;
|
|
7423
6990
|
|
|
7424
6991
|
/**
|
|
7425
6992
|
* Creates a schema with deferred creation.
|
|
@@ -7429,7 +6996,7 @@ declare type LazySchema_2<SCHEMA> = () => Schema<SCHEMA>;
|
|
|
7429
6996
|
* @param createValidator A function that creates a schema.
|
|
7430
6997
|
* @returns A function that returns a schema.
|
|
7431
6998
|
*/
|
|
7432
|
-
declare function
|
|
6999
|
+
declare function lazySchema<SCHEMA>(createSchema: () => Schema<SCHEMA>): LazySchema<SCHEMA>;
|
|
7433
7000
|
|
|
7434
7001
|
/**
|
|
7435
7002
|
* A pointer from the current {@link Span} to another span in the same trace or
|
|
@@ -7445,6 +7012,8 @@ declare function lazySchema_2<SCHEMA>(createSchema: () => Schema<SCHEMA>): LazyS
|
|
|
7445
7012
|
* However, it is desirable to associate incoming SpanContext to new trace
|
|
7446
7013
|
* initiated on service provider side so two traces (from Client and from
|
|
7447
7014
|
* Service Provider) can be correlated.
|
|
7015
|
+
*
|
|
7016
|
+
* @since 1.0.0
|
|
7448
7017
|
*/
|
|
7449
7018
|
declare interface Link {
|
|
7450
7019
|
/** The {@link SpanContext} of a linked span. */
|
|
@@ -7467,13 +7036,6 @@ declare function loadApiKey({ apiKey, environmentVariableName, apiKeyParameterNa
|
|
|
7467
7036
|
description: string;
|
|
7468
7037
|
}): string;
|
|
7469
7038
|
|
|
7470
|
-
declare function loadApiKey_2({ apiKey, environmentVariableName, apiKeyParameterName, description, }: {
|
|
7471
|
-
apiKey: string | undefined;
|
|
7472
|
-
environmentVariableName: string;
|
|
7473
|
-
apiKeyParameterName?: string;
|
|
7474
|
-
description: string;
|
|
7475
|
-
}): string;
|
|
7476
|
-
|
|
7477
7039
|
export declare class LoadAPIKeyError extends AISDKError {
|
|
7478
7040
|
private readonly [symbol$6];
|
|
7479
7041
|
constructor({ message }: {
|
|
@@ -7494,18 +7056,6 @@ declare function loadOptionalSetting({ settingValue, environmentVariableName, }:
|
|
|
7494
7056
|
environmentVariableName: string;
|
|
7495
7057
|
}): string | undefined;
|
|
7496
7058
|
|
|
7497
|
-
/**
|
|
7498
|
-
* Loads an optional `string` setting from the environment or a parameter.
|
|
7499
|
-
*
|
|
7500
|
-
* @param settingValue - The setting value.
|
|
7501
|
-
* @param environmentVariableName - The environment variable name.
|
|
7502
|
-
* @returns The setting value.
|
|
7503
|
-
*/
|
|
7504
|
-
declare function loadOptionalSetting_2({ settingValue, environmentVariableName, }: {
|
|
7505
|
-
settingValue: string | undefined;
|
|
7506
|
-
environmentVariableName: string;
|
|
7507
|
-
}): string | undefined;
|
|
7508
|
-
|
|
7509
7059
|
/**
|
|
7510
7060
|
* Loads a `string` setting from the environment or a parameter.
|
|
7511
7061
|
*
|
|
@@ -7522,22 +7072,6 @@ declare function loadSetting({ settingValue, environmentVariableName, settingNam
|
|
|
7522
7072
|
description: string;
|
|
7523
7073
|
}): string;
|
|
7524
7074
|
|
|
7525
|
-
/**
|
|
7526
|
-
* Loads a `string` setting from the environment or a parameter.
|
|
7527
|
-
*
|
|
7528
|
-
* @param settingValue - The setting value.
|
|
7529
|
-
* @param environmentVariableName - The environment variable name.
|
|
7530
|
-
* @param settingName - The setting name.
|
|
7531
|
-
* @param description - The description of the setting.
|
|
7532
|
-
* @returns The setting value.
|
|
7533
|
-
*/
|
|
7534
|
-
declare function loadSetting_2({ settingValue, environmentVariableName, settingName, description, }: {
|
|
7535
|
-
settingValue: string | undefined;
|
|
7536
|
-
environmentVariableName: string;
|
|
7537
|
-
settingName: string;
|
|
7538
|
-
description: string;
|
|
7539
|
-
}): string;
|
|
7540
|
-
|
|
7541
7075
|
export declare class LoadSettingError extends AISDKError {
|
|
7542
7076
|
private readonly [symbol$5];
|
|
7543
7077
|
constructor({ message }: {
|
|
@@ -7577,8 +7111,6 @@ export { LogWarningsFunction }
|
|
|
7577
7111
|
|
|
7578
7112
|
declare type MaybePromiseLike<T> = T | PromiseLike<T>;
|
|
7579
7113
|
|
|
7580
|
-
declare type MaybePromiseLike_2<T> = T | PromiseLike<T>;
|
|
7581
|
-
|
|
7582
7114
|
/**
|
|
7583
7115
|
* Maps a media type to its corresponding file extension.
|
|
7584
7116
|
* It was originally introduced to set a filename for audio file uploads
|
|
@@ -7590,17 +7122,6 @@ declare type MaybePromiseLike_2<T> = T | PromiseLike<T>;
|
|
|
7590
7122
|
*/
|
|
7591
7123
|
declare function mediaTypeToExtension(mediaType: string): string;
|
|
7592
7124
|
|
|
7593
|
-
/**
|
|
7594
|
-
* Maps a media type to its corresponding file extension.
|
|
7595
|
-
* It was originally introduced to set a filename for audio file uploads
|
|
7596
|
-
* in https://github.com/vercel/ai/pull/8159.
|
|
7597
|
-
*
|
|
7598
|
-
* @param mediaType The media type to map.
|
|
7599
|
-
* @returns The corresponding file extension
|
|
7600
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/MIME_types/Common_types
|
|
7601
|
-
*/
|
|
7602
|
-
declare function mediaTypeToExtension_2(mediaType: string): string;
|
|
7603
|
-
|
|
7604
7125
|
export declare class MessageConversionError extends AISDKError {
|
|
7605
7126
|
private readonly [symbol$2_2];
|
|
7606
7127
|
readonly originalMessage: Omit<UIMessage, 'id'>;
|
|
@@ -7626,18 +7147,10 @@ export declare class MissingToolResultsError extends AISDKError {
|
|
|
7626
7147
|
*/
|
|
7627
7148
|
export declare type ModelMessage = SystemModelMessage | UserModelMessage | AssistantModelMessage | ToolModelMessage;
|
|
7628
7149
|
|
|
7629
|
-
/**
|
|
7630
|
-
* A message that can be used in the `messages` field of a prompt.
|
|
7631
|
-
* It can be a user message, an assistant message, or a tool message.
|
|
7632
|
-
*/
|
|
7633
|
-
declare type ModelMessage_2 = SystemModelMessage_2 | UserModelMessage_2 | AssistantModelMessage_2 | ToolModelMessage_2;
|
|
7634
|
-
|
|
7635
7150
|
export declare const modelMessageSchema: z.ZodType<ModelMessage>;
|
|
7636
7151
|
|
|
7637
7152
|
declare type NeverOptional<N, T> = 0 extends 1 & N ? Partial<T> : [N] extends [never] ? Partial<Record<keyof T, undefined>> : T;
|
|
7638
7153
|
|
|
7639
|
-
declare type NeverOptional_2<N, T> = 0 extends 1 & N ? Partial<T> : [N] extends [never] ? Partial<Record<keyof T, undefined>> : T;
|
|
7640
|
-
|
|
7641
7154
|
/**
|
|
7642
7155
|
* Thrown when the AI provider fails to generate any content.
|
|
7643
7156
|
*/
|
|
@@ -7730,15 +7243,6 @@ export declare class NoOutputGeneratedError extends AISDKError {
|
|
|
7730
7243
|
*/
|
|
7731
7244
|
declare function normalizeHeaders(headers: HeadersInit | Record<string, string | undefined> | Array<[string, string | undefined]> | undefined): Record<string, string>;
|
|
7732
7245
|
|
|
7733
|
-
/**
|
|
7734
|
-
* Normalizes different header inputs into a plain record with lower-case keys.
|
|
7735
|
-
* Entries with `undefined` or `null` values are removed.
|
|
7736
|
-
*
|
|
7737
|
-
* @param headers - Input headers (`Headers`, tuples array, plain record) to normalize.
|
|
7738
|
-
* @returns A record containing the normalized header entries.
|
|
7739
|
-
*/
|
|
7740
|
-
declare function normalizeHeaders_2(headers: HeadersInit | Record<string, string | undefined> | Array<[string, string | undefined]> | undefined): Record<string, string>;
|
|
7741
|
-
|
|
7742
7246
|
/**
|
|
7743
7247
|
* Error that is thrown when no speech audio was generated.
|
|
7744
7248
|
*/
|
|
@@ -7765,7 +7269,7 @@ export declare class NoSuchModelError extends AISDKError {
|
|
|
7765
7269
|
}
|
|
7766
7270
|
|
|
7767
7271
|
export declare class NoSuchProviderError extends NoSuchModelError {
|
|
7768
|
-
private readonly [
|
|
7272
|
+
private readonly [symbol_3];
|
|
7769
7273
|
readonly providerId: string;
|
|
7770
7274
|
readonly availableProviders: string[];
|
|
7771
7275
|
constructor({ modelId, modelType, providerId, availableProviders, message, }: {
|
|
@@ -7918,7 +7422,7 @@ export declare interface OnStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT ex
|
|
|
7918
7422
|
/** Additional HTTP headers sent with the request. */
|
|
7919
7423
|
readonly headers: Record<string, string | undefined> | undefined;
|
|
7920
7424
|
/** Additional provider-specific options. */
|
|
7921
|
-
readonly providerOptions:
|
|
7425
|
+
readonly providerOptions: ProviderOptions | undefined;
|
|
7922
7426
|
/**
|
|
7923
7427
|
* Condition(s) for stopping the generation.
|
|
7924
7428
|
* When the condition is an array, any of the conditions can be met to stop.
|
|
@@ -7984,7 +7488,7 @@ export declare interface OnStepStartEvent<TOOLS extends ToolSet = ToolSet, OUTPU
|
|
|
7984
7488
|
/** Array of results from previous steps (empty for first step). */
|
|
7985
7489
|
readonly steps: ReadonlyArray<StepResult<TOOLS>>;
|
|
7986
7490
|
/** Additional provider-specific options for this step. */
|
|
7987
|
-
readonly providerOptions:
|
|
7491
|
+
readonly providerOptions: ProviderOptions | undefined;
|
|
7988
7492
|
/**
|
|
7989
7493
|
* Timeout configuration for the generation.
|
|
7990
7494
|
* Can be a number (milliseconds) or an object with totalMs, stepMs, chunkMs.
|
|
@@ -8284,30 +7788,6 @@ declare function parseJSON(options: {
|
|
|
8284
7788
|
* @returns {Promise<T>} - The parsed object.
|
|
8285
7789
|
*/
|
|
8286
7790
|
declare function parseJSON<T>(options: {
|
|
8287
|
-
text: string;
|
|
8288
|
-
schema: FlexibleSchema_2<T>;
|
|
8289
|
-
}): Promise<T>;
|
|
8290
|
-
|
|
8291
|
-
/**
|
|
8292
|
-
* Parses a JSON string into an unknown object.
|
|
8293
|
-
*
|
|
8294
|
-
* @param text - The JSON string to parse.
|
|
8295
|
-
* @returns {JSONValue} - The parsed JSON object.
|
|
8296
|
-
*/
|
|
8297
|
-
declare function parseJSON_2(options: {
|
|
8298
|
-
text: string;
|
|
8299
|
-
schema?: undefined;
|
|
8300
|
-
}): Promise<JSONValue_2>;
|
|
8301
|
-
|
|
8302
|
-
/**
|
|
8303
|
-
* Parses a JSON string into a strongly-typed object using the provided schema.
|
|
8304
|
-
*
|
|
8305
|
-
* @template T - The type of the object to parse the JSON into.
|
|
8306
|
-
* @param {string} text - The JSON string to parse.
|
|
8307
|
-
* @param {Validator<T>} schema - The schema to use for parsing the JSON.
|
|
8308
|
-
* @returns {Promise<T>} - The parsed object.
|
|
8309
|
-
*/
|
|
8310
|
-
declare function parseJSON_2<T>(options: {
|
|
8311
7791
|
text: string;
|
|
8312
7792
|
schema: FlexibleSchema<T>;
|
|
8313
7793
|
}): Promise<T>;
|
|
@@ -8318,14 +7798,6 @@ declare function parseJSON_2<T>(options: {
|
|
|
8318
7798
|
export declare function parseJsonEventStream<T>({ stream, schema, }: {
|
|
8319
7799
|
stream: ReadableStream<Uint8Array>;
|
|
8320
7800
|
schema: FlexibleSchema<T>;
|
|
8321
|
-
}): ReadableStream<ParseResult_2<T>>;
|
|
8322
|
-
|
|
8323
|
-
/**
|
|
8324
|
-
* Parses a JSON event stream into a stream of parsed JSON objects.
|
|
8325
|
-
*/
|
|
8326
|
-
declare function parseJsonEventStream_2<T>({ stream, schema, }: {
|
|
8327
|
-
stream: ReadableStream<Uint8Array>;
|
|
8328
|
-
schema: FlexibleSchema_2<T>;
|
|
8329
7801
|
}): ReadableStream<ParseResult<T>>;
|
|
8330
7802
|
|
|
8331
7803
|
export declare function parsePartialJson(jsonText: string | undefined): Promise<{
|
|
@@ -8334,12 +7806,6 @@ export declare function parsePartialJson(jsonText: string | undefined): Promise<
|
|
|
8334
7806
|
}>;
|
|
8335
7807
|
|
|
8336
7808
|
declare function parseProviderOptions<OPTIONS>({ provider, providerOptions, schema, }: {
|
|
8337
|
-
provider: string;
|
|
8338
|
-
providerOptions: Record<string, unknown> | undefined;
|
|
8339
|
-
schema: FlexibleSchema_2<OPTIONS>;
|
|
8340
|
-
}): Promise<OPTIONS | undefined>;
|
|
8341
|
-
|
|
8342
|
-
declare function parseProviderOptions_2<OPTIONS>({ provider, providerOptions, schema, }: {
|
|
8343
7809
|
provider: string;
|
|
8344
7810
|
providerOptions: Record<string, unknown> | undefined;
|
|
8345
7811
|
schema: FlexibleSchema<OPTIONS>;
|
|
@@ -8355,16 +7821,6 @@ declare type ParseResult<T> = {
|
|
|
8355
7821
|
rawValue: unknown;
|
|
8356
7822
|
};
|
|
8357
7823
|
|
|
8358
|
-
declare type ParseResult_2<T> = {
|
|
8359
|
-
success: true;
|
|
8360
|
-
value: T;
|
|
8361
|
-
rawValue: unknown;
|
|
8362
|
-
} | {
|
|
8363
|
-
success: false;
|
|
8364
|
-
error: JSONParseError | TypeValidationError;
|
|
8365
|
-
rawValue: unknown;
|
|
8366
|
-
};
|
|
8367
|
-
|
|
8368
7824
|
declare type PartialMap<KeyType, ValueType> = {} & Map<DeepPartialInternal<KeyType>, DeepPartialInternal<ValueType>>;
|
|
8369
7825
|
|
|
8370
7826
|
declare type PartialObject<ObjectType extends object> = {
|
|
@@ -8585,20 +8041,6 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
|
|
|
8585
8041
|
responseHeaders?: Record<string, string>;
|
|
8586
8042
|
}>;
|
|
8587
8043
|
|
|
8588
|
-
declare const postFormDataToApi_2: <T>({ url, headers, formData, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
|
|
8589
|
-
url: string;
|
|
8590
|
-
headers?: Record<string, string | undefined>;
|
|
8591
|
-
formData: FormData;
|
|
8592
|
-
failedResponseHandler: ResponseHandler_2<APICallError>;
|
|
8593
|
-
successfulResponseHandler: ResponseHandler_2<T>;
|
|
8594
|
-
abortSignal?: AbortSignal;
|
|
8595
|
-
fetch?: FetchFunction_2;
|
|
8596
|
-
}) => Promise<{
|
|
8597
|
-
value: T;
|
|
8598
|
-
rawValue?: unknown;
|
|
8599
|
-
responseHeaders?: Record<string, string>;
|
|
8600
|
-
}>;
|
|
8601
|
-
|
|
8602
8044
|
declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
|
|
8603
8045
|
url: string;
|
|
8604
8046
|
headers?: Record<string, string | undefined>;
|
|
@@ -8613,20 +8055,6 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
|
|
|
8613
8055
|
responseHeaders?: Record<string, string>;
|
|
8614
8056
|
}>;
|
|
8615
8057
|
|
|
8616
|
-
declare const postJsonToApi_2: <T>({ url, headers, body, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
|
|
8617
|
-
url: string;
|
|
8618
|
-
headers?: Record<string, string | undefined>;
|
|
8619
|
-
body: unknown;
|
|
8620
|
-
failedResponseHandler: ResponseHandler_2<APICallError>;
|
|
8621
|
-
successfulResponseHandler: ResponseHandler_2<T>;
|
|
8622
|
-
abortSignal?: AbortSignal;
|
|
8623
|
-
fetch?: FetchFunction_2;
|
|
8624
|
-
}) => Promise<{
|
|
8625
|
-
value: T;
|
|
8626
|
-
rawValue?: unknown;
|
|
8627
|
-
responseHeaders?: Record<string, string>;
|
|
8628
|
-
}>;
|
|
8629
|
-
|
|
8630
8058
|
declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
8631
8059
|
url: string;
|
|
8632
8060
|
headers?: Record<string, string | undefined>;
|
|
@@ -8644,23 +8072,6 @@ declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, fa
|
|
|
8644
8072
|
responseHeaders?: Record<string, string>;
|
|
8645
8073
|
}>;
|
|
8646
8074
|
|
|
8647
|
-
declare const postToApi_2: <T>({ url, headers, body, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
8648
|
-
url: string;
|
|
8649
|
-
headers?: Record<string, string | undefined>;
|
|
8650
|
-
body: {
|
|
8651
|
-
content: string | FormData | Uint8Array;
|
|
8652
|
-
values: unknown;
|
|
8653
|
-
};
|
|
8654
|
-
failedResponseHandler: ResponseHandler_2<Error>;
|
|
8655
|
-
successfulResponseHandler: ResponseHandler_2<T>;
|
|
8656
|
-
abortSignal?: AbortSignal;
|
|
8657
|
-
fetch?: FetchFunction_2;
|
|
8658
|
-
}) => Promise<{
|
|
8659
|
-
value: T;
|
|
8660
|
-
rawValue?: unknown;
|
|
8661
|
-
responseHeaders?: Record<string, string>;
|
|
8662
|
-
}>;
|
|
8663
|
-
|
|
8664
8075
|
export declare type PrepareReconnectToStreamRequest = (options: {
|
|
8665
8076
|
id: string;
|
|
8666
8077
|
requestMetadata: unknown;
|
|
@@ -8777,7 +8188,7 @@ export declare type PrepareStepResult<TOOLS extends Record<string, Tool> = Recor
|
|
|
8777
8188
|
* Can be used to pass provider-specific configuration such as
|
|
8778
8189
|
* container IDs for Anthropic's code execution.
|
|
8779
8190
|
*/
|
|
8780
|
-
providerOptions?:
|
|
8191
|
+
providerOptions?: ProviderOptions;
|
|
8781
8192
|
} | undefined;
|
|
8782
8193
|
|
|
8783
8194
|
/**
|
|
@@ -8789,6 +8200,15 @@ export declare type Prompt = {
|
|
|
8789
8200
|
* System message to include in the prompt. Can be used with `prompt` or `messages`.
|
|
8790
8201
|
*/
|
|
8791
8202
|
system?: string | SystemModelMessage | Array<SystemModelMessage>;
|
|
8203
|
+
/**
|
|
8204
|
+
* Whether system messages are allowed in the `prompt` or `messages` fields.
|
|
8205
|
+
*
|
|
8206
|
+
* When disabled, system messages must be provided through the `system`
|
|
8207
|
+
* option. When unset, system messages are allowed with a warning.
|
|
8208
|
+
*
|
|
8209
|
+
* @default undefined
|
|
8210
|
+
*/
|
|
8211
|
+
allowSystemInMessages?: boolean;
|
|
8792
8212
|
} & ({
|
|
8793
8213
|
/**
|
|
8794
8214
|
* A prompt. It can be either a text prompt or a list of messages.
|
|
@@ -8871,14 +8291,15 @@ export declare type Provider = {
|
|
|
8871
8291
|
* This is needed to enable provider-specific functionality that can be
|
|
8872
8292
|
* fully encapsulated in the provider.
|
|
8873
8293
|
*/
|
|
8874
|
-
export declare type ProviderMetadata = SharedV3ProviderMetadata;
|
|
8294
|
+
export declare type ProviderMetadata = SharedV3ProviderMetadata;
|
|
8295
|
+
|
|
8875
8296
|
/**
|
|
8876
8297
|
* Additional provider-specific options.
|
|
8877
8298
|
*
|
|
8878
8299
|
* They are passed through to the provider from the AI SDK and enable
|
|
8879
8300
|
* provider-specific functionality that can be fully encapsulated in the provider.
|
|
8880
8301
|
*/
|
|
8881
|
-
declare type
|
|
8302
|
+
declare type ProviderOptions = SharedV3ProviderOptions;
|
|
8882
8303
|
|
|
8883
8304
|
export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV3> = Record<string, ProviderV3>, SEPARATOR extends string = ':'> {
|
|
8884
8305
|
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV3;
|
|
@@ -8896,15 +8317,6 @@ export declare interface ProviderRegistryProvider<PROVIDERS extends Record<strin
|
|
|
8896
8317
|
}
|
|
8897
8318
|
|
|
8898
8319
|
declare type ProviderToolFactory<INPUT, ARGS extends object> = <OUTPUT>(options: ARGS & {
|
|
8899
|
-
execute?: ToolExecuteFunction_2<INPUT, OUTPUT>;
|
|
8900
|
-
needsApproval?: Tool_2<INPUT, OUTPUT>['needsApproval'];
|
|
8901
|
-
toModelOutput?: Tool_2<INPUT, OUTPUT>['toModelOutput'];
|
|
8902
|
-
onInputStart?: Tool_2<INPUT, OUTPUT>['onInputStart'];
|
|
8903
|
-
onInputDelta?: Tool_2<INPUT, OUTPUT>['onInputDelta'];
|
|
8904
|
-
onInputAvailable?: Tool_2<INPUT, OUTPUT>['onInputAvailable'];
|
|
8905
|
-
}) => Tool_2<INPUT, OUTPUT>;
|
|
8906
|
-
|
|
8907
|
-
declare type ProviderToolFactory_2<INPUT, ARGS extends object> = <OUTPUT>(options: ARGS & {
|
|
8908
8320
|
execute?: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
8909
8321
|
needsApproval?: Tool<INPUT, OUTPUT>['needsApproval'];
|
|
8910
8322
|
toModelOutput?: Tool<INPUT, OUTPUT>['toModelOutput'];
|
|
@@ -8914,15 +8326,6 @@ declare type ProviderToolFactory_2<INPUT, ARGS extends object> = <OUTPUT>(option
|
|
|
8914
8326
|
}) => Tool<INPUT, OUTPUT>;
|
|
8915
8327
|
|
|
8916
8328
|
declare type ProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends object> = (options: ARGS & {
|
|
8917
|
-
execute?: ToolExecuteFunction_2<INPUT, OUTPUT>;
|
|
8918
|
-
needsApproval?: Tool_2<INPUT, OUTPUT>['needsApproval'];
|
|
8919
|
-
toModelOutput?: Tool_2<INPUT, OUTPUT>['toModelOutput'];
|
|
8920
|
-
onInputStart?: Tool_2<INPUT, OUTPUT>['onInputStart'];
|
|
8921
|
-
onInputDelta?: Tool_2<INPUT, OUTPUT>['onInputDelta'];
|
|
8922
|
-
onInputAvailable?: Tool_2<INPUT, OUTPUT>['onInputAvailable'];
|
|
8923
|
-
}) => Tool_2<INPUT, OUTPUT>;
|
|
8924
|
-
|
|
8925
|
-
declare type ProviderToolFactoryWithOutputSchema_2<INPUT, OUTPUT, ARGS extends object> = (options: ARGS & {
|
|
8926
8329
|
execute?: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
8927
8330
|
needsApproval?: Tool<INPUT, OUTPUT>['needsApproval'];
|
|
8928
8331
|
toModelOutput?: Tool<INPUT, OUTPUT>['toModelOutput'];
|
|
@@ -9105,25 +8508,6 @@ declare function readResponseWithSizeLimit({ response, url, maxBytes, }: {
|
|
|
9105
8508
|
maxBytes?: number;
|
|
9106
8509
|
}): Promise<Uint8Array>;
|
|
9107
8510
|
|
|
9108
|
-
/**
|
|
9109
|
-
* Reads a fetch Response body with a size limit to prevent memory exhaustion.
|
|
9110
|
-
*
|
|
9111
|
-
* Checks the Content-Length header for early rejection, then reads the body
|
|
9112
|
-
* incrementally via ReadableStream and aborts with a DownloadError when the
|
|
9113
|
-
* limit is exceeded.
|
|
9114
|
-
*
|
|
9115
|
-
* @param response - The fetch Response to read.
|
|
9116
|
-
* @param url - The URL being downloaded (used in error messages).
|
|
9117
|
-
* @param maxBytes - Maximum allowed bytes. Defaults to DEFAULT_MAX_DOWNLOAD_SIZE.
|
|
9118
|
-
* @returns A Uint8Array containing the response body.
|
|
9119
|
-
* @throws DownloadError if the response exceeds maxBytes.
|
|
9120
|
-
*/
|
|
9121
|
-
declare function readResponseWithSizeLimit_2({ response, url, maxBytes, }: {
|
|
9122
|
-
response: Response;
|
|
9123
|
-
url: string;
|
|
9124
|
-
maxBytes?: number;
|
|
9125
|
-
}): Promise<Uint8Array>;
|
|
9126
|
-
|
|
9127
8511
|
/**
|
|
9128
8512
|
* Transforms a stream of `UIMessageChunk`s into an `AsyncIterableStream` of `UIMessage`s.
|
|
9129
8513
|
*
|
|
@@ -9176,23 +8560,6 @@ declare interface ReasoningPart {
|
|
|
9176
8560
|
providerOptions?: ProviderOptions;
|
|
9177
8561
|
}
|
|
9178
8562
|
|
|
9179
|
-
/**
|
|
9180
|
-
* Reasoning content part of a prompt. It contains a reasoning.
|
|
9181
|
-
*/
|
|
9182
|
-
declare interface ReasoningPart_2 {
|
|
9183
|
-
type: 'reasoning';
|
|
9184
|
-
/**
|
|
9185
|
-
* The reasoning text.
|
|
9186
|
-
*/
|
|
9187
|
-
text: string;
|
|
9188
|
-
/**
|
|
9189
|
-
* Additional provider-specific metadata. They are passed through
|
|
9190
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
9191
|
-
* functionality that can be fully encapsulated in the provider.
|
|
9192
|
-
*/
|
|
9193
|
-
providerOptions?: ProviderOptions_2;
|
|
9194
|
-
}
|
|
9195
|
-
|
|
9196
8563
|
/**
|
|
9197
8564
|
* A reasoning part of a message.
|
|
9198
8565
|
*/
|
|
@@ -9224,13 +8591,6 @@ export declare function registerTelemetryIntegration(integration: TelemetryInteg
|
|
|
9224
8591
|
*/
|
|
9225
8592
|
declare function removeUndefinedEntries<T>(record: Record<string, T | undefined>): Record<string, T>;
|
|
9226
8593
|
|
|
9227
|
-
/**
|
|
9228
|
-
* Removes entries from a record where the value is null or undefined.
|
|
9229
|
-
* @param record - The input object whose entries may be null or undefined.
|
|
9230
|
-
* @returns A new object containing only entries with non-null and non-undefined values.
|
|
9231
|
-
*/
|
|
9232
|
-
declare function removeUndefinedEntries_2<T>(record: Record<string, T | undefined>): Record<string, T>;
|
|
9233
|
-
|
|
9234
8594
|
/**
|
|
9235
8595
|
* A function that attempts to repair the raw output of the model
|
|
9236
8596
|
* to enable JSON parsing.
|
|
@@ -9258,7 +8618,7 @@ export declare type RepairTextFunction = (options: {
|
|
|
9258
8618
|
*
|
|
9259
8619
|
* @returns A result object that contains the reranked documents, the reranked indices, and additional information.
|
|
9260
8620
|
*/
|
|
9261
|
-
export declare function rerank<VALUE extends JSONObject | string>({ model, documents, query, topN, maxRetries: maxRetriesArg, abortSignal, headers, providerOptions, experimental_telemetry: telemetry, }: {
|
|
8621
|
+
export declare function rerank<VALUE extends JSONObject | string>({ model: modelArg, documents, query, topN, maxRetries: maxRetriesArg, abortSignal, headers, providerOptions, experimental_telemetry: telemetry, }: {
|
|
9262
8622
|
/**
|
|
9263
8623
|
* The reranking model to use.
|
|
9264
8624
|
*/
|
|
@@ -9299,13 +8659,13 @@ export declare function rerank<VALUE extends JSONObject | string>({ model, docum
|
|
|
9299
8659
|
* to the provider from the AI SDK and enable provider-specific
|
|
9300
8660
|
* functionality that can be fully encapsulated in the provider.
|
|
9301
8661
|
*/
|
|
9302
|
-
providerOptions?:
|
|
8662
|
+
providerOptions?: ProviderOptions;
|
|
9303
8663
|
}): Promise<RerankResult<VALUE>>;
|
|
9304
8664
|
|
|
9305
8665
|
/**
|
|
9306
8666
|
* Reranking model that is used by the AI SDK.
|
|
9307
8667
|
*/
|
|
9308
|
-
export declare type RerankingModel = RerankingModelV3;
|
|
8668
|
+
export declare type RerankingModel = string | RerankingModelV3;
|
|
9309
8669
|
|
|
9310
8670
|
/**
|
|
9311
8671
|
* Specification for a reranking model that implements the reranking model interface version 3.
|
|
@@ -9479,20 +8839,12 @@ export declare interface RerankResult<VALUE> {
|
|
|
9479
8839
|
|
|
9480
8840
|
declare type Resolvable<T> = MaybePromiseLike<T> | (() => MaybePromiseLike<T>);
|
|
9481
8841
|
|
|
9482
|
-
declare type Resolvable_2<T> = MaybePromiseLike_2<T> | (() => MaybePromiseLike_2<T>);
|
|
9483
|
-
|
|
9484
8842
|
/**
|
|
9485
8843
|
* Resolves a value that could be a raw value, a Promise, a function returning a value,
|
|
9486
8844
|
* or a function returning a Promise.
|
|
9487
8845
|
*/
|
|
9488
8846
|
declare function resolve<T>(value: Resolvable<T>): Promise<T>;
|
|
9489
8847
|
|
|
9490
|
-
/**
|
|
9491
|
-
* Resolves a value that could be a raw value, a Promise, a function returning a value,
|
|
9492
|
-
* or a function returning a Promise.
|
|
9493
|
-
*/
|
|
9494
|
-
declare function resolve_2<T>(value: Resolvable_2<T>): Promise<T>;
|
|
9495
|
-
|
|
9496
8848
|
declare type ResponseHandler<RETURN_TYPE> = (options: {
|
|
9497
8849
|
url: string;
|
|
9498
8850
|
requestBodyValues: unknown;
|
|
@@ -9503,16 +8855,6 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
|
|
|
9503
8855
|
responseHeaders?: Record<string, string>;
|
|
9504
8856
|
}>;
|
|
9505
8857
|
|
|
9506
|
-
declare type ResponseHandler_2<RETURN_TYPE> = (options: {
|
|
9507
|
-
url: string;
|
|
9508
|
-
requestBodyValues: unknown;
|
|
9509
|
-
response: Response;
|
|
9510
|
-
}) => PromiseLike<{
|
|
9511
|
-
value: RETURN_TYPE;
|
|
9512
|
-
rawValue?: unknown;
|
|
9513
|
-
responseHeaders?: Record<string, string>;
|
|
9514
|
-
}>;
|
|
9515
|
-
|
|
9516
8858
|
/**
|
|
9517
8859
|
* A message that was generated during the generation process.
|
|
9518
8860
|
* It can be either an assistant message or a tool message.
|
|
@@ -9554,33 +8896,9 @@ declare function safeParseJSON(options: {
|
|
|
9554
8896
|
* @returns An object with either a `success` flag and the parsed and typed data, or a `success` flag and an error object.
|
|
9555
8897
|
*/
|
|
9556
8898
|
declare function safeParseJSON<T>(options: {
|
|
9557
|
-
text: string;
|
|
9558
|
-
schema: FlexibleSchema_2<T>;
|
|
9559
|
-
}): Promise<ParseResult<T>>;
|
|
9560
|
-
|
|
9561
|
-
/**
|
|
9562
|
-
* Safely parses a JSON string and returns the result as an object of type `unknown`.
|
|
9563
|
-
*
|
|
9564
|
-
* @param text - The JSON string to parse.
|
|
9565
|
-
* @returns {Promise<object>} Either an object with `success: true` and the parsed data, or an object with `success: false` and the error that occurred.
|
|
9566
|
-
*/
|
|
9567
|
-
declare function safeParseJSON_2(options: {
|
|
9568
|
-
text: string;
|
|
9569
|
-
schema?: undefined;
|
|
9570
|
-
}): Promise<ParseResult_2<JSONValue_2>>;
|
|
9571
|
-
|
|
9572
|
-
/**
|
|
9573
|
-
* Safely parses a JSON string into a strongly-typed object, using a provided schema to validate the object.
|
|
9574
|
-
*
|
|
9575
|
-
* @template T - The type of the object to parse the JSON into.
|
|
9576
|
-
* @param {string} text - The JSON string to parse.
|
|
9577
|
-
* @param {Validator<T>} schema - The schema to use for parsing the JSON.
|
|
9578
|
-
* @returns An object with either a `success` flag and the parsed and typed data, or a `success` flag and an error object.
|
|
9579
|
-
*/
|
|
9580
|
-
declare function safeParseJSON_2<T>(options: {
|
|
9581
8899
|
text: string;
|
|
9582
8900
|
schema: FlexibleSchema<T>;
|
|
9583
|
-
}): Promise<
|
|
8901
|
+
}): Promise<ParseResult<T>>;
|
|
9584
8902
|
|
|
9585
8903
|
/**
|
|
9586
8904
|
* Safely validates the types of an unknown object using a schema and
|
|
@@ -9594,7 +8912,7 @@ declare function safeParseJSON_2<T>(options: {
|
|
|
9594
8912
|
*/
|
|
9595
8913
|
declare function safeValidateTypes<OBJECT>({ value, schema, context, }: {
|
|
9596
8914
|
value: unknown;
|
|
9597
|
-
schema:
|
|
8915
|
+
schema: FlexibleSchema<OBJECT>;
|
|
9598
8916
|
context?: TypeValidationContext;
|
|
9599
8917
|
}): Promise<{
|
|
9600
8918
|
success: true;
|
|
@@ -9607,33 +8925,9 @@ declare function safeValidateTypes<OBJECT>({ value, schema, context, }: {
|
|
|
9607
8925
|
}>;
|
|
9608
8926
|
|
|
9609
8927
|
/**
|
|
9610
|
-
*
|
|
9611
|
-
*
|
|
9612
|
-
*
|
|
9613
|
-
* @template T - The type of the object to validate.
|
|
9614
|
-
* @param {string} options.value - The JSON object to validate.
|
|
9615
|
-
* @param {Validator<T>} options.schema - The schema to use for validating the JSON.
|
|
9616
|
-
* @param {TypeValidationContext} options.context - Optional context about what is being validated.
|
|
9617
|
-
* @returns An object with either a `success` flag and the parsed and typed data, or a `success` flag and an error object.
|
|
9618
|
-
*/
|
|
9619
|
-
declare function safeValidateTypes_2<OBJECT>({ value, schema, context, }: {
|
|
9620
|
-
value: unknown;
|
|
9621
|
-
schema: FlexibleSchema<OBJECT>;
|
|
9622
|
-
context?: TypeValidationContext;
|
|
9623
|
-
}): Promise<{
|
|
9624
|
-
success: true;
|
|
9625
|
-
value: OBJECT;
|
|
9626
|
-
rawValue: unknown;
|
|
9627
|
-
} | {
|
|
9628
|
-
success: false;
|
|
9629
|
-
error: TypeValidationError;
|
|
9630
|
-
rawValue: unknown;
|
|
9631
|
-
}>;
|
|
9632
|
-
|
|
9633
|
-
/**
|
|
9634
|
-
* Validates a list of UI messages like `validateUIMessages`,
|
|
9635
|
-
* but instead of throwing it returns `{ success: true, data }`
|
|
9636
|
-
* or `{ success: false, error }`.
|
|
8928
|
+
* Validates a list of UI messages like `validateUIMessages`,
|
|
8929
|
+
* but instead of throwing it returns `{ success: true, data }`
|
|
8930
|
+
* or `{ success: false, error }`.
|
|
9637
8931
|
*/
|
|
9638
8932
|
export declare function safeValidateUIMessages<UI_MESSAGE extends UIMessage>({ messages, metadataSchema, dataSchemas, tools, }: {
|
|
9639
8933
|
messages: unknown;
|
|
@@ -9655,26 +8949,6 @@ export declare type SafeValidateUIMessagesResult<UI_MESSAGE extends UIMessage> =
|
|
|
9655
8949
|
};
|
|
9656
8950
|
|
|
9657
8951
|
export declare type Schema<OBJECT = unknown> = {
|
|
9658
|
-
/**
|
|
9659
|
-
* Used to mark schemas so we can support both Zod and custom schemas.
|
|
9660
|
-
*/
|
|
9661
|
-
[schemaSymbol_2]: true;
|
|
9662
|
-
/**
|
|
9663
|
-
* Schema type for inference.
|
|
9664
|
-
*/
|
|
9665
|
-
_type: OBJECT;
|
|
9666
|
-
/**
|
|
9667
|
-
* Optional. Validates that the structure of a value matches this schema,
|
|
9668
|
-
* and returns a typed version of the value if it does.
|
|
9669
|
-
*/
|
|
9670
|
-
readonly validate?: (value: unknown) => ValidationResult_2<OBJECT> | PromiseLike<ValidationResult_2<OBJECT>>;
|
|
9671
|
-
/**
|
|
9672
|
-
* The JSON Schema for the schema. It is passed to the providers.
|
|
9673
|
-
*/
|
|
9674
|
-
readonly jsonSchema: JSONSchema7 | PromiseLike<JSONSchema7>;
|
|
9675
|
-
};
|
|
9676
|
-
|
|
9677
|
-
declare type Schema_2<OBJECT = unknown> = {
|
|
9678
8952
|
/**
|
|
9679
8953
|
* Used to mark schemas so we can support both Zod and custom schemas.
|
|
9680
8954
|
*/
|
|
@@ -9699,11 +8973,6 @@ declare type Schema_2<OBJECT = unknown> = {
|
|
|
9699
8973
|
*/
|
|
9700
8974
|
declare const schemaSymbol: unique symbol;
|
|
9701
8975
|
|
|
9702
|
-
/**
|
|
9703
|
-
* Used to mark schemas so we can support both Zod and custom schemas.
|
|
9704
|
-
*/
|
|
9705
|
-
declare const schemaSymbol_2: unique symbol;
|
|
9706
|
-
|
|
9707
8976
|
export declare class SerialJobExecutor {
|
|
9708
8977
|
private queue;
|
|
9709
8978
|
private isProcessing;
|
|
@@ -10006,6 +9275,8 @@ export declare type SourceUrlUIPart = {
|
|
|
10006
9275
|
* may have children.
|
|
10007
9276
|
*
|
|
10008
9277
|
* Spans are created by the {@link Tracer.startSpan} method.
|
|
9278
|
+
*
|
|
9279
|
+
* @since 1.0.0
|
|
10009
9280
|
*/
|
|
10010
9281
|
declare interface Span {
|
|
10011
9282
|
/**
|
|
@@ -10065,11 +9336,21 @@ declare interface Span {
|
|
|
10065
9336
|
*/
|
|
10066
9337
|
addLinks(links: Link[]): this;
|
|
10067
9338
|
/**
|
|
10068
|
-
* Sets
|
|
10069
|
-
* status. Default is {@link SpanStatusCode.UNSET}. SetStatus overrides the value
|
|
10070
|
-
* of previous calls to SetStatus on the Span.
|
|
9339
|
+
* Sets the status of the span.
|
|
10071
9340
|
*
|
|
10072
|
-
*
|
|
9341
|
+
* By default, a span has status {@link SpanStatusCode.UNSET}.
|
|
9342
|
+
* Calling this method overrides that default.
|
|
9343
|
+
*
|
|
9344
|
+
* The status codes have a total order: `OK > ERROR > UNSET`.
|
|
9345
|
+
*
|
|
9346
|
+
* - Once {@link SpanStatusCode.OK} is set, any further attempts to change
|
|
9347
|
+
* the status are ignored.
|
|
9348
|
+
* - Any attempt to set {@link SpanStatusCode.UNSET} is always ignored.
|
|
9349
|
+
*
|
|
9350
|
+
* The `message` field is only used when {@link SpanStatusCode.ERROR} is set.
|
|
9351
|
+
* For all other status codes, `message` is ignored.
|
|
9352
|
+
*
|
|
9353
|
+
* @param status The {@link SpanStatus} to set.
|
|
10073
9354
|
*/
|
|
10074
9355
|
setStatus(status: SpanStatus): this;
|
|
10075
9356
|
/**
|
|
@@ -10114,17 +9395,21 @@ declare interface Span {
|
|
|
10114
9395
|
|
|
10115
9396
|
/**
|
|
10116
9397
|
* @deprecated please use {@link Attributes}
|
|
9398
|
+
* @since 1.0.0
|
|
10117
9399
|
*/
|
|
10118
9400
|
declare type SpanAttributes = Attributes;
|
|
10119
9401
|
|
|
10120
9402
|
/**
|
|
10121
9403
|
* @deprecated please use {@link AttributeValue}
|
|
9404
|
+
* @since 1.0.0
|
|
10122
9405
|
*/
|
|
10123
9406
|
declare type SpanAttributeValue = AttributeValue;
|
|
10124
9407
|
|
|
10125
9408
|
/**
|
|
10126
9409
|
* A SpanContext represents the portion of a {@link Span} which must be
|
|
10127
9410
|
* serialized and propagated along side of a {@link Baggage}.
|
|
9411
|
+
*
|
|
9412
|
+
* @since 1.0.0
|
|
10128
9413
|
*/
|
|
10129
9414
|
declare interface SpanContext {
|
|
10130
9415
|
/**
|
|
@@ -10174,6 +9459,9 @@ declare interface SpanContext {
|
|
|
10174
9459
|
traceState?: TraceState;
|
|
10175
9460
|
}
|
|
10176
9461
|
|
|
9462
|
+
/**
|
|
9463
|
+
* @since 1.0.0
|
|
9464
|
+
*/
|
|
10177
9465
|
declare enum SpanKind {
|
|
10178
9466
|
/** Default value. Indicates that the span is used internally. */
|
|
10179
9467
|
INTERNAL = 0,
|
|
@@ -10203,6 +9491,8 @@ declare enum SpanKind {
|
|
|
10203
9491
|
|
|
10204
9492
|
/**
|
|
10205
9493
|
* Options needed for span creation
|
|
9494
|
+
*
|
|
9495
|
+
* @since 1.0.0
|
|
10206
9496
|
*/
|
|
10207
9497
|
declare interface SpanOptions {
|
|
10208
9498
|
/**
|
|
@@ -10211,7 +9501,7 @@ declare interface SpanOptions {
|
|
|
10211
9501
|
*/
|
|
10212
9502
|
kind?: SpanKind;
|
|
10213
9503
|
/** A span's attributes */
|
|
10214
|
-
attributes?:
|
|
9504
|
+
attributes?: Attributes;
|
|
10215
9505
|
/** {@link Link}s span to other spans */
|
|
10216
9506
|
links?: Link[];
|
|
10217
9507
|
/** A manually specified start time for the created `Span` object. */
|
|
@@ -10220,6 +9510,9 @@ declare interface SpanOptions {
|
|
|
10220
9510
|
root?: boolean;
|
|
10221
9511
|
}
|
|
10222
9512
|
|
|
9513
|
+
/**
|
|
9514
|
+
* @since 1.0.0
|
|
9515
|
+
*/
|
|
10223
9516
|
declare interface SpanStatus {
|
|
10224
9517
|
/** The status code of this message. */
|
|
10225
9518
|
code: SpanStatusCode;
|
|
@@ -10229,6 +9522,8 @@ declare interface SpanStatus {
|
|
|
10229
9522
|
|
|
10230
9523
|
/**
|
|
10231
9524
|
* An enumeration of status codes.
|
|
9525
|
+
*
|
|
9526
|
+
* @since 1.0.0
|
|
10232
9527
|
*/
|
|
10233
9528
|
declare enum SpanStatusCode {
|
|
10234
9529
|
/**
|
|
@@ -10584,8 +9879,6 @@ declare namespace StandardJSONSchemaV1 {
|
|
|
10584
9879
|
|
|
10585
9880
|
declare type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & StandardJSONSchemaV1<unknown, SCHEMA>;
|
|
10586
9881
|
|
|
10587
|
-
declare type StandardSchema_2<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & StandardJSONSchemaV1<unknown, SCHEMA>;
|
|
10588
|
-
|
|
10589
9882
|
/** The Standard Schema interface. */
|
|
10590
9883
|
declare interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
10591
9884
|
/** The Standard Schema properties. */
|
|
@@ -10763,7 +10056,7 @@ export declare type StepResult<TOOLS extends ToolSet> = {
|
|
|
10763
10056
|
/**
|
|
10764
10057
|
* The reasoning that was generated during the generation.
|
|
10765
10058
|
*/
|
|
10766
|
-
readonly reasoning: Array<
|
|
10059
|
+
readonly reasoning: Array<ReasoningPart>;
|
|
10767
10060
|
/**
|
|
10768
10061
|
* The reasoning text that was generated during the generation.
|
|
10769
10062
|
*/
|
|
@@ -10864,6 +10157,7 @@ export declare type StopCondition<TOOLS extends ToolSet> = (options: {
|
|
|
10864
10157
|
* @param system - A system message that will be part of the prompt.
|
|
10865
10158
|
* @param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
|
|
10866
10159
|
* @param messages - A list of messages. You can either use `prompt` or `messages` but not both.
|
|
10160
|
+
* @param allowSystemInMessages - Whether system messages are allowed in the `prompt` or `messages` fields. When unset, system messages are allowed with a warning.
|
|
10867
10161
|
*
|
|
10868
10162
|
* @param maxOutputTokens - Maximum number of tokens to generate.
|
|
10869
10163
|
* @param temperature - Temperature setting.
|
|
@@ -10965,7 +10259,7 @@ export declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = Fl
|
|
|
10965
10259
|
* to the provider from the AI SDK and enable provider-specific
|
|
10966
10260
|
* functionality that can be fully encapsulated in the provider.
|
|
10967
10261
|
*/
|
|
10968
|
-
providerOptions?:
|
|
10262
|
+
providerOptions?: ProviderOptions;
|
|
10969
10263
|
/**
|
|
10970
10264
|
* Callback that is invoked when an error occurs during streaming.
|
|
10971
10265
|
* You can use it to log errors.
|
|
@@ -11121,19 +10415,19 @@ declare interface StreamOptions {
|
|
|
11121
10415
|
*
|
|
11122
10416
|
* @defaultValue `undefined`
|
|
11123
10417
|
*/
|
|
11124
|
-
onError?: (
|
|
10418
|
+
onError?: ("terminate" | ((error: Error) => void)) | undefined;
|
|
11125
10419
|
/**
|
|
11126
10420
|
* Callback for when a reconnection interval is sent from the server.
|
|
11127
10421
|
*
|
|
11128
10422
|
* @param retry - The number of milliseconds to wait before reconnecting.
|
|
11129
10423
|
*/
|
|
11130
|
-
onRetry?: ((retry: number) => void) | undefined
|
|
10424
|
+
onRetry?: ((retry: number) => void) | undefined;
|
|
11131
10425
|
/**
|
|
11132
10426
|
* Callback for when a comment is encountered in the stream.
|
|
11133
10427
|
*
|
|
11134
10428
|
* @param comment - The comment encountered in the stream.
|
|
11135
10429
|
*/
|
|
11136
|
-
onComment?: ((comment: string) => void) | undefined
|
|
10430
|
+
onComment?: ((comment: string) => void) | undefined;
|
|
11137
10431
|
}
|
|
11138
10432
|
|
|
11139
10433
|
/**
|
|
@@ -11147,6 +10441,7 @@ declare interface StreamOptions {
|
|
|
11147
10441
|
* @param system - A system message that will be part of the prompt.
|
|
11148
10442
|
* @param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
|
|
11149
10443
|
* @param messages - A list of messages. You can either use `prompt` or `messages` but not both.
|
|
10444
|
+
* @param allowSystemInMessages - Whether system messages are allowed in the `prompt` or `messages` fields. When unset, system messages are allowed with a warning.
|
|
11150
10445
|
*
|
|
11151
10446
|
* @param maxOutputTokens - Maximum number of tokens to generate.
|
|
11152
10447
|
* @param temperature - Temperature setting.
|
|
@@ -11182,7 +10477,7 @@ declare interface StreamOptions {
|
|
|
11182
10477
|
* @returns
|
|
11183
10478
|
* A result object for accessing different stream types and additional information.
|
|
11184
10479
|
*/
|
|
11185
|
-
export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string, never>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, experimental_context, experimental_include: include, _internal: { now, generateId }, ...settings }: CallSettings & Prompt & {
|
|
10480
|
+
export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string, never>>({ model, tools, toolChoice, system, prompt, messages, allowSystemInMessages, maxRetries, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, experimental_context, experimental_include: include, _internal: { now, generateId }, ...settings }: CallSettings & Prompt & {
|
|
11186
10481
|
/**
|
|
11187
10482
|
* The language model to use.
|
|
11188
10483
|
*/
|
|
@@ -11211,7 +10506,7 @@ export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_
|
|
|
11211
10506
|
* to the provider from the AI SDK and enable provider-specific
|
|
11212
10507
|
* functionality that can be fully encapsulated in the provider.
|
|
11213
10508
|
*/
|
|
11214
|
-
providerOptions?:
|
|
10509
|
+
providerOptions?: ProviderOptions;
|
|
11215
10510
|
/**
|
|
11216
10511
|
* @deprecated Use `activeTools` instead.
|
|
11217
10512
|
*/
|
|
@@ -11657,16 +10952,6 @@ export declare type StreamTextTransform<TOOLS extends ToolSet> = (options: {
|
|
|
11657
10952
|
*/
|
|
11658
10953
|
declare function stripFileExtension(filename: string): string;
|
|
11659
10954
|
|
|
11660
|
-
/**
|
|
11661
|
-
* Strips file extension segments from a filename.
|
|
11662
|
-
*
|
|
11663
|
-
* Examples:
|
|
11664
|
-
* - "report.pdf" -> "report"
|
|
11665
|
-
* - "archive.tar.gz" -> "archive"
|
|
11666
|
-
* - "filename" -> "filename"
|
|
11667
|
-
*/
|
|
11668
|
-
declare function stripFileExtension_2(filename: string): string;
|
|
11669
|
-
|
|
11670
10955
|
declare const symbol$1: unique symbol;
|
|
11671
10956
|
|
|
11672
10957
|
declare const symbol$1_2: unique symbol;
|
|
@@ -11737,8 +11022,6 @@ declare const symbol_2: unique symbol;
|
|
|
11737
11022
|
|
|
11738
11023
|
declare const symbol_3: unique symbol;
|
|
11739
11024
|
|
|
11740
|
-
declare const symbol_4: unique symbol;
|
|
11741
|
-
|
|
11742
11025
|
/**
|
|
11743
11026
|
* A system message. It can contain system information.
|
|
11744
11027
|
*
|
|
@@ -11747,24 +11030,6 @@ declare const symbol_4: unique symbol;
|
|
|
11747
11030
|
* and because not all providers support several system messages.
|
|
11748
11031
|
*/
|
|
11749
11032
|
export declare type SystemModelMessage = {
|
|
11750
|
-
role: 'system';
|
|
11751
|
-
content: string;
|
|
11752
|
-
/**
|
|
11753
|
-
* Additional provider-specific metadata. They are passed through
|
|
11754
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
11755
|
-
* functionality that can be fully encapsulated in the provider.
|
|
11756
|
-
*/
|
|
11757
|
-
providerOptions?: ProviderOptions_2;
|
|
11758
|
-
};
|
|
11759
|
-
|
|
11760
|
-
/**
|
|
11761
|
-
* A system message. It can contain system information.
|
|
11762
|
-
*
|
|
11763
|
-
* Note: using the "system" part of the prompt is strongly preferred
|
|
11764
|
-
* to increase the resilience against prompt injection attacks,
|
|
11765
|
-
* and because not all providers support several system messages.
|
|
11766
|
-
*/
|
|
11767
|
-
declare type SystemModelMessage_2 = {
|
|
11768
11033
|
role: 'system';
|
|
11769
11034
|
content: string;
|
|
11770
11035
|
/**
|
|
@@ -11837,23 +11102,6 @@ export declare type TelemetrySettings = {
|
|
|
11837
11102
|
* Text content part of a prompt. It contains a string of text.
|
|
11838
11103
|
*/
|
|
11839
11104
|
export declare interface TextPart {
|
|
11840
|
-
type: 'text';
|
|
11841
|
-
/**
|
|
11842
|
-
* The text content.
|
|
11843
|
-
*/
|
|
11844
|
-
text: string;
|
|
11845
|
-
/**
|
|
11846
|
-
* Additional provider-specific metadata. They are passed through
|
|
11847
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
11848
|
-
* functionality that can be fully encapsulated in the provider.
|
|
11849
|
-
*/
|
|
11850
|
-
providerOptions?: ProviderOptions_2;
|
|
11851
|
-
}
|
|
11852
|
-
|
|
11853
|
-
/**
|
|
11854
|
-
* Text content part of a prompt. It contains a string of text.
|
|
11855
|
-
*/
|
|
11856
|
-
declare interface TextPart_2 {
|
|
11857
11105
|
type: 'text';
|
|
11858
11106
|
/**
|
|
11859
11107
|
* The text content.
|
|
@@ -11981,6 +11229,8 @@ export declare type TextUIPart = {
|
|
|
11981
11229
|
* Defines TimeInput.
|
|
11982
11230
|
*
|
|
11983
11231
|
* hrtime, epoch milliseconds, performance.now() or Date
|
|
11232
|
+
*
|
|
11233
|
+
* @since 1.0.0
|
|
11984
11234
|
*/
|
|
11985
11235
|
declare type TimeInput = HrTime | number | Date;
|
|
11986
11236
|
|
|
@@ -12019,7 +11269,17 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
12019
11269
|
* to the provider from the AI SDK and enable provider-specific
|
|
12020
11270
|
* functionality that can be fully encapsulated in the provider.
|
|
12021
11271
|
*/
|
|
12022
|
-
providerOptions?:
|
|
11272
|
+
providerOptions?: ProviderOptions;
|
|
11273
|
+
/**
|
|
11274
|
+
* Optional metadata about the tool itself (e.g. its source).
|
|
11275
|
+
*
|
|
11276
|
+
* Unlike `providerOptions`, this metadata is not sent to the language
|
|
11277
|
+
* model. Instead, it is propagated onto the resulting tool call's
|
|
11278
|
+
* `providerMetadata` so consumers can read it from tool call / result
|
|
11279
|
+
* parts and UI message parts. This is useful for sources of dynamic
|
|
11280
|
+
* tools (e.g. an MCP server) to identify themselves.
|
|
11281
|
+
*/
|
|
11282
|
+
providerMetadata?: SharedV3ProviderMetadata;
|
|
12023
11283
|
/**
|
|
12024
11284
|
* The schema of the input that the tool expects.
|
|
12025
11285
|
* The language model will use this to generate the input.
|
|
@@ -12038,7 +11298,7 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
12038
11298
|
/**
|
|
12039
11299
|
* Whether the tool needs approval before it can be executed.
|
|
12040
11300
|
*/
|
|
12041
|
-
needsApproval?: boolean |
|
|
11301
|
+
needsApproval?: boolean | ToolNeedsApprovalFunction<[INPUT] extends [never] ? unknown : INPUT>;
|
|
12042
11302
|
/**
|
|
12043
11303
|
* Strict mode setting for the tool.
|
|
12044
11304
|
*
|
|
@@ -12066,7 +11326,7 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
12066
11326
|
onInputAvailable?: (options: {
|
|
12067
11327
|
input: [INPUT] extends [never] ? unknown : INPUT;
|
|
12068
11328
|
} & ToolExecutionOptions) => void | PromiseLike<void>;
|
|
12069
|
-
} &
|
|
11329
|
+
} & ToolOutputProperties<INPUT, OUTPUT> & {
|
|
12070
11330
|
/**
|
|
12071
11331
|
* Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
12072
11332
|
*
|
|
@@ -12085,7 +11345,7 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
12085
11345
|
* The output of the tool call.
|
|
12086
11346
|
*/
|
|
12087
11347
|
output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>;
|
|
12088
|
-
}) =>
|
|
11348
|
+
}) => ToolResultOutput | PromiseLike<ToolResultOutput>;
|
|
12089
11349
|
} & ({
|
|
12090
11350
|
/**
|
|
12091
11351
|
* Tool with user-defined input and output schemas.
|
|
@@ -12137,146 +11397,6 @@ export declare function tool<OUTPUT>(tool: Tool<never, OUTPUT>): Tool<never, OUT
|
|
|
12137
11397
|
|
|
12138
11398
|
export declare function tool(tool: Tool<never, never>): Tool<never, never>;
|
|
12139
11399
|
|
|
12140
|
-
/**
|
|
12141
|
-
* A tool contains the description and the schema of the input that the tool expects.
|
|
12142
|
-
* This enables the language model to generate the input.
|
|
12143
|
-
*
|
|
12144
|
-
* The tool can also contain an optional execute function for the actual execution function of the tool.
|
|
12145
|
-
*/
|
|
12146
|
-
declare type Tool_2<INPUT extends JSONValue_2 | unknown | never = any, OUTPUT extends JSONValue_2 | unknown | never = any> = {
|
|
12147
|
-
/**
|
|
12148
|
-
* An optional description of what the tool does.
|
|
12149
|
-
* Will be used by the language model to decide whether to use the tool.
|
|
12150
|
-
* Not used for provider-defined tools.
|
|
12151
|
-
*/
|
|
12152
|
-
description?: string;
|
|
12153
|
-
/**
|
|
12154
|
-
* An optional title of the tool.
|
|
12155
|
-
*/
|
|
12156
|
-
title?: string;
|
|
12157
|
-
/**
|
|
12158
|
-
* Additional provider-specific metadata. They are passed through
|
|
12159
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
12160
|
-
* functionality that can be fully encapsulated in the provider.
|
|
12161
|
-
*/
|
|
12162
|
-
providerOptions?: ProviderOptions;
|
|
12163
|
-
/**
|
|
12164
|
-
* The schema of the input that the tool expects.
|
|
12165
|
-
* The language model will use this to generate the input.
|
|
12166
|
-
* It is also used to validate the output of the language model.
|
|
12167
|
-
*
|
|
12168
|
-
* You can use descriptions on the schema properties to make the input understandable for the language model.
|
|
12169
|
-
*/
|
|
12170
|
-
inputSchema: FlexibleSchema_2<INPUT>;
|
|
12171
|
-
/**
|
|
12172
|
-
* An optional list of input examples that show the language
|
|
12173
|
-
* model what the input should look like.
|
|
12174
|
-
*/
|
|
12175
|
-
inputExamples?: Array<{
|
|
12176
|
-
input: NoInfer<INPUT>;
|
|
12177
|
-
}>;
|
|
12178
|
-
/**
|
|
12179
|
-
* Whether the tool needs approval before it can be executed.
|
|
12180
|
-
*/
|
|
12181
|
-
needsApproval?: boolean | ToolNeedsApprovalFunction<[INPUT] extends [never] ? unknown : INPUT>;
|
|
12182
|
-
/**
|
|
12183
|
-
* Strict mode setting for the tool.
|
|
12184
|
-
*
|
|
12185
|
-
* Providers that support strict mode will use this setting to determine
|
|
12186
|
-
* how the input should be generated. Strict mode will always produce
|
|
12187
|
-
* valid inputs, but it might limit what input schemas are supported.
|
|
12188
|
-
*/
|
|
12189
|
-
strict?: boolean;
|
|
12190
|
-
/**
|
|
12191
|
-
* Optional function that is called when the argument streaming starts.
|
|
12192
|
-
* Only called when the tool is used in a streaming context.
|
|
12193
|
-
*/
|
|
12194
|
-
onInputStart?: (options: ToolExecutionOptions_2) => void | PromiseLike<void>;
|
|
12195
|
-
/**
|
|
12196
|
-
* Optional function that is called when an argument streaming delta is available.
|
|
12197
|
-
* Only called when the tool is used in a streaming context.
|
|
12198
|
-
*/
|
|
12199
|
-
onInputDelta?: (options: {
|
|
12200
|
-
inputTextDelta: string;
|
|
12201
|
-
} & ToolExecutionOptions_2) => void | PromiseLike<void>;
|
|
12202
|
-
/**
|
|
12203
|
-
* Optional function that is called when a tool call can be started,
|
|
12204
|
-
* even if the execute function is not provided.
|
|
12205
|
-
*/
|
|
12206
|
-
onInputAvailable?: (options: {
|
|
12207
|
-
input: [INPUT] extends [never] ? unknown : INPUT;
|
|
12208
|
-
} & ToolExecutionOptions_2) => void | PromiseLike<void>;
|
|
12209
|
-
} & ToolOutputProperties<INPUT, OUTPUT> & {
|
|
12210
|
-
/**
|
|
12211
|
-
* Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
12212
|
-
*
|
|
12213
|
-
* If not provided, the tool result will be sent as a JSON object.
|
|
12214
|
-
*/
|
|
12215
|
-
toModelOutput?: (options: {
|
|
12216
|
-
/**
|
|
12217
|
-
* The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
|
|
12218
|
-
*/
|
|
12219
|
-
toolCallId: string;
|
|
12220
|
-
/**
|
|
12221
|
-
* The input of the tool call.
|
|
12222
|
-
*/
|
|
12223
|
-
input: [INPUT] extends [never] ? unknown : INPUT;
|
|
12224
|
-
/**
|
|
12225
|
-
* The output of the tool call.
|
|
12226
|
-
*/
|
|
12227
|
-
output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>;
|
|
12228
|
-
}) => ToolResultOutput | PromiseLike<ToolResultOutput>;
|
|
12229
|
-
} & ({
|
|
12230
|
-
/**
|
|
12231
|
-
* Tool with user-defined input and output schemas.
|
|
12232
|
-
*/
|
|
12233
|
-
type?: undefined | 'function';
|
|
12234
|
-
} | {
|
|
12235
|
-
/**
|
|
12236
|
-
* Tool that is defined at runtime (e.g. an MCP tool).
|
|
12237
|
-
* The types of input and output are not known at development time.
|
|
12238
|
-
*/
|
|
12239
|
-
type: 'dynamic';
|
|
12240
|
-
} | {
|
|
12241
|
-
/**
|
|
12242
|
-
* Tool with provider-defined input and output schemas.
|
|
12243
|
-
*/
|
|
12244
|
-
type: 'provider';
|
|
12245
|
-
/**
|
|
12246
|
-
* The ID of the tool. Must follow the format `<provider-name>.<unique-tool-name>`.
|
|
12247
|
-
*/
|
|
12248
|
-
id: `${string}.${string}`;
|
|
12249
|
-
/**
|
|
12250
|
-
* The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
|
|
12251
|
-
*/
|
|
12252
|
-
args: Record<string, unknown>;
|
|
12253
|
-
/**
|
|
12254
|
-
* Whether this provider-executed tool supports deferred results.
|
|
12255
|
-
*
|
|
12256
|
-
* When true, the tool result may not be returned in the same turn as the
|
|
12257
|
-
* tool call (e.g., when using programmatic tool calling where a server tool
|
|
12258
|
-
* triggers a client-executed tool, and the server tool's result is deferred
|
|
12259
|
-
* until the client tool is resolved).
|
|
12260
|
-
*
|
|
12261
|
-
* This flag allows the AI SDK to handle tool results that arrive without
|
|
12262
|
-
* a matching tool call in the current response.
|
|
12263
|
-
*
|
|
12264
|
-
* @default false
|
|
12265
|
-
*/
|
|
12266
|
-
supportsDeferredResults?: boolean;
|
|
12267
|
-
});
|
|
12268
|
-
|
|
12269
|
-
/**
|
|
12270
|
-
* Helper function for inferring the execute args of a tool.
|
|
12271
|
-
*/
|
|
12272
|
-
declare function tool_2<INPUT, OUTPUT>(tool: Tool_2<INPUT, OUTPUT>): Tool_2<INPUT, OUTPUT>;
|
|
12273
|
-
|
|
12274
|
-
declare function tool_2<INPUT>(tool: Tool_2<INPUT, never>): Tool_2<INPUT, never>;
|
|
12275
|
-
|
|
12276
|
-
declare function tool_2<OUTPUT>(tool: Tool_2<never, OUTPUT>): Tool_2<never, OUTPUT>;
|
|
12277
|
-
|
|
12278
|
-
declare function tool_2(tool: Tool_2<never, never>): Tool_2<never, never>;
|
|
12279
|
-
|
|
12280
11400
|
/**
|
|
12281
11401
|
* Tool approval request prompt part.
|
|
12282
11402
|
*/
|
|
@@ -12292,21 +11412,6 @@ export declare type ToolApprovalRequest = {
|
|
|
12292
11412
|
toolCallId: string;
|
|
12293
11413
|
};
|
|
12294
11414
|
|
|
12295
|
-
/**
|
|
12296
|
-
* Tool approval request prompt part.
|
|
12297
|
-
*/
|
|
12298
|
-
declare type ToolApprovalRequest_2 = {
|
|
12299
|
-
type: 'tool-approval-request';
|
|
12300
|
-
/**
|
|
12301
|
-
* ID of the tool approval.
|
|
12302
|
-
*/
|
|
12303
|
-
approvalId: string;
|
|
12304
|
-
/**
|
|
12305
|
-
* ID of the tool call that the approval request is for.
|
|
12306
|
-
*/
|
|
12307
|
-
toolCallId: string;
|
|
12308
|
-
};
|
|
12309
|
-
|
|
12310
11415
|
/**
|
|
12311
11416
|
* Output part that indicates that a tool approval request has been made.
|
|
12312
11417
|
*
|
|
@@ -12348,30 +11453,6 @@ export declare type ToolApprovalResponse = {
|
|
|
12348
11453
|
providerExecuted?: boolean;
|
|
12349
11454
|
};
|
|
12350
11455
|
|
|
12351
|
-
/**
|
|
12352
|
-
* Tool approval response prompt part.
|
|
12353
|
-
*/
|
|
12354
|
-
declare type ToolApprovalResponse_2 = {
|
|
12355
|
-
type: 'tool-approval-response';
|
|
12356
|
-
/**
|
|
12357
|
-
* ID of the tool approval.
|
|
12358
|
-
*/
|
|
12359
|
-
approvalId: string;
|
|
12360
|
-
/**
|
|
12361
|
-
* Flag indicating whether the approval was granted or denied.
|
|
12362
|
-
*/
|
|
12363
|
-
approved: boolean;
|
|
12364
|
-
/**
|
|
12365
|
-
* Optional reason for the approval or denial.
|
|
12366
|
-
*/
|
|
12367
|
-
reason?: string;
|
|
12368
|
-
/**
|
|
12369
|
-
* Flag indicating whether the tool call is provider-executed.
|
|
12370
|
-
* Only provider-executed tool approval responses should be sent to the model.
|
|
12371
|
-
*/
|
|
12372
|
-
providerExecuted?: boolean;
|
|
12373
|
-
};
|
|
12374
|
-
|
|
12375
11456
|
/**
|
|
12376
11457
|
* Typed tool call that is returned by generateText and streamText.
|
|
12377
11458
|
* It contains the tool call ID, the tool name, and the tool arguments.
|
|
@@ -12400,34 +11481,6 @@ declare interface ToolCall<NAME extends string, INPUT> {
|
|
|
12400
11481
|
dynamic?: boolean;
|
|
12401
11482
|
}
|
|
12402
11483
|
|
|
12403
|
-
/**
|
|
12404
|
-
* Typed tool call that is returned by generateText and streamText.
|
|
12405
|
-
* It contains the tool call ID, the tool name, and the tool arguments.
|
|
12406
|
-
*/
|
|
12407
|
-
declare interface ToolCall_2<NAME extends string, INPUT> {
|
|
12408
|
-
/**
|
|
12409
|
-
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
12410
|
-
*/
|
|
12411
|
-
toolCallId: string;
|
|
12412
|
-
/**
|
|
12413
|
-
* Name of the tool that is being called.
|
|
12414
|
-
*/
|
|
12415
|
-
toolName: NAME;
|
|
12416
|
-
/**
|
|
12417
|
-
* Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
12418
|
-
*/
|
|
12419
|
-
input: INPUT;
|
|
12420
|
-
/**
|
|
12421
|
-
* Whether the tool call will be executed by the provider.
|
|
12422
|
-
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
12423
|
-
*/
|
|
12424
|
-
providerExecuted?: boolean;
|
|
12425
|
-
/**
|
|
12426
|
-
* Whether the tool is dynamic.
|
|
12427
|
-
*/
|
|
12428
|
-
dynamic?: boolean;
|
|
12429
|
-
}
|
|
12430
|
-
|
|
12431
11484
|
export declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
12432
11485
|
private readonly [symbol$e];
|
|
12433
11486
|
readonly toolCallId: string;
|
|
@@ -12444,44 +11497,10 @@ export declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
|
12444
11497
|
*/
|
|
12445
11498
|
export declare type ToolCallOptions = ToolExecutionOptions;
|
|
12446
11499
|
|
|
12447
|
-
/**
|
|
12448
|
-
* @deprecated Use ToolExecutionOptions instead.
|
|
12449
|
-
*/
|
|
12450
|
-
declare type ToolCallOptions_2 = ToolExecutionOptions_2;
|
|
12451
|
-
|
|
12452
11500
|
/**
|
|
12453
11501
|
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
12454
11502
|
*/
|
|
12455
11503
|
export declare interface ToolCallPart {
|
|
12456
|
-
type: 'tool-call';
|
|
12457
|
-
/**
|
|
12458
|
-
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
12459
|
-
*/
|
|
12460
|
-
toolCallId: string;
|
|
12461
|
-
/**
|
|
12462
|
-
* Name of the tool that is being called.
|
|
12463
|
-
*/
|
|
12464
|
-
toolName: string;
|
|
12465
|
-
/**
|
|
12466
|
-
* Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
12467
|
-
*/
|
|
12468
|
-
input: unknown;
|
|
12469
|
-
/**
|
|
12470
|
-
* Additional provider-specific metadata. They are passed through
|
|
12471
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
12472
|
-
* functionality that can be fully encapsulated in the provider.
|
|
12473
|
-
*/
|
|
12474
|
-
providerOptions?: ProviderOptions_2;
|
|
12475
|
-
/**
|
|
12476
|
-
* Whether the tool call was executed by the provider.
|
|
12477
|
-
*/
|
|
12478
|
-
providerExecuted?: boolean;
|
|
12479
|
-
}
|
|
12480
|
-
|
|
12481
|
-
/**
|
|
12482
|
-
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
12483
|
-
*/
|
|
12484
|
-
declare interface ToolCallPart_2 {
|
|
12485
11504
|
type: 'tool-call';
|
|
12486
11505
|
/**
|
|
12487
11506
|
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
@@ -12560,15 +11579,8 @@ export declare type ToolChoice<TOOLS extends Record<string, unknown>> = 'auto' |
|
|
|
12560
11579
|
*/
|
|
12561
11580
|
export declare type ToolContent = Array<ToolResultPart | ToolApprovalResponse>;
|
|
12562
11581
|
|
|
12563
|
-
/**
|
|
12564
|
-
* Content of a tool message. It is an array of tool result parts.
|
|
12565
|
-
*/
|
|
12566
|
-
declare type ToolContent_2 = Array<ToolResultPart_2 | ToolApprovalResponse_2>;
|
|
12567
|
-
|
|
12568
11582
|
export declare type ToolExecuteFunction<INPUT, OUTPUT> = (input: INPUT, options: ToolExecutionOptions) => AsyncIterable<OUTPUT> | PromiseLike<OUTPUT> | OUTPUT;
|
|
12569
11583
|
|
|
12570
|
-
declare type ToolExecuteFunction_2<INPUT, OUTPUT> = (input: INPUT, options: ToolExecutionOptions_2) => AsyncIterable<OUTPUT> | PromiseLike<OUTPUT> | OUTPUT;
|
|
12571
|
-
|
|
12572
11584
|
/**
|
|
12573
11585
|
* Additional options that are sent into each tool call.
|
|
12574
11586
|
*/
|
|
@@ -12601,38 +11613,6 @@ export declare interface ToolExecutionOptions {
|
|
|
12601
11613
|
experimental_context?: unknown;
|
|
12602
11614
|
}
|
|
12603
11615
|
|
|
12604
|
-
/**
|
|
12605
|
-
* Additional options that are sent into each tool call.
|
|
12606
|
-
*/
|
|
12607
|
-
declare interface ToolExecutionOptions_2 {
|
|
12608
|
-
/**
|
|
12609
|
-
* The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
|
|
12610
|
-
*/
|
|
12611
|
-
toolCallId: string;
|
|
12612
|
-
/**
|
|
12613
|
-
* Messages that were sent to the language model to initiate the response that contained the tool call.
|
|
12614
|
-
* The messages **do not** include the system prompt nor the assistant response that contained the tool call.
|
|
12615
|
-
*/
|
|
12616
|
-
messages: ModelMessage_2[];
|
|
12617
|
-
/**
|
|
12618
|
-
* An optional abort signal that indicates that the overall operation should be aborted.
|
|
12619
|
-
*/
|
|
12620
|
-
abortSignal?: AbortSignal;
|
|
12621
|
-
/**
|
|
12622
|
-
* User-defined context.
|
|
12623
|
-
*
|
|
12624
|
-
* Treat the context object as immutable inside tools.
|
|
12625
|
-
* Mutating the context object can lead to race conditions and unexpected results
|
|
12626
|
-
* when tools are called in parallel.
|
|
12627
|
-
*
|
|
12628
|
-
* If you need to mutate the context, analyze the tool calls and results
|
|
12629
|
-
* in `prepareStep` and update it there.
|
|
12630
|
-
*
|
|
12631
|
-
* Experimental (can break in patch releases).
|
|
12632
|
-
*/
|
|
12633
|
-
experimental_context?: unknown;
|
|
12634
|
-
}
|
|
12635
|
-
|
|
12636
11616
|
/**
|
|
12637
11617
|
* A tool loop agent is an agent that runs tools in a loop. In each step,
|
|
12638
11618
|
* it calls the LLM, and if there are tool calls, it executes the tools
|
|
@@ -12657,31 +11637,23 @@ declare class ToolLoopAgent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OU
|
|
|
12657
11637
|
*/
|
|
12658
11638
|
get tools(): TOOLS;
|
|
12659
11639
|
private prepareCall;
|
|
12660
|
-
private
|
|
11640
|
+
private mergeOnStepFinishCallbacks;
|
|
12661
11641
|
/**
|
|
12662
11642
|
* Generates an output from the agent (non-streaming).
|
|
12663
11643
|
*/
|
|
12664
|
-
generate({ abortSignal, timeout,
|
|
11644
|
+
generate({ abortSignal, timeout, onStepFinish, ...options }: AgentCallParameters<CALL_OPTIONS, TOOLS>): Promise<GenerateTextResult<TOOLS, OUTPUT>>;
|
|
12665
11645
|
/**
|
|
12666
11646
|
* Streams an output from the agent (streaming).
|
|
12667
11647
|
*/
|
|
12668
|
-
stream({ abortSignal, timeout, experimental_transform,
|
|
11648
|
+
stream({ abortSignal, timeout, experimental_transform, onStepFinish, ...options }: AgentStreamParameters<CALL_OPTIONS, TOOLS>): Promise<StreamTextResult<TOOLS, OUTPUT>>;
|
|
12669
11649
|
}
|
|
12670
11650
|
export { ToolLoopAgent as Experimental_Agent }
|
|
12671
11651
|
export { ToolLoopAgent }
|
|
12672
11652
|
|
|
12673
11653
|
export declare type ToolLoopAgentOnFinishCallback<TOOLS extends ToolSet = {}> = (event: OnFinishEvent<TOOLS>) => PromiseLike<void> | void;
|
|
12674
11654
|
|
|
12675
|
-
export declare type ToolLoopAgentOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output_2 = Output_2> = (event: OnStartEvent<TOOLS, OUTPUT>) => PromiseLike<void> | void;
|
|
12676
|
-
|
|
12677
11655
|
export declare type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}> = (stepResult: OnStepFinishEvent<TOOLS>) => Promise<void> | void;
|
|
12678
11656
|
|
|
12679
|
-
export declare type ToolLoopAgentOnStepStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output_2 = Output_2> = (event: OnStepStartEvent<TOOLS, OUTPUT>) => PromiseLike<void> | void;
|
|
12680
|
-
|
|
12681
|
-
export declare type ToolLoopAgentOnToolCallFinishCallback<TOOLS extends ToolSet = ToolSet> = (event: OnToolCallFinishEvent<TOOLS>) => PromiseLike<void> | void;
|
|
12682
|
-
|
|
12683
|
-
export declare type ToolLoopAgentOnToolCallStartCallback<TOOLS extends ToolSet = ToolSet> = (event: OnToolCallStartEvent<TOOLS>) => PromiseLike<void> | void;
|
|
12684
|
-
|
|
12685
11657
|
/**
|
|
12686
11658
|
* Configuration options for an agent.
|
|
12687
11659
|
*/
|
|
@@ -12736,22 +11708,6 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
12736
11708
|
* A function that attempts to repair a tool call that failed to parse.
|
|
12737
11709
|
*/
|
|
12738
11710
|
experimental_repairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>;
|
|
12739
|
-
/**
|
|
12740
|
-
* Callback that is called when the agent operation begins, before any LLM calls.
|
|
12741
|
-
*/
|
|
12742
|
-
experimental_onStart?: ToolLoopAgentOnStartCallback<NoInfer<TOOLS>, OUTPUT>;
|
|
12743
|
-
/**
|
|
12744
|
-
* Callback that is called when a step (LLM call) begins, before the provider is called.
|
|
12745
|
-
*/
|
|
12746
|
-
experimental_onStepStart?: ToolLoopAgentOnStepStartCallback<NoInfer<TOOLS>, OUTPUT>;
|
|
12747
|
-
/**
|
|
12748
|
-
* Callback that is called before each tool execution begins.
|
|
12749
|
-
*/
|
|
12750
|
-
experimental_onToolCallStart?: ToolLoopAgentOnToolCallStartCallback<NoInfer<TOOLS>>;
|
|
12751
|
-
/**
|
|
12752
|
-
* Callback that is called after each tool execution completes.
|
|
12753
|
-
*/
|
|
12754
|
-
experimental_onToolCallFinish?: ToolLoopAgentOnToolCallFinishCallback<NoInfer<TOOLS>>;
|
|
12755
11711
|
/**
|
|
12756
11712
|
* Callback that is called when each step (LLM call) is finished, including intermediate steps.
|
|
12757
11713
|
*/
|
|
@@ -12765,7 +11721,7 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
12765
11721
|
* to the provider from the AI SDK and enable provider-specific
|
|
12766
11722
|
* functionality that can be fully encapsulated in the provider.
|
|
12767
11723
|
*/
|
|
12768
|
-
providerOptions?:
|
|
11724
|
+
providerOptions?: ProviderOptions;
|
|
12769
11725
|
/**
|
|
12770
11726
|
* Context that is passed into tool calls.
|
|
12771
11727
|
*
|
|
@@ -12789,7 +11745,7 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
12789
11745
|
*
|
|
12790
11746
|
* You can use this to have templates based on call options.
|
|
12791
11747
|
*/
|
|
12792
|
-
prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) =>
|
|
11748
|
+
prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
|
|
12793
11749
|
};
|
|
12794
11750
|
export { ToolLoopAgentSettings as Experimental_AgentSettings }
|
|
12795
11751
|
export { ToolLoopAgentSettings }
|
|
@@ -12800,20 +11756,6 @@ export { ToolLoopAgentSettings }
|
|
|
12800
11756
|
export declare type ToolModelMessage = {
|
|
12801
11757
|
role: 'tool';
|
|
12802
11758
|
content: ToolContent;
|
|
12803
|
-
/**
|
|
12804
|
-
* Additional provider-specific metadata. They are passed through
|
|
12805
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
12806
|
-
* functionality that can be fully encapsulated in the provider.
|
|
12807
|
-
*/
|
|
12808
|
-
providerOptions?: ProviderOptions_2;
|
|
12809
|
-
};
|
|
12810
|
-
|
|
12811
|
-
/**
|
|
12812
|
-
* A tool message. It contains the result of one or more tool calls.
|
|
12813
|
-
*/
|
|
12814
|
-
declare type ToolModelMessage_2 = {
|
|
12815
|
-
role: 'tool';
|
|
12816
|
-
content: ToolContent_2;
|
|
12817
11759
|
/**
|
|
12818
11760
|
* Additional provider-specific metadata. They are passed through
|
|
12819
11761
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -12846,53 +11788,10 @@ declare interface ToolNameMapping {
|
|
|
12846
11788
|
toCustomToolName: (providerToolName: string) => string;
|
|
12847
11789
|
}
|
|
12848
11790
|
|
|
12849
|
-
/**
|
|
12850
|
-
* Interface for mapping between custom tool names and provider tool names.
|
|
12851
|
-
*/
|
|
12852
|
-
declare interface ToolNameMapping_2 {
|
|
12853
|
-
/**
|
|
12854
|
-
* Maps a custom tool name (used by the client) to the provider's tool name.
|
|
12855
|
-
* If the custom tool name does not have a mapping, returns the input name.
|
|
12856
|
-
*
|
|
12857
|
-
* @param customToolName - The custom name of the tool defined by the client.
|
|
12858
|
-
* @returns The corresponding provider tool name, or the input name if not mapped.
|
|
12859
|
-
*/
|
|
12860
|
-
toProviderToolName: (customToolName: string) => string;
|
|
12861
|
-
/**
|
|
12862
|
-
* Maps a provider tool name to the custom tool name used by the client.
|
|
12863
|
-
* If the provider tool name does not have a mapping, returns the input name.
|
|
12864
|
-
*
|
|
12865
|
-
* @param providerToolName - The name of the tool as understood by the provider.
|
|
12866
|
-
* @returns The corresponding custom tool name, or the input name if not mapped.
|
|
12867
|
-
*/
|
|
12868
|
-
toCustomToolName: (providerToolName: string) => string;
|
|
12869
|
-
}
|
|
12870
|
-
|
|
12871
11791
|
/**
|
|
12872
11792
|
* Function that is called to determine if the tool needs approval before it can be executed.
|
|
12873
11793
|
*/
|
|
12874
11794
|
declare type ToolNeedsApprovalFunction<INPUT> = (input: INPUT, options: {
|
|
12875
|
-
/**
|
|
12876
|
-
* The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
|
|
12877
|
-
*/
|
|
12878
|
-
toolCallId: string;
|
|
12879
|
-
/**
|
|
12880
|
-
* Messages that were sent to the language model to initiate the response that contained the tool call.
|
|
12881
|
-
* The messages **do not** include the system prompt nor the assistant response that contained the tool call.
|
|
12882
|
-
*/
|
|
12883
|
-
messages: ModelMessage_2[];
|
|
12884
|
-
/**
|
|
12885
|
-
* Additional context.
|
|
12886
|
-
*
|
|
12887
|
-
* Experimental (can break in patch releases).
|
|
12888
|
-
*/
|
|
12889
|
-
experimental_context?: unknown;
|
|
12890
|
-
}) => boolean | PromiseLike<boolean>;
|
|
12891
|
-
|
|
12892
|
-
/**
|
|
12893
|
-
* Function that is called to determine if the tool needs approval before it can be executed.
|
|
12894
|
-
*/
|
|
12895
|
-
declare type ToolNeedsApprovalFunction_2<INPUT> = (input: INPUT, options: {
|
|
12896
11795
|
/**
|
|
12897
11796
|
* The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
|
|
12898
11797
|
*/
|
|
@@ -12911,21 +11810,6 @@ declare type ToolNeedsApprovalFunction_2<INPUT> = (input: INPUT, options: {
|
|
|
12911
11810
|
}) => boolean | PromiseLike<boolean>;
|
|
12912
11811
|
|
|
12913
11812
|
declare type ToolOutputProperties<INPUT, OUTPUT> = NeverOptional<OUTPUT, {
|
|
12914
|
-
/**
|
|
12915
|
-
* An async function that is called with the arguments from the tool call and produces a result.
|
|
12916
|
-
* If not provided, the tool will not be executed automatically.
|
|
12917
|
-
*
|
|
12918
|
-
* @args is the input of the tool call.
|
|
12919
|
-
* @options.abortSignal is a signal that can be used to abort the tool call.
|
|
12920
|
-
*/
|
|
12921
|
-
execute: ToolExecuteFunction_2<INPUT, OUTPUT>;
|
|
12922
|
-
outputSchema?: FlexibleSchema_2<OUTPUT>;
|
|
12923
|
-
} | {
|
|
12924
|
-
outputSchema: FlexibleSchema_2<OUTPUT>;
|
|
12925
|
-
execute?: never;
|
|
12926
|
-
}>;
|
|
12927
|
-
|
|
12928
|
-
declare type ToolOutputProperties_2<INPUT, OUTPUT> = NeverOptional_2<OUTPUT, {
|
|
12929
11813
|
/**
|
|
12930
11814
|
* An async function that is called with the arguments from the tool call and produces a result.
|
|
12931
11815
|
* If not provided, the tool will not be executed automatically.
|
|
@@ -12971,37 +11855,6 @@ declare interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
|
12971
11855
|
dynamic?: boolean;
|
|
12972
11856
|
}
|
|
12973
11857
|
|
|
12974
|
-
/**
|
|
12975
|
-
* Typed tool result that is returned by `generateText` and `streamText`.
|
|
12976
|
-
* It contains the tool call ID, the tool name, the tool arguments, and the tool result.
|
|
12977
|
-
*/
|
|
12978
|
-
declare interface ToolResult_2<NAME extends string, INPUT, OUTPUT> {
|
|
12979
|
-
/**
|
|
12980
|
-
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
12981
|
-
*/
|
|
12982
|
-
toolCallId: string;
|
|
12983
|
-
/**
|
|
12984
|
-
* Name of the tool that was called.
|
|
12985
|
-
*/
|
|
12986
|
-
toolName: NAME;
|
|
12987
|
-
/**
|
|
12988
|
-
* Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
12989
|
-
*/
|
|
12990
|
-
input: INPUT;
|
|
12991
|
-
/**
|
|
12992
|
-
* Result of the tool call. This is the result of the tool's execution.
|
|
12993
|
-
*/
|
|
12994
|
-
output: OUTPUT;
|
|
12995
|
-
/**
|
|
12996
|
-
* Whether the tool result has been executed by the provider.
|
|
12997
|
-
*/
|
|
12998
|
-
providerExecuted?: boolean;
|
|
12999
|
-
/**
|
|
13000
|
-
* Whether the tool is dynamic.
|
|
13001
|
-
*/
|
|
13002
|
-
dynamic?: boolean;
|
|
13003
|
-
}
|
|
13004
|
-
|
|
13005
11858
|
/**
|
|
13006
11859
|
* Output of a tool result.
|
|
13007
11860
|
*/
|
|
@@ -13174,207 +12027,10 @@ declare type ToolResultOutput = {
|
|
|
13174
12027
|
}>;
|
|
13175
12028
|
};
|
|
13176
12029
|
|
|
13177
|
-
/**
|
|
13178
|
-
* Output of a tool result.
|
|
13179
|
-
*/
|
|
13180
|
-
declare type ToolResultOutput_2 = {
|
|
13181
|
-
/**
|
|
13182
|
-
* Text tool output that should be directly sent to the API.
|
|
13183
|
-
*/
|
|
13184
|
-
type: 'text';
|
|
13185
|
-
value: string;
|
|
13186
|
-
/**
|
|
13187
|
-
* Provider-specific options.
|
|
13188
|
-
*/
|
|
13189
|
-
providerOptions?: ProviderOptions_2;
|
|
13190
|
-
} | {
|
|
13191
|
-
type: 'json';
|
|
13192
|
-
value: JSONValue_2;
|
|
13193
|
-
/**
|
|
13194
|
-
* Provider-specific options.
|
|
13195
|
-
*/
|
|
13196
|
-
providerOptions?: ProviderOptions_2;
|
|
13197
|
-
} | {
|
|
13198
|
-
/**
|
|
13199
|
-
* Type when the user has denied the execution of the tool call.
|
|
13200
|
-
*/
|
|
13201
|
-
type: 'execution-denied';
|
|
13202
|
-
/**
|
|
13203
|
-
* Optional reason for the execution denial.
|
|
13204
|
-
*/
|
|
13205
|
-
reason?: string;
|
|
13206
|
-
/**
|
|
13207
|
-
* Provider-specific options.
|
|
13208
|
-
*/
|
|
13209
|
-
providerOptions?: ProviderOptions_2;
|
|
13210
|
-
} | {
|
|
13211
|
-
type: 'error-text';
|
|
13212
|
-
value: string;
|
|
13213
|
-
/**
|
|
13214
|
-
* Provider-specific options.
|
|
13215
|
-
*/
|
|
13216
|
-
providerOptions?: ProviderOptions_2;
|
|
13217
|
-
} | {
|
|
13218
|
-
type: 'error-json';
|
|
13219
|
-
value: JSONValue_2;
|
|
13220
|
-
/**
|
|
13221
|
-
* Provider-specific options.
|
|
13222
|
-
*/
|
|
13223
|
-
providerOptions?: ProviderOptions_2;
|
|
13224
|
-
} | {
|
|
13225
|
-
type: 'content';
|
|
13226
|
-
value: Array<{
|
|
13227
|
-
type: 'text';
|
|
13228
|
-
/**
|
|
13229
|
-
* Text content.
|
|
13230
|
-
*/
|
|
13231
|
-
text: string;
|
|
13232
|
-
/**
|
|
13233
|
-
* Provider-specific options.
|
|
13234
|
-
*/
|
|
13235
|
-
providerOptions?: ProviderOptions_2;
|
|
13236
|
-
} | {
|
|
13237
|
-
/**
|
|
13238
|
-
* @deprecated Use image-data or file-data instead.
|
|
13239
|
-
*/
|
|
13240
|
-
type: 'media';
|
|
13241
|
-
data: string;
|
|
13242
|
-
mediaType: string;
|
|
13243
|
-
} | {
|
|
13244
|
-
type: 'file-data';
|
|
13245
|
-
/**
|
|
13246
|
-
* Base-64 encoded media data.
|
|
13247
|
-
*/
|
|
13248
|
-
data: string;
|
|
13249
|
-
/**
|
|
13250
|
-
* IANA media type.
|
|
13251
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
13252
|
-
*/
|
|
13253
|
-
mediaType: string;
|
|
13254
|
-
/**
|
|
13255
|
-
* Optional filename of the file.
|
|
13256
|
-
*/
|
|
13257
|
-
filename?: string;
|
|
13258
|
-
/**
|
|
13259
|
-
* Provider-specific options.
|
|
13260
|
-
*/
|
|
13261
|
-
providerOptions?: ProviderOptions_2;
|
|
13262
|
-
} | {
|
|
13263
|
-
type: 'file-url';
|
|
13264
|
-
/**
|
|
13265
|
-
* URL of the file.
|
|
13266
|
-
*/
|
|
13267
|
-
url: string;
|
|
13268
|
-
/**
|
|
13269
|
-
* Provider-specific options.
|
|
13270
|
-
*/
|
|
13271
|
-
providerOptions?: ProviderOptions_2;
|
|
13272
|
-
} | {
|
|
13273
|
-
type: 'file-id';
|
|
13274
|
-
/**
|
|
13275
|
-
* ID of the file.
|
|
13276
|
-
*
|
|
13277
|
-
* If you use multiple providers, you need to
|
|
13278
|
-
* specify the provider specific ids using
|
|
13279
|
-
* the Record option. The key is the provider
|
|
13280
|
-
* name, e.g. 'openai' or 'anthropic'.
|
|
13281
|
-
*/
|
|
13282
|
-
fileId: string | Record<string, string>;
|
|
13283
|
-
/**
|
|
13284
|
-
* Provider-specific options.
|
|
13285
|
-
*/
|
|
13286
|
-
providerOptions?: ProviderOptions_2;
|
|
13287
|
-
} | {
|
|
13288
|
-
/**
|
|
13289
|
-
* Images that are referenced using base64 encoded data.
|
|
13290
|
-
*/
|
|
13291
|
-
type: 'image-data';
|
|
13292
|
-
/**
|
|
13293
|
-
* Base-64 encoded image data.
|
|
13294
|
-
*/
|
|
13295
|
-
data: string;
|
|
13296
|
-
/**
|
|
13297
|
-
* IANA media type.
|
|
13298
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
13299
|
-
*/
|
|
13300
|
-
mediaType: string;
|
|
13301
|
-
/**
|
|
13302
|
-
* Provider-specific options.
|
|
13303
|
-
*/
|
|
13304
|
-
providerOptions?: ProviderOptions_2;
|
|
13305
|
-
} | {
|
|
13306
|
-
/**
|
|
13307
|
-
* Images that are referenced using a URL.
|
|
13308
|
-
*/
|
|
13309
|
-
type: 'image-url';
|
|
13310
|
-
/**
|
|
13311
|
-
* URL of the image.
|
|
13312
|
-
*/
|
|
13313
|
-
url: string;
|
|
13314
|
-
/**
|
|
13315
|
-
* Provider-specific options.
|
|
13316
|
-
*/
|
|
13317
|
-
providerOptions?: ProviderOptions_2;
|
|
13318
|
-
} | {
|
|
13319
|
-
/**
|
|
13320
|
-
* Images that are referenced using a provider file id.
|
|
13321
|
-
*/
|
|
13322
|
-
type: 'image-file-id';
|
|
13323
|
-
/**
|
|
13324
|
-
* Image that is referenced using a provider file id.
|
|
13325
|
-
*
|
|
13326
|
-
* If you use multiple providers, you need to
|
|
13327
|
-
* specify the provider specific ids using
|
|
13328
|
-
* the Record option. The key is the provider
|
|
13329
|
-
* name, e.g. 'openai' or 'anthropic'.
|
|
13330
|
-
*/
|
|
13331
|
-
fileId: string | Record<string, string>;
|
|
13332
|
-
/**
|
|
13333
|
-
* Provider-specific options.
|
|
13334
|
-
*/
|
|
13335
|
-
providerOptions?: ProviderOptions_2;
|
|
13336
|
-
} | {
|
|
13337
|
-
/**
|
|
13338
|
-
* Custom content part. This can be used to implement
|
|
13339
|
-
* provider-specific content parts.
|
|
13340
|
-
*/
|
|
13341
|
-
type: 'custom';
|
|
13342
|
-
/**
|
|
13343
|
-
* Provider-specific options.
|
|
13344
|
-
*/
|
|
13345
|
-
providerOptions?: ProviderOptions_2;
|
|
13346
|
-
}>;
|
|
13347
|
-
};
|
|
13348
|
-
|
|
13349
12030
|
/**
|
|
13350
12031
|
* Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
13351
12032
|
*/
|
|
13352
12033
|
export declare interface ToolResultPart {
|
|
13353
|
-
type: 'tool-result';
|
|
13354
|
-
/**
|
|
13355
|
-
* ID of the tool call that this result is associated with.
|
|
13356
|
-
*/
|
|
13357
|
-
toolCallId: string;
|
|
13358
|
-
/**
|
|
13359
|
-
* Name of the tool that generated this result.
|
|
13360
|
-
*/
|
|
13361
|
-
toolName: string;
|
|
13362
|
-
/**
|
|
13363
|
-
* Result of the tool call. This is a JSON-serializable object.
|
|
13364
|
-
*/
|
|
13365
|
-
output: ToolResultOutput_2;
|
|
13366
|
-
/**
|
|
13367
|
-
* Additional provider-specific metadata. They are passed through
|
|
13368
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
13369
|
-
* functionality that can be fully encapsulated in the provider.
|
|
13370
|
-
*/
|
|
13371
|
-
providerOptions?: ProviderOptions_2;
|
|
13372
|
-
}
|
|
13373
|
-
|
|
13374
|
-
/**
|
|
13375
|
-
* Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
13376
|
-
*/
|
|
13377
|
-
declare interface ToolResultPart_2 {
|
|
13378
12034
|
type: 'tool-result';
|
|
13379
12035
|
/**
|
|
13380
12036
|
* ID of the tool call that this result is associated with.
|
|
@@ -13421,6 +12077,8 @@ export declare class TooManyEmbeddingValuesForCallError extends AISDKError {
|
|
|
13421
12077
|
|
|
13422
12078
|
/**
|
|
13423
12079
|
* Tracer provides an interface for creating {@link Span}s.
|
|
12080
|
+
*
|
|
12081
|
+
* @since 1.0.0
|
|
13424
12082
|
*/
|
|
13425
12083
|
declare interface Tracer {
|
|
13426
12084
|
/**
|
|
@@ -13487,6 +12145,9 @@ declare interface Tracer {
|
|
|
13487
12145
|
startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
|
|
13488
12146
|
}
|
|
13489
12147
|
|
|
12148
|
+
/**
|
|
12149
|
+
* @since 1.0.0
|
|
12150
|
+
*/
|
|
13490
12151
|
declare interface TraceState {
|
|
13491
12152
|
/**
|
|
13492
12153
|
* Create a new TraceState which inherits from this TraceState and has the
|
|
@@ -13997,6 +12658,7 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
13997
12658
|
toolCallId: string;
|
|
13998
12659
|
output: unknown;
|
|
13999
12660
|
providerExecuted?: boolean;
|
|
12661
|
+
providerMetadata?: ProviderMetadata;
|
|
14000
12662
|
dynamic?: boolean;
|
|
14001
12663
|
preliminary?: boolean;
|
|
14002
12664
|
} | {
|
|
@@ -14004,6 +12666,7 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
14004
12666
|
toolCallId: string;
|
|
14005
12667
|
errorText: string;
|
|
14006
12668
|
providerExecuted?: boolean;
|
|
12669
|
+
providerMetadata?: ProviderMetadata;
|
|
14007
12670
|
dynamic?: boolean;
|
|
14008
12671
|
} | {
|
|
14009
12672
|
type: 'tool-output-denied';
|
|
@@ -14058,7 +12721,7 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
14058
12721
|
messageMetadata: METADATA;
|
|
14059
12722
|
};
|
|
14060
12723
|
|
|
14061
|
-
export declare const uiMessageChunkSchema:
|
|
12724
|
+
export declare const uiMessageChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
14062
12725
|
type: "text-start";
|
|
14063
12726
|
id: string;
|
|
14064
12727
|
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
@@ -14114,6 +12777,7 @@ export declare const uiMessageChunkSchema: _ai_sdk_provider_utils_2.LazySchema<{
|
|
|
14114
12777
|
toolCallId: string;
|
|
14115
12778
|
output: unknown;
|
|
14116
12779
|
providerExecuted?: boolean | undefined;
|
|
12780
|
+
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
14117
12781
|
dynamic?: boolean | undefined;
|
|
14118
12782
|
preliminary?: boolean | undefined;
|
|
14119
12783
|
} | {
|
|
@@ -14121,6 +12785,7 @@ export declare const uiMessageChunkSchema: _ai_sdk_provider_utils_2.LazySchema<{
|
|
|
14121
12785
|
toolCallId: string;
|
|
14122
12786
|
errorText: string;
|
|
14123
12787
|
providerExecuted?: boolean | undefined;
|
|
12788
|
+
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
14124
12789
|
dynamic?: boolean | undefined;
|
|
14125
12790
|
} | {
|
|
14126
12791
|
type: "tool-output-denied";
|
|
@@ -14405,6 +13070,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14405
13070
|
output: asUITool<TOOL>['output'];
|
|
14406
13071
|
errorText?: never;
|
|
14407
13072
|
callProviderMetadata?: ProviderMetadata;
|
|
13073
|
+
resultProviderMetadata?: ProviderMetadata;
|
|
14408
13074
|
preliminary?: boolean;
|
|
14409
13075
|
approval?: {
|
|
14410
13076
|
id: string;
|
|
@@ -14418,6 +13084,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14418
13084
|
output?: never;
|
|
14419
13085
|
errorText: string;
|
|
14420
13086
|
callProviderMetadata?: ProviderMetadata;
|
|
13087
|
+
resultProviderMetadata?: ProviderMetadata;
|
|
14421
13088
|
approval?: {
|
|
14422
13089
|
id: string;
|
|
14423
13090
|
approved: true;
|
|
@@ -14439,7 +13106,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14439
13106
|
export declare type UITools = Record<string, UITool>;
|
|
14440
13107
|
|
|
14441
13108
|
export declare class UnsupportedFunctionalityError extends AISDKError {
|
|
14442
|
-
private readonly [
|
|
13109
|
+
private readonly [symbol];
|
|
14443
13110
|
readonly functionality: string;
|
|
14444
13111
|
constructor({ functionality, message, }: {
|
|
14445
13112
|
functionality: string;
|
|
@@ -14521,7 +13188,7 @@ export declare type UseCompletionOptions = {
|
|
|
14521
13188
|
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
14522
13189
|
* or to provide a custom fetch implementation for e.g. testing.
|
|
14523
13190
|
*/
|
|
14524
|
-
fetch?:
|
|
13191
|
+
fetch?: FetchFunction;
|
|
14525
13192
|
};
|
|
14526
13193
|
|
|
14527
13194
|
/**
|
|
@@ -14529,31 +13196,12 @@ export declare type UseCompletionOptions = {
|
|
|
14529
13196
|
*/
|
|
14530
13197
|
export declare type UserContent = string | Array<TextPart | ImagePart | FilePart>;
|
|
14531
13198
|
|
|
14532
|
-
/**
|
|
14533
|
-
* Content of a user message. It can be a string or an array of text and image parts.
|
|
14534
|
-
*/
|
|
14535
|
-
declare type UserContent_2 = string | Array<TextPart_2 | ImagePart_2 | FilePart_2>;
|
|
14536
|
-
|
|
14537
13199
|
/**
|
|
14538
13200
|
* A user message. It can contain text or a combination of text and images.
|
|
14539
13201
|
*/
|
|
14540
13202
|
export declare type UserModelMessage = {
|
|
14541
13203
|
role: 'user';
|
|
14542
13204
|
content: UserContent;
|
|
14543
|
-
/**
|
|
14544
|
-
* Additional provider-specific metadata. They are passed through
|
|
14545
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
14546
|
-
* functionality that can be fully encapsulated in the provider.
|
|
14547
|
-
*/
|
|
14548
|
-
providerOptions?: ProviderOptions_2;
|
|
14549
|
-
};
|
|
14550
|
-
|
|
14551
|
-
/**
|
|
14552
|
-
* A user message. It can contain text or a combination of text and images.
|
|
14553
|
-
*/
|
|
14554
|
-
declare type UserModelMessage_2 = {
|
|
14555
|
-
role: 'user';
|
|
14556
|
-
content: UserContent_2;
|
|
14557
13205
|
/**
|
|
14558
13206
|
* Additional provider-specific metadata. They are passed through
|
|
14559
13207
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -14573,15 +13221,6 @@ export declare const userModelMessageSchema: z.ZodType<UserModelMessage>;
|
|
|
14573
13221
|
*/
|
|
14574
13222
|
declare function validateDownloadUrl(url: string): void;
|
|
14575
13223
|
|
|
14576
|
-
/**
|
|
14577
|
-
* Validates that a URL is safe to download from, blocking private/internal addresses
|
|
14578
|
-
* to prevent SSRF attacks.
|
|
14579
|
-
*
|
|
14580
|
-
* @param url - The URL string to validate.
|
|
14581
|
-
* @throws DownloadError if the URL is unsafe.
|
|
14582
|
-
*/
|
|
14583
|
-
declare function validateDownloadUrl_2(url: string): void;
|
|
14584
|
-
|
|
14585
13224
|
/**
|
|
14586
13225
|
* Validates the types of an unknown object using a schema and
|
|
14587
13226
|
* return a strongly-typed object.
|
|
@@ -14593,22 +13232,6 @@ declare function validateDownloadUrl_2(url: string): void;
|
|
|
14593
13232
|
* @returns {Promise<T>} - The typed object.
|
|
14594
13233
|
*/
|
|
14595
13234
|
declare function validateTypes<OBJECT>({ value, schema, context, }: {
|
|
14596
|
-
value: unknown;
|
|
14597
|
-
schema: FlexibleSchema_2<OBJECT>;
|
|
14598
|
-
context?: TypeValidationContext;
|
|
14599
|
-
}): Promise<OBJECT>;
|
|
14600
|
-
|
|
14601
|
-
/**
|
|
14602
|
-
* Validates the types of an unknown object using a schema and
|
|
14603
|
-
* return a strongly-typed object.
|
|
14604
|
-
*
|
|
14605
|
-
* @template T - The type of the object to validate.
|
|
14606
|
-
* @param {string} options.value - The object to validate.
|
|
14607
|
-
* @param {Validator<T>} options.schema - The schema to use for validating the JSON.
|
|
14608
|
-
* @param {TypeValidationContext} options.context - Optional context about what is being validated.
|
|
14609
|
-
* @returns {Promise<T>} - The typed object.
|
|
14610
|
-
*/
|
|
14611
|
-
declare function validateTypes_2<OBJECT>({ value, schema, context, }: {
|
|
14612
13235
|
value: unknown;
|
|
14613
13236
|
schema: FlexibleSchema<OBJECT>;
|
|
14614
13237
|
context?: TypeValidationContext;
|
|
@@ -14640,14 +13263,6 @@ declare type ValidationResult<OBJECT> = {
|
|
|
14640
13263
|
error: Error;
|
|
14641
13264
|
};
|
|
14642
13265
|
|
|
14643
|
-
declare type ValidationResult_2<OBJECT> = {
|
|
14644
|
-
success: true;
|
|
14645
|
-
value: OBJECT;
|
|
14646
|
-
} | {
|
|
14647
|
-
success: false;
|
|
14648
|
-
error: Error;
|
|
14649
|
-
};
|
|
14650
|
-
|
|
14651
13266
|
/**
|
|
14652
13267
|
* Create a union of the given object's values, and optionally specify which keys to get the values from.
|
|
14653
13268
|
*
|
|
@@ -14692,8 +13307,6 @@ declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof Obje
|
|
|
14692
13307
|
|
|
14693
13308
|
declare const VERSION: string;
|
|
14694
13309
|
|
|
14695
|
-
declare const VERSION_2: string;
|
|
14696
|
-
|
|
14697
13310
|
/**
|
|
14698
13311
|
* A video model can be a string (model ID) or a Experimental_VideoModelV3 object.
|
|
14699
13312
|
*/
|
|
@@ -14947,8 +13560,6 @@ export declare type Warning = SharedV3Warning;
|
|
|
14947
13560
|
|
|
14948
13561
|
declare function withoutTrailingSlash(url: string | undefined): string | undefined;
|
|
14949
13562
|
|
|
14950
|
-
declare function withoutTrailingSlash_2(url: string | undefined): string | undefined;
|
|
14951
|
-
|
|
14952
13563
|
/**
|
|
14953
13564
|
* Appends suffix parts to the `user-agent` header.
|
|
14954
13565
|
* If a `user-agent` header already exists, the suffix parts are appended to it.
|
|
@@ -14961,18 +13572,6 @@ declare function withoutTrailingSlash_2(url: string | undefined): string | undef
|
|
|
14961
13572
|
*/
|
|
14962
13573
|
declare function withUserAgentSuffix(headers: HeadersInit | Record<string, string | undefined> | undefined, ...userAgentSuffixParts: string[]): Record<string, string>;
|
|
14963
13574
|
|
|
14964
|
-
/**
|
|
14965
|
-
* Appends suffix parts to the `user-agent` header.
|
|
14966
|
-
* If a `user-agent` header already exists, the suffix parts are appended to it.
|
|
14967
|
-
* If no `user-agent` header exists, a new one is created with the suffix parts.
|
|
14968
|
-
* Automatically removes undefined entries from the headers.
|
|
14969
|
-
*
|
|
14970
|
-
* @param headers - The original headers.
|
|
14971
|
-
* @param userAgentSuffixParts - The parts to append to the `user-agent` header.
|
|
14972
|
-
* @returns The new headers with the `user-agent` header set or updated.
|
|
14973
|
-
*/
|
|
14974
|
-
declare function withUserAgentSuffix_2(headers: HeadersInit | Record<string, string | undefined> | undefined, ...userAgentSuffixParts: string[]): Record<string, string>;
|
|
14975
|
-
|
|
14976
13575
|
/**
|
|
14977
13576
|
* Wraps an EmbeddingModelV3 instance with middleware functionality.
|
|
14978
13577
|
* This function allows you to apply middleware to transform parameters,
|
|
@@ -15060,20 +13659,6 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
|
|
|
15060
13659
|
useReferences?: boolean;
|
|
15061
13660
|
}): Schema<OBJECT>;
|
|
15062
13661
|
|
|
15063
|
-
declare type ZodSchema_2<SCHEMA = any> = z3.Schema<SCHEMA, z3.ZodTypeDef, any> | z4.core.$ZodType<SCHEMA, any>;
|
|
15064
|
-
|
|
15065
|
-
declare function zodSchema_2<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, any> | z3.Schema<OBJECT, z3.ZodTypeDef, any>, options?: {
|
|
15066
|
-
/**
|
|
15067
|
-
* Enables support for references in the schema.
|
|
15068
|
-
* This is required for recursive schemas, e.g. with `z.lazy`.
|
|
15069
|
-
* However, not all language models and providers support such references.
|
|
15070
|
-
* Defaults to `false`.
|
|
15071
|
-
*/
|
|
15072
|
-
useReferences?: boolean;
|
|
15073
|
-
}): Schema_2<OBJECT>;
|
|
15074
|
-
|
|
15075
13662
|
export { }
|
|
15076
|
-
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider,
|
|
15077
|
-
export { schemaSymbol,
|
|
15078
|
-
|
|
15079
|
-
export type ProviderOptions = NonNullable<EmbeddingModelV3CallOptions['providerOptions']>;
|
|
13663
|
+
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, LazySchema as LazySchema, ZodSchema as ZodSchema, StandardSchema as StandardSchema, ValidationResult as ValidationResult, ParseResult as ParseResult, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, ToolOutputProperties as ToolOutputProperties, SharedV3ProviderMetadata as SharedV3ProviderMetadata, ToolResultOutput as ToolResultOutput, ToolNeedsApprovalFunction as ToolNeedsApprovalFunction, TypeValidationContext as TypeValidationContext, JSONSchema7Version as JSONSchema7Version, JSONSchema7Definition as JSONSchema7Definition, JSONSchema7TypeName as JSONSchema7TypeName, JSONSchema7Type as JSONSchema7Type, EmbeddingModelV2 as EmbeddingModelV2, EmbeddingModelV3Embedding as EmbeddingModelV3Embedding, EmbeddingModelV3Middleware as EmbeddingModelV3Middleware, ImageModelV2 as ImageModelV2, ImageModelV3ProviderMetadata as ImageModelV3ProviderMetadata, ImageModelV2ProviderMetadata as ImageModelV2ProviderMetadata, ImageModelV3Middleware as ImageModelV3Middleware, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2 as LanguageModelV2, SharedV3Warning as SharedV3Warning, LanguageModelV3Middleware as LanguageModelV3Middleware, SpeechModelV2 as SpeechModelV2, TranscriptionModelV2 as TranscriptionModelV2, ImageModelV3Usage as ImageModelV3Usage, DeepPartialInternal as DeepPartialInternal, AttributeValue as AttributeValue, Tracer as Tracer, BaseToolCall as BaseToolCall, Source as Source, ResponseMessage as ResponseMessage, LanguageModelV3ToolCall as LanguageModelV3ToolCall, GenerateTextIncludeSettings as GenerateTextIncludeSettings, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, _ai_sdk_provider as _ai_sdk_provider, DataUIMessageChunk as DataUIMessageChunk, InferElementOutput as InferElementOutput, ConsumeStreamOptions as ConsumeStreamOptions, StreamTextIncludeSettings as StreamTextIncludeSettings, StreamTextOnAbortCallback as StreamTextOnAbortCallback, CallbackModelInfo as CallbackModelInfo, LanguageModelV3ToolChoice as LanguageModelV3ToolChoice, Listener as Listener, MaybePromiseLike as MaybePromiseLike, Output_2 as Output_2, InferAgentTools as InferAgentTools, UIMessageStreamResponseInit as UIMessageStreamResponseInit, getOriginalFetch as getOriginalFetch, InferUIMessageTools as InferUIMessageTools, InferUIMessageToolCall as InferUIMessageToolCall, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, Resolvable as Resolvable, FetchFunction as FetchFunction, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason as RetryErrorReason, GenerateImagePrompt as GenerateImagePrompt, JSONValue_2 as JSONValue_2, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, VideoModelResponseMetadata as VideoModelResponseMetadata, VideoModelProviderMetadata as VideoModelProviderMetadata, VideoModel as VideoModel, EmbeddingModelV3CallOptions as EmbeddingModelV3CallOptions, LanguageModelV3CallOptions as LanguageModelV3CallOptions, JSONObject as JSONObject, LanguageModelV3 as LanguageModelV3, EmbeddingModelV3 as EmbeddingModelV3, ImageModelV3 as ImageModelV3, TranscriptionModelV3 as TranscriptionModelV3, SpeechModelV3 as SpeechModelV3, RerankingModelV3 as RerankingModelV3, VideoModelV3 as VideoModelV3, ProviderV2 as ProviderV2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV3 as ProviderV3 };
|
|
13664
|
+
export { schemaSymbol, symbol$1, symbol$1_2, symbol$2, symbol$2_2, symbol$3, symbol$3_2, symbol$4, symbol$4_2, symbol$5, symbol$5_2, symbol$6, symbol$6_2, symbol$7, symbol$7_2, symbol$8, symbol$8_2, symbol$9, symbol$9_2, symbol$a, symbol$a_2, symbol$b, symbol$b_2, symbol$c, symbol$c_2, symbol$d, symbol$d_2, symbol$e, symbol$f, symbol$g, symbol$h, symbol$i, symbol$j, symbol, symbol_2, symbol_3 };
|