@mastra/schema-compat 1.2.8-alpha.0 → 1.2.8
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 +12 -0
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +1695 -109
- package/package.json +8 -8
|
@@ -387,7 +387,7 @@ declare namespace _ai_sdk_provider {
|
|
|
387
387
|
TypeValidationContext,
|
|
388
388
|
TypeValidationError,
|
|
389
389
|
UnsupportedFunctionalityError,
|
|
390
|
-
|
|
390
|
+
getErrorMessage_3 as getErrorMessage,
|
|
391
391
|
isJSONArray,
|
|
392
392
|
isJSONObject,
|
|
393
393
|
isJSONValue
|
|
@@ -398,23 +398,23 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
398
398
|
export {
|
|
399
399
|
EventSourceMessage,
|
|
400
400
|
EventSourceParserStream,
|
|
401
|
-
AssistantContent,
|
|
402
|
-
AssistantModelMessage,
|
|
401
|
+
AssistantContent_2 as AssistantContent,
|
|
402
|
+
AssistantModelMessage_2 as AssistantModelMessage,
|
|
403
403
|
DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
404
|
-
DataContent,
|
|
404
|
+
DataContent_2 as DataContent,
|
|
405
405
|
DelayedPromise,
|
|
406
|
-
DownloadError,
|
|
406
|
+
DownloadError_2 as DownloadError,
|
|
407
407
|
FetchFunction,
|
|
408
|
-
FilePart,
|
|
409
|
-
FlexibleSchema,
|
|
410
|
-
IdGenerator,
|
|
411
|
-
ImagePart,
|
|
412
|
-
InferSchema,
|
|
413
|
-
InferToolInput,
|
|
414
|
-
InferToolOutput,
|
|
408
|
+
FilePart_2 as FilePart,
|
|
409
|
+
FlexibleSchema_2 as FlexibleSchema,
|
|
410
|
+
IdGenerator_2 as IdGenerator,
|
|
411
|
+
ImagePart_2 as ImagePart,
|
|
412
|
+
InferSchema_2 as InferSchema,
|
|
413
|
+
InferToolInput_2 as InferToolInput,
|
|
414
|
+
InferToolOutput_2 as InferToolOutput,
|
|
415
415
|
LazySchema,
|
|
416
416
|
MaybePromiseLike,
|
|
417
|
-
ModelMessage,
|
|
417
|
+
ModelMessage_2 as ModelMessage,
|
|
418
418
|
ParseResult,
|
|
419
419
|
ProviderOptions,
|
|
420
420
|
ProviderToolFactory,
|
|
@@ -422,29 +422,29 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
422
422
|
ReasoningPart,
|
|
423
423
|
Resolvable,
|
|
424
424
|
ResponseHandler,
|
|
425
|
-
Schema,
|
|
426
|
-
SystemModelMessage,
|
|
427
|
-
TextPart,
|
|
428
|
-
Tool,
|
|
429
|
-
ToolApprovalRequest,
|
|
430
|
-
ToolApprovalResponse,
|
|
425
|
+
Schema_2 as Schema,
|
|
426
|
+
SystemModelMessage_2 as SystemModelMessage,
|
|
427
|
+
TextPart_2 as TextPart,
|
|
428
|
+
Tool_2 as Tool,
|
|
429
|
+
ToolApprovalRequest_2 as ToolApprovalRequest,
|
|
430
|
+
ToolApprovalResponse_2 as ToolApprovalResponse,
|
|
431
431
|
ToolCall,
|
|
432
|
-
ToolCallOptions,
|
|
433
|
-
ToolCallPart,
|
|
434
|
-
ToolContent,
|
|
435
|
-
ToolExecuteFunction,
|
|
436
|
-
ToolExecutionOptions,
|
|
437
|
-
ToolModelMessage,
|
|
432
|
+
ToolCallOptions_2 as ToolCallOptions,
|
|
433
|
+
ToolCallPart_2 as ToolCallPart,
|
|
434
|
+
ToolContent_2 as ToolContent,
|
|
435
|
+
ToolExecuteFunction_2 as ToolExecuteFunction,
|
|
436
|
+
ToolExecutionOptions_2 as ToolExecutionOptions,
|
|
437
|
+
ToolModelMessage_2 as ToolModelMessage,
|
|
438
438
|
ToolNameMapping,
|
|
439
439
|
ToolNeedsApprovalFunction,
|
|
440
440
|
ToolResult,
|
|
441
441
|
ToolResultOutput,
|
|
442
|
-
ToolResultPart,
|
|
443
|
-
UserContent,
|
|
444
|
-
UserModelMessage,
|
|
442
|
+
ToolResultPart_2 as ToolResultPart,
|
|
443
|
+
UserContent_2 as UserContent,
|
|
444
|
+
UserModelMessage_2 as UserModelMessage,
|
|
445
445
|
VERSION,
|
|
446
446
|
ValidationResult,
|
|
447
|
-
asSchema,
|
|
447
|
+
asSchema_2 as asSchema,
|
|
448
448
|
combineHeaders,
|
|
449
449
|
convertAsyncIteratorToReadableStream,
|
|
450
450
|
convertBase64ToUint8Array,
|
|
@@ -454,7 +454,7 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
454
454
|
convertUint8ArrayToBase64,
|
|
455
455
|
createBinaryResponseHandler,
|
|
456
456
|
createEventSourceResponseHandler,
|
|
457
|
-
createIdGenerator,
|
|
457
|
+
createIdGenerator_2 as createIdGenerator,
|
|
458
458
|
createJsonErrorResponseHandler,
|
|
459
459
|
createJsonResponseHandler,
|
|
460
460
|
createProviderToolFactory,
|
|
@@ -463,10 +463,10 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
463
463
|
createToolNameMapping,
|
|
464
464
|
delay,
|
|
465
465
|
downloadBlob,
|
|
466
|
-
dynamicTool,
|
|
466
|
+
dynamicTool_2 as dynamicTool,
|
|
467
467
|
executeTool,
|
|
468
468
|
extractResponseHeaders,
|
|
469
|
-
generateId,
|
|
469
|
+
generateId_2 as generateId,
|
|
470
470
|
getErrorMessage,
|
|
471
471
|
getFromApi,
|
|
472
472
|
getRuntimeEnvironmentUserAgent,
|
|
@@ -475,7 +475,7 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
475
475
|
isNonNullable,
|
|
476
476
|
isParsableJson,
|
|
477
477
|
isUrlSupported,
|
|
478
|
-
jsonSchema,
|
|
478
|
+
jsonSchema_2 as jsonSchema,
|
|
479
479
|
lazySchema,
|
|
480
480
|
loadApiKey,
|
|
481
481
|
loadOptionalSetting,
|
|
@@ -483,7 +483,7 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
483
483
|
mediaTypeToExtension,
|
|
484
484
|
normalizeHeaders,
|
|
485
485
|
parseJSON,
|
|
486
|
-
parseJsonEventStream,
|
|
486
|
+
parseJsonEventStream_2 as parseJsonEventStream,
|
|
487
487
|
parseProviderOptions,
|
|
488
488
|
postFormDataToApi,
|
|
489
489
|
postJsonToApi,
|
|
@@ -494,11 +494,123 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
494
494
|
safeParseJSON,
|
|
495
495
|
safeValidateTypes,
|
|
496
496
|
stripFileExtension,
|
|
497
|
-
tool,
|
|
497
|
+
tool_2 as tool,
|
|
498
498
|
validateDownloadUrl,
|
|
499
499
|
validateTypes,
|
|
500
500
|
withUserAgentSuffix,
|
|
501
501
|
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,
|
|
502
614
|
zodSchema,
|
|
503
615
|
StandardJSONSchemaV1,
|
|
504
616
|
StandardSchemaV1,
|
|
@@ -564,11 +676,19 @@ export declare class APICallError extends AISDKError {
|
|
|
564
676
|
|
|
565
677
|
export declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
|
|
566
678
|
|
|
679
|
+
declare function asSchema_2<OBJECT>(schema: FlexibleSchema_2<OBJECT> | undefined): Schema_2<OBJECT>;
|
|
680
|
+
|
|
567
681
|
/**
|
|
568
682
|
* Content of an assistant message.
|
|
569
683
|
* It can be a string or an array of text, image, reasoning, redacted reasoning, and tool call parts.
|
|
570
684
|
*/
|
|
571
|
-
export declare type AssistantContent = string | Array<TextPart | FilePart |
|
|
685
|
+
export declare type AssistantContent = string | Array<TextPart | FilePart | ReasoningPart_2 | ToolCallPart | ToolResultPart | ToolApprovalRequest>;
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Content of an assistant message.
|
|
689
|
+
* It can be a string or an array of text, image, reasoning, redacted reasoning, and tool call parts.
|
|
690
|
+
*/
|
|
691
|
+
declare type AssistantContent_2 = string | Array<TextPart_2 | FilePart_2 | ReasoningPart | ToolCallPart_2 | ToolResultPart_2 | ToolApprovalRequest_2>;
|
|
572
692
|
|
|
573
693
|
/**
|
|
574
694
|
* An assistant message. It can contain text, tool calls, or a combination of text and tool calls.
|
|
@@ -576,6 +696,20 @@ export declare type AssistantContent = string | Array<TextPart | FilePart | Reas
|
|
|
576
696
|
export declare type AssistantModelMessage = {
|
|
577
697
|
role: 'assistant';
|
|
578
698
|
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;
|
|
579
713
|
/**
|
|
580
714
|
* Additional provider-specific metadata. They are passed through
|
|
581
715
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -933,6 +1067,8 @@ export declare type ChunkDetector = (buffer: string) => string | undefined | nul
|
|
|
933
1067
|
|
|
934
1068
|
declare function combineHeaders(...headers: Array<Record<string, string | undefined> | undefined>): Record<string, string | undefined>;
|
|
935
1069
|
|
|
1070
|
+
declare function combineHeaders_2(...headers: Array<Record<string, string | undefined> | undefined>): Record<string, string | undefined>;
|
|
1071
|
+
|
|
936
1072
|
export declare type CompletionRequestOptions = {
|
|
937
1073
|
/**
|
|
938
1074
|
* An optional object of headers to be passed to the API endpoint.
|
|
@@ -1022,8 +1158,19 @@ declare interface Context {
|
|
|
1022
1158
|
*/
|
|
1023
1159
|
declare function convertAsyncIteratorToReadableStream<T>(iterator: AsyncIterator<T>): ReadableStream<T>;
|
|
1024
1160
|
|
|
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
|
+
|
|
1025
1170
|
declare function convertBase64ToUint8Array(base64String: string): Uint8Array<ArrayBuffer>;
|
|
1026
1171
|
|
|
1172
|
+
declare function convertBase64ToUint8Array_2(base64String: string): Uint8Array<ArrayBuffer>;
|
|
1173
|
+
|
|
1027
1174
|
export declare function convertFileListToFileUIParts(files: FileList | undefined): Promise<Array<FileUIPart>>;
|
|
1028
1175
|
|
|
1029
1176
|
/**
|
|
@@ -1035,8 +1182,19 @@ export declare function convertFileListToFileUIParts(files: FileList | undefined
|
|
|
1035
1182
|
*/
|
|
1036
1183
|
declare function convertImageModelFileToDataUri(file: ImageModelV3File): string;
|
|
1037
1184
|
|
|
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
|
+
|
|
1038
1194
|
declare function convertToBase64(value: string | Uint8Array): string;
|
|
1039
1195
|
|
|
1196
|
+
declare function convertToBase64_2(value: string | Uint8Array): string;
|
|
1197
|
+
|
|
1040
1198
|
/**
|
|
1041
1199
|
* Converts an input object to FormData for multipart/form-data requests.
|
|
1042
1200
|
*
|
|
@@ -1072,6 +1230,41 @@ declare function convertToFormData<T extends Record<string, unknown>>(input: T,
|
|
|
1072
1230
|
useArrayBrackets?: boolean;
|
|
1073
1231
|
}): FormData;
|
|
1074
1232
|
|
|
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
|
+
|
|
1075
1268
|
/**
|
|
1076
1269
|
* Converts an array of UI messages from useChat into an array of ModelMessages that can be used
|
|
1077
1270
|
* with the AI functions (e.g. `streamText`, `generateText`).
|
|
@@ -1091,6 +1284,8 @@ export declare function convertToModelMessages<UI_MESSAGE extends UIMessage>(mes
|
|
|
1091
1284
|
|
|
1092
1285
|
declare function convertUint8ArrayToBase64(array: Uint8Array): string;
|
|
1093
1286
|
|
|
1287
|
+
declare function convertUint8ArrayToBase64_2(array: Uint8Array): string;
|
|
1288
|
+
|
|
1094
1289
|
/**
|
|
1095
1290
|
* Calculates the cosine similarity between two vectors. This is a useful metric for
|
|
1096
1291
|
* comparing the similarity of two vectors such as embeddings.
|
|
@@ -1156,6 +1351,8 @@ export declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS
|
|
|
1156
1351
|
|
|
1157
1352
|
declare const createBinaryResponseHandler: () => ResponseHandler<Uint8Array>;
|
|
1158
1353
|
|
|
1354
|
+
declare const createBinaryResponseHandler_2: () => ResponseHandler_2<Uint8Array>;
|
|
1355
|
+
|
|
1159
1356
|
/**
|
|
1160
1357
|
* Creates a download function with configurable options.
|
|
1161
1358
|
*
|
|
@@ -1173,7 +1370,9 @@ export declare function createDownload(options?: {
|
|
|
1173
1370
|
mediaType: string | undefined;
|
|
1174
1371
|
}>;
|
|
1175
1372
|
|
|
1176
|
-
declare const createEventSourceResponseHandler: <T>(chunkSchema:
|
|
1373
|
+
declare const createEventSourceResponseHandler: <T>(chunkSchema: FlexibleSchema_2<T>) => ResponseHandler<ReadableStream<ParseResult<T>>>;
|
|
1374
|
+
|
|
1375
|
+
declare const createEventSourceResponseHandler_2: <T>(chunkSchema: FlexibleSchema<T>) => ResponseHandler_2<ReadableStream<ParseResult_2<T>>>;
|
|
1177
1376
|
|
|
1178
1377
|
/**
|
|
1179
1378
|
* Create a remote provider instance.
|
|
@@ -1197,13 +1396,38 @@ export declare const createIdGenerator: ({ prefix, size, alphabet, separator, }?
|
|
|
1197
1396
|
alphabet?: string;
|
|
1198
1397
|
}) => IdGenerator;
|
|
1199
1398
|
|
|
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
|
+
|
|
1200
1416
|
declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage, isRetryable, }: {
|
|
1201
|
-
errorSchema:
|
|
1417
|
+
errorSchema: FlexibleSchema_2<T>;
|
|
1202
1418
|
errorToMessage: (error: T) => string;
|
|
1203
1419
|
isRetryable?: (response: Response, error?: T) => boolean;
|
|
1204
1420
|
}) => ResponseHandler<APICallError>;
|
|
1205
1421
|
|
|
1206
|
-
declare const
|
|
1422
|
+
declare const createJsonErrorResponseHandler_2: <T>({ errorSchema, errorToMessage, isRetryable, }: {
|
|
1423
|
+
errorSchema: FlexibleSchema<T>;
|
|
1424
|
+
errorToMessage: (error: T) => string;
|
|
1425
|
+
isRetryable?: (response: Response, error?: T) => boolean;
|
|
1426
|
+
}) => ResponseHandler_2<APICallError>;
|
|
1427
|
+
|
|
1428
|
+
declare const createJsonResponseHandler: <T>(responseSchema: FlexibleSchema_2<T>) => ResponseHandler<T>;
|
|
1429
|
+
|
|
1430
|
+
declare const createJsonResponseHandler_2: <T>(responseSchema: FlexibleSchema<T>) => ResponseHandler_2<T>;
|
|
1207
1431
|
|
|
1208
1432
|
/**
|
|
1209
1433
|
* Creates a registry for the given providers with optional middleware functionality.
|
|
@@ -1226,10 +1450,32 @@ export declare function createProviderRegistry<PROVIDERS extends Record<string,
|
|
|
1226
1450
|
|
|
1227
1451
|
declare function createProviderToolFactory<INPUT, ARGS extends object>({ id, inputSchema, }: {
|
|
1228
1452
|
id: `${string}.${string}`;
|
|
1229
|
-
inputSchema:
|
|
1453
|
+
inputSchema: FlexibleSchema_2<INPUT>;
|
|
1230
1454
|
}): ProviderToolFactory<INPUT, ARGS>;
|
|
1231
1455
|
|
|
1456
|
+
declare function createProviderToolFactory_2<INPUT, ARGS extends object>({ id, inputSchema, }: {
|
|
1457
|
+
id: `${string}.${string}`;
|
|
1458
|
+
inputSchema: FlexibleSchema<INPUT>;
|
|
1459
|
+
}): ProviderToolFactory_2<INPUT, ARGS>;
|
|
1460
|
+
|
|
1232
1461
|
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, }: {
|
|
1233
1479
|
id: `${string}.${string}`;
|
|
1234
1480
|
inputSchema: FlexibleSchema<INPUT>;
|
|
1235
1481
|
outputSchema: FlexibleSchema<OUTPUT>;
|
|
@@ -1244,10 +1490,12 @@ declare function createProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS e
|
|
|
1244
1490
|
* @default false
|
|
1245
1491
|
*/
|
|
1246
1492
|
supportsDeferredResults?: boolean;
|
|
1247
|
-
}):
|
|
1493
|
+
}): ProviderToolFactoryWithOutputSchema_2<INPUT, OUTPUT, ARGS>;
|
|
1248
1494
|
|
|
1249
1495
|
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
|
|
1250
1496
|
|
|
1497
|
+
declare const createStatusCodeErrorResponseHandler_2: () => ResponseHandler_2<APICallError>;
|
|
1498
|
+
|
|
1251
1499
|
/**
|
|
1252
1500
|
* Creates a Response object from a text stream.
|
|
1253
1501
|
* Each text chunk is encoded as UTF-8 and sent as a separate chunk.
|
|
@@ -1284,6 +1532,26 @@ declare function createToolNameMapping({ tools, providerToolNames, resolveProvid
|
|
|
1284
1532
|
resolveProviderToolName?: (tool: LanguageModelV3ProviderTool) => string | undefined;
|
|
1285
1533
|
}): ToolNameMapping;
|
|
1286
1534
|
|
|
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
|
+
|
|
1287
1555
|
export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESSAGE, 'id' | 'role'> & {
|
|
1288
1556
|
id?: UI_MESSAGE['id'];
|
|
1289
1557
|
role?: UI_MESSAGE['role'];
|
|
@@ -1375,6 +1643,11 @@ export declare function customProvider<LANGUAGE_MODELS extends Record<string, La
|
|
|
1375
1643
|
*/
|
|
1376
1644
|
export declare type DataContent = string | Uint8Array | ArrayBuffer | Buffer;
|
|
1377
1645
|
|
|
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
|
+
|
|
1378
1651
|
declare type DataUIMessageChunk<DATA_TYPES extends UIDataTypes> = ValueOf<{
|
|
1379
1652
|
[NAME in keyof DATA_TYPES & string]: {
|
|
1380
1653
|
type: `data-${NAME}`;
|
|
@@ -1416,6 +1689,19 @@ declare type DeepPartialInternal<T> = T extends null | undefined | string | numb
|
|
|
1416
1689
|
*/
|
|
1417
1690
|
declare const DEFAULT_MAX_DOWNLOAD_SIZE: number;
|
|
1418
1691
|
|
|
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
|
+
|
|
1419
1705
|
export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends HttpChatTransport<UI_MESSAGE> {
|
|
1420
1706
|
constructor(options?: HttpChatTransportInitOptions<UI_MESSAGE>);
|
|
1421
1707
|
protected processResponseStream(stream: ReadableStream<Uint8Array<ArrayBufferLike>>): ReadableStream<UIMessageChunk>;
|
|
@@ -1475,6 +1761,17 @@ declare function delay(delayInMs?: number | null, options?: {
|
|
|
1475
1761
|
abortSignal?: AbortSignal;
|
|
1476
1762
|
}): Promise<void>;
|
|
1477
1763
|
|
|
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
|
+
|
|
1478
1775
|
/**
|
|
1479
1776
|
* Delayed promise. It is only constructed once the value is accessed.
|
|
1480
1777
|
* This is useful to avoid unhandled promise rejections when the promise is created
|
|
@@ -1493,6 +1790,24 @@ declare class DelayedPromise<T> {
|
|
|
1493
1790
|
isPending(): boolean;
|
|
1494
1791
|
}
|
|
1495
1792
|
|
|
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
|
+
|
|
1496
1811
|
/**
|
|
1497
1812
|
* A transport that directly communicates with an Agent in-process,
|
|
1498
1813
|
* without going through HTTP. This is useful for:
|
|
@@ -1556,8 +1871,24 @@ declare function downloadBlob(url: string, options?: {
|
|
|
1556
1871
|
abortSignal?: AbortSignal;
|
|
1557
1872
|
}): Promise<Blob>;
|
|
1558
1873
|
|
|
1559
|
-
|
|
1560
|
-
|
|
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
|
+
export declare class DownloadError extends AISDKError {
|
|
1891
|
+
private readonly [symbol_2];
|
|
1561
1892
|
readonly url: string;
|
|
1562
1893
|
readonly statusCode?: number;
|
|
1563
1894
|
readonly statusText?: string;
|
|
@@ -1571,15 +1902,66 @@ export declare class DownloadError extends AISDKError {
|
|
|
1571
1902
|
static isInstance(error: unknown): error is DownloadError;
|
|
1572
1903
|
}
|
|
1573
1904
|
|
|
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
|
+
|
|
1574
1920
|
/**
|
|
1575
1921
|
* Defines a dynamic tool.
|
|
1576
1922
|
*/
|
|
1577
1923
|
export declare function dynamicTool(tool: {
|
|
1578
1924
|
description?: string;
|
|
1579
1925
|
title?: string;
|
|
1580
|
-
providerOptions?:
|
|
1926
|
+
providerOptions?: ProviderOptions_2;
|
|
1581
1927
|
inputSchema: FlexibleSchema<unknown>;
|
|
1582
1928
|
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>;
|
|
1583
1965
|
/**
|
|
1584
1966
|
* Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
1585
1967
|
*
|
|
@@ -1603,7 +1985,7 @@ export declare function dynamicTool(tool: {
|
|
|
1603
1985
|
* Whether the tool needs approval before it can be executed.
|
|
1604
1986
|
*/
|
|
1605
1987
|
needsApproval?: boolean | ToolNeedsApprovalFunction<unknown>;
|
|
1606
|
-
}):
|
|
1988
|
+
}): Tool_2<unknown, unknown> & {
|
|
1607
1989
|
type: 'dynamic';
|
|
1608
1990
|
};
|
|
1609
1991
|
|
|
@@ -1782,7 +2164,7 @@ export declare function embed({ model: modelArg, value, providerOptions, maxRetr
|
|
|
1782
2164
|
* to the provider from the AI SDK and enable provider-specific
|
|
1783
2165
|
* functionality that can be fully encapsulated in the provider.
|
|
1784
2166
|
*/
|
|
1785
|
-
providerOptions?:
|
|
2167
|
+
providerOptions?: ProviderOptions_2;
|
|
1786
2168
|
/**
|
|
1787
2169
|
* Optional telemetry configuration (experimental).
|
|
1788
2170
|
*/
|
|
@@ -2142,7 +2524,7 @@ export declare function embedMany({ model: modelArg, values, maxParallelCalls, m
|
|
|
2142
2524
|
* to the provider from the AI SDK and enable provider-specific
|
|
2143
2525
|
* functionality that can be fully encapsulated in the provider.
|
|
2144
2526
|
*/
|
|
2145
|
-
providerOptions?:
|
|
2527
|
+
providerOptions?: ProviderOptions_2;
|
|
2146
2528
|
/**
|
|
2147
2529
|
* Maximum number of concurrent requests.
|
|
2148
2530
|
*
|
|
@@ -2323,6 +2705,18 @@ declare interface ExceptionWithName {
|
|
|
2323
2705
|
}
|
|
2324
2706
|
|
|
2325
2707
|
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, }: {
|
|
2326
2720
|
execute: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
2327
2721
|
input: INPUT;
|
|
2328
2722
|
options: ToolExecutionOptions;
|
|
@@ -2439,7 +2833,7 @@ export declare function experimental_generateSpeech({ model, text, voice, output
|
|
|
2439
2833
|
* }
|
|
2440
2834
|
* ```
|
|
2441
2835
|
*/
|
|
2442
|
-
providerOptions?:
|
|
2836
|
+
providerOptions?: ProviderOptions_2;
|
|
2443
2837
|
/**
|
|
2444
2838
|
* Maximum number of retries per speech model call. Set to 0 to disable retries.
|
|
2445
2839
|
*
|
|
@@ -2498,7 +2892,7 @@ export declare function experimental_generateVideo({ model: modelArg, prompt: pr
|
|
|
2498
2892
|
* Additional provider-specific options that are passed through to the provider
|
|
2499
2893
|
* as body parameters.
|
|
2500
2894
|
*/
|
|
2501
|
-
providerOptions?:
|
|
2895
|
+
providerOptions?: ProviderOptions_2;
|
|
2502
2896
|
/**
|
|
2503
2897
|
* Maximum number of retries per video model call. Set to 0 to disable retries.
|
|
2504
2898
|
*
|
|
@@ -2575,7 +2969,7 @@ export declare function experimental_transcribe({ model, audio, providerOptions,
|
|
|
2575
2969
|
* }
|
|
2576
2970
|
* ```
|
|
2577
2971
|
*/
|
|
2578
|
-
providerOptions?:
|
|
2972
|
+
providerOptions?: ProviderOptions_2;
|
|
2579
2973
|
/**
|
|
2580
2974
|
* Maximum number of retries per transcript model call. Set to 0 to disable retries.
|
|
2581
2975
|
*
|
|
@@ -2705,11 +3099,26 @@ declare function extractResponseHeaders(response: Response): {
|
|
|
2705
3099
|
[k: string]: string;
|
|
2706
3100
|
};
|
|
2707
3101
|
|
|
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
|
+
|
|
2708
3112
|
/**
|
|
2709
3113
|
* Fetch function type (standardizes the version of fetch used).
|
|
2710
3114
|
*/
|
|
2711
3115
|
declare type FetchFunction = typeof globalThis.fetch;
|
|
2712
3116
|
|
|
3117
|
+
/**
|
|
3118
|
+
* Fetch function type (standardizes the version of fetch used).
|
|
3119
|
+
*/
|
|
3120
|
+
declare type FetchFunction_2 = typeof globalThis.fetch;
|
|
3121
|
+
|
|
2713
3122
|
/**
|
|
2714
3123
|
* File content part of a prompt. It contains a file.
|
|
2715
3124
|
*/
|
|
@@ -2732,6 +3141,36 @@ export declare interface FilePart {
|
|
|
2732
3141
|
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
2733
3142
|
*/
|
|
2734
3143
|
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;
|
|
2735
3174
|
/**
|
|
2736
3175
|
* Additional provider-specific metadata. They are passed through
|
|
2737
3176
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -2779,7 +3218,9 @@ export declare type FileUIPart = {
|
|
|
2779
3218
|
*/
|
|
2780
3219
|
export declare type FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
|
|
2781
3220
|
|
|
2782
|
-
export declare type FlexibleSchema<SCHEMA = any> = Schema<SCHEMA> |
|
|
3221
|
+
export declare type FlexibleSchema<SCHEMA = any> = Schema<SCHEMA> | LazySchema_2<SCHEMA> | ZodSchema_2<SCHEMA> | StandardSchema_2<SCHEMA>;
|
|
3222
|
+
|
|
3223
|
+
declare type FlexibleSchema_2<SCHEMA = any> = Schema_2<SCHEMA> | LazySchema<SCHEMA> | ZodSchema<SCHEMA> | StandardSchema<SCHEMA>;
|
|
2783
3224
|
|
|
2784
3225
|
export declare const gateway: GatewayProvider;
|
|
2785
3226
|
|
|
@@ -2988,6 +3429,12 @@ export { GeneratedFile }
|
|
|
2988
3429
|
*/
|
|
2989
3430
|
export declare const generateId: IdGenerator;
|
|
2990
3431
|
|
|
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
|
+
|
|
2991
3438
|
/**
|
|
2992
3439
|
* Generates images using an image model.
|
|
2993
3440
|
*
|
|
@@ -3049,7 +3496,7 @@ export declare function generateImage({ model: modelArg, prompt: promptArg, n, m
|
|
|
3049
3496
|
* }
|
|
3050
3497
|
* ```
|
|
3051
3498
|
*/
|
|
3052
|
-
providerOptions?:
|
|
3499
|
+
providerOptions?: ProviderOptions_2;
|
|
3053
3500
|
/**
|
|
3054
3501
|
* Maximum number of retries per image model call. Set to 0 to disable retries.
|
|
3055
3502
|
*
|
|
@@ -3219,7 +3666,7 @@ export declare function generateObject<SCHEMA extends FlexibleSchema<unknown> =
|
|
|
3219
3666
|
* to the provider from the AI SDK and enable provider-specific
|
|
3220
3667
|
* functionality that can be fully encapsulated in the provider.
|
|
3221
3668
|
*/
|
|
3222
|
-
providerOptions?:
|
|
3669
|
+
providerOptions?: ProviderOptions_2;
|
|
3223
3670
|
/**
|
|
3224
3671
|
* Internal. For test use only. May change without notice.
|
|
3225
3672
|
*/
|
|
@@ -3363,7 +3810,7 @@ export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Outpu
|
|
|
3363
3810
|
* to the provider from the AI SDK and enable provider-specific
|
|
3364
3811
|
* functionality that can be fully encapsulated in the provider.
|
|
3365
3812
|
*/
|
|
3366
|
-
providerOptions?:
|
|
3813
|
+
providerOptions?: ProviderOptions_2;
|
|
3367
3814
|
/**
|
|
3368
3815
|
* @deprecated Use `activeTools` instead.
|
|
3369
3816
|
*/
|
|
@@ -3698,6 +4145,8 @@ declare function getErrorMessage(error: unknown | undefined): string;
|
|
|
3698
4145
|
|
|
3699
4146
|
declare function getErrorMessage_2(error: unknown | undefined): string;
|
|
3700
4147
|
|
|
4148
|
+
declare function getErrorMessage_3(error: unknown | undefined): string;
|
|
4149
|
+
|
|
3701
4150
|
declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
3702
4151
|
url: string;
|
|
3703
4152
|
headers?: Record<string, string | undefined>;
|
|
@@ -3711,6 +4160,19 @@ declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedR
|
|
|
3711
4160
|
responseHeaders?: Record<string, string>;
|
|
3712
4161
|
}>;
|
|
3713
4162
|
|
|
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
|
+
|
|
3714
4176
|
declare type GetMaxImagesPerCallFunction$1 = (options: {
|
|
3715
4177
|
modelId: string;
|
|
3716
4178
|
}) => PromiseLike<number | undefined> | number | undefined;
|
|
@@ -3727,6 +4189,8 @@ declare const getOriginalFetch: () => typeof fetch;
|
|
|
3727
4189
|
|
|
3728
4190
|
declare function getRuntimeEnvironmentUserAgent(globalThisAny?: any): string;
|
|
3729
4191
|
|
|
4192
|
+
declare function getRuntimeEnvironmentUserAgent_2(globalThisAny?: any): string;
|
|
4193
|
+
|
|
3730
4194
|
/**
|
|
3731
4195
|
* Returns the name of the static tool.
|
|
3732
4196
|
*
|
|
@@ -3781,7 +4245,7 @@ export declare abstract class HttpChatTransport<UI_MESSAGE extends UIMessage> im
|
|
|
3781
4245
|
protected credentials: HttpChatTransportInitOptions<UI_MESSAGE>['credentials'];
|
|
3782
4246
|
protected headers: HttpChatTransportInitOptions<UI_MESSAGE>['headers'];
|
|
3783
4247
|
protected body: HttpChatTransportInitOptions<UI_MESSAGE>['body'];
|
|
3784
|
-
protected fetch?:
|
|
4248
|
+
protected fetch?: FetchFunction_2;
|
|
3785
4249
|
protected prepareSendMessagesRequest?: PrepareSendMessagesRequest<UI_MESSAGE>;
|
|
3786
4250
|
protected prepareReconnectToStreamRequest?: PrepareReconnectToStreamRequest;
|
|
3787
4251
|
constructor({ api, credentials, headers, body, fetch, prepareSendMessagesRequest, prepareReconnectToStreamRequest, }: HttpChatTransportInitOptions<UI_MESSAGE>);
|
|
@@ -3806,11 +4270,11 @@ export declare type HttpChatTransportInitOptions<UI_MESSAGE extends UIMessage> =
|
|
|
3806
4270
|
* Possible values are: 'omit', 'same-origin', 'include'.
|
|
3807
4271
|
* Defaults to 'same-origin'.
|
|
3808
4272
|
*/
|
|
3809
|
-
credentials?:
|
|
4273
|
+
credentials?: Resolvable_2<RequestCredentials>;
|
|
3810
4274
|
/**
|
|
3811
4275
|
* HTTP headers to be sent with the API request.
|
|
3812
4276
|
*/
|
|
3813
|
-
headers?:
|
|
4277
|
+
headers?: Resolvable_2<Record<string, string> | Headers>;
|
|
3814
4278
|
/**
|
|
3815
4279
|
* Extra body object to be sent with the API request.
|
|
3816
4280
|
* @example
|
|
@@ -3823,12 +4287,12 @@ export declare type HttpChatTransportInitOptions<UI_MESSAGE extends UIMessage> =
|
|
|
3823
4287
|
* })
|
|
3824
4288
|
* ```
|
|
3825
4289
|
*/
|
|
3826
|
-
body?:
|
|
4290
|
+
body?: Resolvable_2<object>;
|
|
3827
4291
|
/**
|
|
3828
4292
|
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
3829
4293
|
* or to provide a custom fetch implementation for e.g. testing.
|
|
3830
4294
|
*/
|
|
3831
|
-
fetch?:
|
|
4295
|
+
fetch?: FetchFunction_2;
|
|
3832
4296
|
/**
|
|
3833
4297
|
* When a function is provided, it will be used
|
|
3834
4298
|
* to prepare the request body for the chat API. This can be useful for
|
|
@@ -3848,6 +4312,11 @@ export declare type HttpChatTransportInitOptions<UI_MESSAGE extends UIMessage> =
|
|
|
3848
4312
|
*/
|
|
3849
4313
|
export declare type IdGenerator = () => string;
|
|
3850
4314
|
|
|
4315
|
+
/**
|
|
4316
|
+
* A function that generates an ID.
|
|
4317
|
+
*/
|
|
4318
|
+
declare type IdGenerator_2 = () => string;
|
|
4319
|
+
|
|
3851
4320
|
/**
|
|
3852
4321
|
* Image model that is used by the AI SDK.
|
|
3853
4322
|
*/
|
|
@@ -4312,6 +4781,32 @@ export declare interface ImagePart {
|
|
|
4312
4781
|
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4313
4782
|
*/
|
|
4314
4783
|
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;
|
|
4315
4810
|
/**
|
|
4316
4811
|
* Additional provider-specific metadata. They are passed through
|
|
4317
4812
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -4342,7 +4837,9 @@ declare type InferElementOutput<OUTPUT extends Output_2> = OUTPUT extends Output
|
|
|
4342
4837
|
*/
|
|
4343
4838
|
export declare type InferGenerateOutput<OUTPUT extends Output_2> = OUTPUT extends Output_2<infer COMPLETE_OUTPUT, any, any> ? COMPLETE_OUTPUT : never;
|
|
4344
4839
|
|
|
4345
|
-
export declare type InferSchema<SCHEMA> = SCHEMA extends
|
|
4840
|
+
export declare type InferSchema<SCHEMA> = SCHEMA extends ZodSchema_2<infer T> ? T : SCHEMA extends StandardSchema_2<infer T> ? T : SCHEMA extends LazySchema_2<infer T> ? T : SCHEMA extends Schema<infer T> ? T : never;
|
|
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;
|
|
4346
4843
|
|
|
4347
4844
|
/**
|
|
4348
4845
|
* Infers the partial output type from the output specification.
|
|
@@ -4354,11 +4851,21 @@ export declare type InferStreamOutput<OUTPUT extends Output_2> = OUTPUT extends
|
|
|
4354
4851
|
*/
|
|
4355
4852
|
export declare type InferToolInput<TOOL extends Tool> = TOOL extends Tool<infer INPUT, any> ? INPUT : never;
|
|
4356
4853
|
|
|
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
|
+
|
|
4357
4859
|
/**
|
|
4358
4860
|
* Infer the output type of a tool.
|
|
4359
4861
|
*/
|
|
4360
4862
|
export declare type InferToolOutput<TOOL extends Tool> = TOOL extends Tool<any, infer OUTPUT> ? OUTPUT : never;
|
|
4361
4863
|
|
|
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
|
+
|
|
4362
4869
|
export declare type InferUIDataParts<T extends UIDataPartSchemas> = {
|
|
4363
4870
|
[K in keyof T]: InferSchema<T[K]>;
|
|
4364
4871
|
};
|
|
@@ -4370,12 +4877,12 @@ declare type InferUIMessageData<T extends UIMessage> = T extends UIMessage<unkno
|
|
|
4370
4877
|
declare type InferUIMessageMetadata<T extends UIMessage> = T extends UIMessage<infer METADATA> ? METADATA : unknown;
|
|
4371
4878
|
|
|
4372
4879
|
declare type InferUIMessageToolCall<UI_MESSAGE extends UIMessage> = ValueOf<{
|
|
4373
|
-
[NAME in keyof InferUIMessageTools<UI_MESSAGE>]:
|
|
4880
|
+
[NAME in keyof InferUIMessageTools<UI_MESSAGE>]: ToolCall_2<NAME & string, InferUIMessageTools<UI_MESSAGE>[NAME] extends {
|
|
4374
4881
|
input: infer INPUT;
|
|
4375
4882
|
} ? INPUT : never> & {
|
|
4376
4883
|
dynamic?: false;
|
|
4377
4884
|
};
|
|
4378
|
-
}> | (
|
|
4885
|
+
}> | (ToolCall_2<string, unknown> & {
|
|
4379
4886
|
dynamic: true;
|
|
4380
4887
|
});
|
|
4381
4888
|
|
|
@@ -4403,6 +4910,13 @@ declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPre
|
|
|
4403
4910
|
schemaSuffix?: string;
|
|
4404
4911
|
}): LanguageModelV3Prompt;
|
|
4405
4912
|
|
|
4913
|
+
declare function injectJsonInstructionIntoMessages_2({ messages, schema, schemaPrefix, schemaSuffix, }: {
|
|
4914
|
+
messages: LanguageModelV3Prompt;
|
|
4915
|
+
schema?: JSONSchema7;
|
|
4916
|
+
schemaPrefix?: string;
|
|
4917
|
+
schemaSuffix?: string;
|
|
4918
|
+
}): LanguageModelV3Prompt;
|
|
4919
|
+
|
|
4406
4920
|
export declare class InvalidArgumentError extends AISDKError {
|
|
4407
4921
|
private readonly [symbol$h];
|
|
4408
4922
|
readonly parameter: string;
|
|
@@ -4513,6 +5027,8 @@ export declare class InvalidToolInputError extends AISDKError {
|
|
|
4513
5027
|
|
|
4514
5028
|
declare function isAbortError(error: unknown): error is Error;
|
|
4515
5029
|
|
|
5030
|
+
declare function isAbortError_2(error: unknown): error is Error;
|
|
5031
|
+
|
|
4516
5032
|
/**
|
|
4517
5033
|
* Check if a message part is a data part.
|
|
4518
5034
|
*/
|
|
@@ -4547,8 +5063,19 @@ declare function isJSONValue(value: unknown): value is JSONValue_2;
|
|
|
4547
5063
|
*/
|
|
4548
5064
|
declare function isNonNullable<T>(value: T | undefined | null): value is NonNullable<T>;
|
|
4549
5065
|
|
|
5066
|
+
/**
|
|
5067
|
+
* Type guard that checks whether a value is not `null` or `undefined`.
|
|
5068
|
+
*
|
|
5069
|
+
* @template T - The type of the value to check.
|
|
5070
|
+
* @param value - The value to check.
|
|
5071
|
+
* @returns `true` if the value is neither `null` nor `undefined`, otherwise `false`.
|
|
5072
|
+
*/
|
|
5073
|
+
declare function isNonNullable_2<T>(value: T | undefined | null): value is NonNullable<T>;
|
|
5074
|
+
|
|
4550
5075
|
declare function isParsableJson(input: string): boolean;
|
|
4551
5076
|
|
|
5077
|
+
declare function isParsableJson_2(input: string): boolean;
|
|
5078
|
+
|
|
4552
5079
|
/**
|
|
4553
5080
|
* Type guard to check if a message part is a reasoning part.
|
|
4554
5081
|
*/
|
|
@@ -4597,6 +5124,23 @@ declare function isUrlSupported({ mediaType, url, supportedUrls, }: {
|
|
|
4597
5124
|
supportedUrls: Record<string, RegExp[]>;
|
|
4598
5125
|
}): boolean;
|
|
4599
5126
|
|
|
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
|
+
|
|
4600
5144
|
declare type Job = () => Promise<void>;
|
|
4601
5145
|
|
|
4602
5146
|
declare type JSONArray = JSONValue_2[];
|
|
@@ -4622,7 +5166,7 @@ export declare class JSONParseError extends AISDKError {
|
|
|
4622
5166
|
* @param options.validate Optional. A validation function for the schema.
|
|
4623
5167
|
*/
|
|
4624
5168
|
export declare function jsonSchema<OBJECT = unknown>(jsonSchema: JSONSchema7 | PromiseLike<JSONSchema7> | (() => JSONSchema7 | PromiseLike<JSONSchema7>), { validate, }?: {
|
|
4625
|
-
validate?: (value: unknown) =>
|
|
5169
|
+
validate?: (value: unknown) => ValidationResult_2<OBJECT> | PromiseLike<ValidationResult_2<OBJECT>>;
|
|
4626
5170
|
}): Schema<OBJECT>;
|
|
4627
5171
|
|
|
4628
5172
|
export declare interface JSONSchema7 {
|
|
@@ -4784,6 +5328,16 @@ declare type JSONSchema7TypeName =
|
|
|
4784
5328
|
*/
|
|
4785
5329
|
declare type JSONSchema7Version = string;
|
|
4786
5330
|
|
|
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
|
+
|
|
4787
5341
|
/**
|
|
4788
5342
|
* A TransformStream that converts JSON objects to Server-Sent Events (SSE) format.
|
|
4789
5343
|
* Each object is serialized to JSON and wrapped in `data: ...\n\n` format.
|
|
@@ -6853,7 +7407,19 @@ export declare function lastAssistantMessageIsCompleteWithToolCalls({ messages,
|
|
|
6853
7407
|
messages: UIMessage[];
|
|
6854
7408
|
}): boolean;
|
|
6855
7409
|
|
|
6856
|
-
declare type LazySchema<SCHEMA> = () =>
|
|
7410
|
+
declare type LazySchema<SCHEMA> = () => Schema_2<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>;
|
|
6857
7423
|
|
|
6858
7424
|
/**
|
|
6859
7425
|
* Creates a schema with deferred creation.
|
|
@@ -6863,7 +7429,7 @@ declare type LazySchema<SCHEMA> = () => Schema<SCHEMA>;
|
|
|
6863
7429
|
* @param createValidator A function that creates a schema.
|
|
6864
7430
|
* @returns A function that returns a schema.
|
|
6865
7431
|
*/
|
|
6866
|
-
declare function
|
|
7432
|
+
declare function lazySchema_2<SCHEMA>(createSchema: () => Schema<SCHEMA>): LazySchema_2<SCHEMA>;
|
|
6867
7433
|
|
|
6868
7434
|
/**
|
|
6869
7435
|
* A pointer from the current {@link Span} to another span in the same trace or
|
|
@@ -6901,6 +7467,13 @@ declare function loadApiKey({ apiKey, environmentVariableName, apiKeyParameterNa
|
|
|
6901
7467
|
description: string;
|
|
6902
7468
|
}): string;
|
|
6903
7469
|
|
|
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
|
+
|
|
6904
7477
|
export declare class LoadAPIKeyError extends AISDKError {
|
|
6905
7478
|
private readonly [symbol$6];
|
|
6906
7479
|
constructor({ message }: {
|
|
@@ -6921,6 +7494,18 @@ declare function loadOptionalSetting({ settingValue, environmentVariableName, }:
|
|
|
6921
7494
|
environmentVariableName: string;
|
|
6922
7495
|
}): string | undefined;
|
|
6923
7496
|
|
|
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
|
+
|
|
6924
7509
|
/**
|
|
6925
7510
|
* Loads a `string` setting from the environment or a parameter.
|
|
6926
7511
|
*
|
|
@@ -6937,21 +7522,37 @@ declare function loadSetting({ settingValue, environmentVariableName, settingNam
|
|
|
6937
7522
|
description: string;
|
|
6938
7523
|
}): string;
|
|
6939
7524
|
|
|
6940
|
-
export declare class LoadSettingError extends AISDKError {
|
|
6941
|
-
private readonly [symbol$5];
|
|
6942
|
-
constructor({ message }: {
|
|
6943
|
-
message: string;
|
|
6944
|
-
});
|
|
6945
|
-
static isInstance(error: unknown): error is LoadSettingError;
|
|
6946
|
-
}
|
|
6947
|
-
|
|
6948
7525
|
/**
|
|
6949
|
-
*
|
|
6950
|
-
*
|
|
6951
|
-
* You can assign it to the `AI_SDK_LOG_WARNINGS` global variable to use it as the default warning logger.
|
|
7526
|
+
* Loads a `string` setting from the environment or a parameter.
|
|
6952
7527
|
*
|
|
6953
|
-
* @
|
|
6954
|
-
*
|
|
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
|
+
export declare class LoadSettingError extends AISDKError {
|
|
7542
|
+
private readonly [symbol$5];
|
|
7543
|
+
constructor({ message }: {
|
|
7544
|
+
message: string;
|
|
7545
|
+
});
|
|
7546
|
+
static isInstance(error: unknown): error is LoadSettingError;
|
|
7547
|
+
}
|
|
7548
|
+
|
|
7549
|
+
/**
|
|
7550
|
+
* A function for logging warnings.
|
|
7551
|
+
*
|
|
7552
|
+
* You can assign it to the `AI_SDK_LOG_WARNINGS` global variable to use it as the default warning logger.
|
|
7553
|
+
*
|
|
7554
|
+
* @example
|
|
7555
|
+
* ```ts
|
|
6955
7556
|
* globalThis.AI_SDK_LOG_WARNINGS = (options) => {
|
|
6956
7557
|
* console.log('WARNINGS:', options.warnings, options.provider, options.model);
|
|
6957
7558
|
* };
|
|
@@ -6976,6 +7577,8 @@ export { LogWarningsFunction }
|
|
|
6976
7577
|
|
|
6977
7578
|
declare type MaybePromiseLike<T> = T | PromiseLike<T>;
|
|
6978
7579
|
|
|
7580
|
+
declare type MaybePromiseLike_2<T> = T | PromiseLike<T>;
|
|
7581
|
+
|
|
6979
7582
|
/**
|
|
6980
7583
|
* Maps a media type to its corresponding file extension.
|
|
6981
7584
|
* It was originally introduced to set a filename for audio file uploads
|
|
@@ -6987,6 +7590,17 @@ declare type MaybePromiseLike<T> = T | PromiseLike<T>;
|
|
|
6987
7590
|
*/
|
|
6988
7591
|
declare function mediaTypeToExtension(mediaType: string): string;
|
|
6989
7592
|
|
|
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
|
+
|
|
6990
7604
|
export declare class MessageConversionError extends AISDKError {
|
|
6991
7605
|
private readonly [symbol$2_2];
|
|
6992
7606
|
readonly originalMessage: Omit<UIMessage, 'id'>;
|
|
@@ -7012,10 +7626,18 @@ export declare class MissingToolResultsError extends AISDKError {
|
|
|
7012
7626
|
*/
|
|
7013
7627
|
export declare type ModelMessage = SystemModelMessage | UserModelMessage | AssistantModelMessage | ToolModelMessage;
|
|
7014
7628
|
|
|
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
|
+
|
|
7015
7635
|
export declare const modelMessageSchema: z.ZodType<ModelMessage>;
|
|
7016
7636
|
|
|
7017
7637
|
declare type NeverOptional<N, T> = 0 extends 1 & N ? Partial<T> : [N] extends [never] ? Partial<Record<keyof T, undefined>> : T;
|
|
7018
7638
|
|
|
7639
|
+
declare type NeverOptional_2<N, T> = 0 extends 1 & N ? Partial<T> : [N] extends [never] ? Partial<Record<keyof T, undefined>> : T;
|
|
7640
|
+
|
|
7019
7641
|
/**
|
|
7020
7642
|
* Thrown when the AI provider fails to generate any content.
|
|
7021
7643
|
*/
|
|
@@ -7108,6 +7730,15 @@ export declare class NoOutputGeneratedError extends AISDKError {
|
|
|
7108
7730
|
*/
|
|
7109
7731
|
declare function normalizeHeaders(headers: HeadersInit | Record<string, string | undefined> | Array<[string, string | undefined]> | undefined): Record<string, string>;
|
|
7110
7732
|
|
|
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
|
+
|
|
7111
7742
|
/**
|
|
7112
7743
|
* Error that is thrown when no speech audio was generated.
|
|
7113
7744
|
*/
|
|
@@ -7134,7 +7765,7 @@ export declare class NoSuchModelError extends AISDKError {
|
|
|
7134
7765
|
}
|
|
7135
7766
|
|
|
7136
7767
|
export declare class NoSuchProviderError extends NoSuchModelError {
|
|
7137
|
-
private readonly [
|
|
7768
|
+
private readonly [symbol_4];
|
|
7138
7769
|
readonly providerId: string;
|
|
7139
7770
|
readonly availableProviders: string[];
|
|
7140
7771
|
constructor({ modelId, modelType, providerId, availableProviders, message, }: {
|
|
@@ -7287,7 +7918,7 @@ export declare interface OnStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT ex
|
|
|
7287
7918
|
/** Additional HTTP headers sent with the request. */
|
|
7288
7919
|
readonly headers: Record<string, string | undefined> | undefined;
|
|
7289
7920
|
/** Additional provider-specific options. */
|
|
7290
|
-
readonly providerOptions:
|
|
7921
|
+
readonly providerOptions: ProviderOptions_2 | undefined;
|
|
7291
7922
|
/**
|
|
7292
7923
|
* Condition(s) for stopping the generation.
|
|
7293
7924
|
* When the condition is an array, any of the conditions can be met to stop.
|
|
@@ -7353,7 +7984,7 @@ export declare interface OnStepStartEvent<TOOLS extends ToolSet = ToolSet, OUTPU
|
|
|
7353
7984
|
/** Array of results from previous steps (empty for first step). */
|
|
7354
7985
|
readonly steps: ReadonlyArray<StepResult<TOOLS>>;
|
|
7355
7986
|
/** Additional provider-specific options for this step. */
|
|
7356
|
-
readonly providerOptions:
|
|
7987
|
+
readonly providerOptions: ProviderOptions_2 | undefined;
|
|
7357
7988
|
/**
|
|
7358
7989
|
* Timeout configuration for the generation.
|
|
7359
7990
|
* Can be a number (milliseconds) or an object with totalMs, stepMs, chunkMs.
|
|
@@ -7653,6 +8284,30 @@ declare function parseJSON(options: {
|
|
|
7653
8284
|
* @returns {Promise<T>} - The parsed object.
|
|
7654
8285
|
*/
|
|
7655
8286
|
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: {
|
|
7656
8311
|
text: string;
|
|
7657
8312
|
schema: FlexibleSchema<T>;
|
|
7658
8313
|
}): Promise<T>;
|
|
@@ -7663,6 +8318,14 @@ declare function parseJSON<T>(options: {
|
|
|
7663
8318
|
export declare function parseJsonEventStream<T>({ stream, schema, }: {
|
|
7664
8319
|
stream: ReadableStream<Uint8Array>;
|
|
7665
8320
|
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>;
|
|
7666
8329
|
}): ReadableStream<ParseResult<T>>;
|
|
7667
8330
|
|
|
7668
8331
|
export declare function parsePartialJson(jsonText: string | undefined): Promise<{
|
|
@@ -7671,6 +8334,12 @@ export declare function parsePartialJson(jsonText: string | undefined): Promise<
|
|
|
7671
8334
|
}>;
|
|
7672
8335
|
|
|
7673
8336
|
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, }: {
|
|
7674
8343
|
provider: string;
|
|
7675
8344
|
providerOptions: Record<string, unknown> | undefined;
|
|
7676
8345
|
schema: FlexibleSchema<OPTIONS>;
|
|
@@ -7686,6 +8355,16 @@ declare type ParseResult<T> = {
|
|
|
7686
8355
|
rawValue: unknown;
|
|
7687
8356
|
};
|
|
7688
8357
|
|
|
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
|
+
|
|
7689
8368
|
declare type PartialMap<KeyType, ValueType> = {} & Map<DeepPartialInternal<KeyType>, DeepPartialInternal<ValueType>>;
|
|
7690
8369
|
|
|
7691
8370
|
declare type PartialObject<ObjectType extends object> = {
|
|
@@ -7906,6 +8585,20 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
|
|
|
7906
8585
|
responseHeaders?: Record<string, string>;
|
|
7907
8586
|
}>;
|
|
7908
8587
|
|
|
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
|
+
|
|
7909
8602
|
declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
|
|
7910
8603
|
url: string;
|
|
7911
8604
|
headers?: Record<string, string | undefined>;
|
|
@@ -7920,6 +8613,20 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
|
|
|
7920
8613
|
responseHeaders?: Record<string, string>;
|
|
7921
8614
|
}>;
|
|
7922
8615
|
|
|
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
|
+
|
|
7923
8630
|
declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
7924
8631
|
url: string;
|
|
7925
8632
|
headers?: Record<string, string | undefined>;
|
|
@@ -7937,6 +8644,23 @@ declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, fa
|
|
|
7937
8644
|
responseHeaders?: Record<string, string>;
|
|
7938
8645
|
}>;
|
|
7939
8646
|
|
|
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
|
+
|
|
7940
8664
|
export declare type PrepareReconnectToStreamRequest = (options: {
|
|
7941
8665
|
id: string;
|
|
7942
8666
|
requestMetadata: unknown;
|
|
@@ -8053,7 +8777,7 @@ export declare type PrepareStepResult<TOOLS extends Record<string, Tool> = Recor
|
|
|
8053
8777
|
* Can be used to pass provider-specific configuration such as
|
|
8054
8778
|
* container IDs for Anthropic's code execution.
|
|
8055
8779
|
*/
|
|
8056
|
-
providerOptions?:
|
|
8780
|
+
providerOptions?: ProviderOptions_2;
|
|
8057
8781
|
} | undefined;
|
|
8058
8782
|
|
|
8059
8783
|
/**
|
|
@@ -8147,15 +8871,14 @@ export declare type Provider = {
|
|
|
8147
8871
|
* This is needed to enable provider-specific functionality that can be
|
|
8148
8872
|
* fully encapsulated in the provider.
|
|
8149
8873
|
*/
|
|
8150
|
-
export declare type ProviderMetadata = SharedV3ProviderMetadata;
|
|
8151
|
-
|
|
8874
|
+
export declare type ProviderMetadata = SharedV3ProviderMetadata;
|
|
8152
8875
|
/**
|
|
8153
8876
|
* Additional provider-specific options.
|
|
8154
8877
|
*
|
|
8155
8878
|
* They are passed through to the provider from the AI SDK and enable
|
|
8156
8879
|
* provider-specific functionality that can be fully encapsulated in the provider.
|
|
8157
8880
|
*/
|
|
8158
|
-
declare type
|
|
8881
|
+
declare type ProviderOptions_2 = SharedV3ProviderOptions;
|
|
8159
8882
|
|
|
8160
8883
|
export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV3> = Record<string, ProviderV3>, SEPARATOR extends string = ':'> {
|
|
8161
8884
|
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV3;
|
|
@@ -8173,6 +8896,15 @@ export declare interface ProviderRegistryProvider<PROVIDERS extends Record<strin
|
|
|
8173
8896
|
}
|
|
8174
8897
|
|
|
8175
8898
|
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 & {
|
|
8176
8908
|
execute?: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
8177
8909
|
needsApproval?: Tool<INPUT, OUTPUT>['needsApproval'];
|
|
8178
8910
|
toModelOutput?: Tool<INPUT, OUTPUT>['toModelOutput'];
|
|
@@ -8182,6 +8914,15 @@ declare type ProviderToolFactory<INPUT, ARGS extends object> = <OUTPUT>(options:
|
|
|
8182
8914
|
}) => Tool<INPUT, OUTPUT>;
|
|
8183
8915
|
|
|
8184
8916
|
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 & {
|
|
8185
8926
|
execute?: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
8186
8927
|
needsApproval?: Tool<INPUT, OUTPUT>['needsApproval'];
|
|
8187
8928
|
toModelOutput?: Tool<INPUT, OUTPUT>['toModelOutput'];
|
|
@@ -8364,6 +9105,25 @@ declare function readResponseWithSizeLimit({ response, url, maxBytes, }: {
|
|
|
8364
9105
|
maxBytes?: number;
|
|
8365
9106
|
}): Promise<Uint8Array>;
|
|
8366
9107
|
|
|
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
|
+
|
|
8367
9127
|
/**
|
|
8368
9128
|
* Transforms a stream of `UIMessageChunk`s into an `AsyncIterableStream` of `UIMessage`s.
|
|
8369
9129
|
*
|
|
@@ -8416,6 +9176,23 @@ declare interface ReasoningPart {
|
|
|
8416
9176
|
providerOptions?: ProviderOptions;
|
|
8417
9177
|
}
|
|
8418
9178
|
|
|
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
|
+
|
|
8419
9196
|
/**
|
|
8420
9197
|
* A reasoning part of a message.
|
|
8421
9198
|
*/
|
|
@@ -8447,6 +9224,13 @@ export declare function registerTelemetryIntegration(integration: TelemetryInteg
|
|
|
8447
9224
|
*/
|
|
8448
9225
|
declare function removeUndefinedEntries<T>(record: Record<string, T | undefined>): Record<string, T>;
|
|
8449
9226
|
|
|
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
|
+
|
|
8450
9234
|
/**
|
|
8451
9235
|
* A function that attempts to repair the raw output of the model
|
|
8452
9236
|
* to enable JSON parsing.
|
|
@@ -8515,7 +9299,7 @@ export declare function rerank<VALUE extends JSONObject | string>({ model, docum
|
|
|
8515
9299
|
* to the provider from the AI SDK and enable provider-specific
|
|
8516
9300
|
* functionality that can be fully encapsulated in the provider.
|
|
8517
9301
|
*/
|
|
8518
|
-
providerOptions?:
|
|
9302
|
+
providerOptions?: ProviderOptions_2;
|
|
8519
9303
|
}): Promise<RerankResult<VALUE>>;
|
|
8520
9304
|
|
|
8521
9305
|
/**
|
|
@@ -8695,12 +9479,20 @@ export declare interface RerankResult<VALUE> {
|
|
|
8695
9479
|
|
|
8696
9480
|
declare type Resolvable<T> = MaybePromiseLike<T> | (() => MaybePromiseLike<T>);
|
|
8697
9481
|
|
|
9482
|
+
declare type Resolvable_2<T> = MaybePromiseLike_2<T> | (() => MaybePromiseLike_2<T>);
|
|
9483
|
+
|
|
8698
9484
|
/**
|
|
8699
9485
|
* Resolves a value that could be a raw value, a Promise, a function returning a value,
|
|
8700
9486
|
* or a function returning a Promise.
|
|
8701
9487
|
*/
|
|
8702
9488
|
declare function resolve<T>(value: Resolvable<T>): Promise<T>;
|
|
8703
9489
|
|
|
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
|
+
|
|
8704
9496
|
declare type ResponseHandler<RETURN_TYPE> = (options: {
|
|
8705
9497
|
url: string;
|
|
8706
9498
|
requestBodyValues: unknown;
|
|
@@ -8711,6 +9503,16 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
|
|
|
8711
9503
|
responseHeaders?: Record<string, string>;
|
|
8712
9504
|
}>;
|
|
8713
9505
|
|
|
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
|
+
|
|
8714
9516
|
/**
|
|
8715
9517
|
* A message that was generated during the generation process.
|
|
8716
9518
|
* It can be either an assistant message or a tool message.
|
|
@@ -8753,9 +9555,33 @@ declare function safeParseJSON(options: {
|
|
|
8753
9555
|
*/
|
|
8754
9556
|
declare function safeParseJSON<T>(options: {
|
|
8755
9557
|
text: string;
|
|
8756
|
-
schema:
|
|
9558
|
+
schema: FlexibleSchema_2<T>;
|
|
8757
9559
|
}): Promise<ParseResult<T>>;
|
|
8758
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
|
+
text: string;
|
|
9582
|
+
schema: FlexibleSchema<T>;
|
|
9583
|
+
}): Promise<ParseResult_2<T>>;
|
|
9584
|
+
|
|
8759
9585
|
/**
|
|
8760
9586
|
* Safely validates the types of an unknown object using a schema and
|
|
8761
9587
|
* return a strongly-typed object.
|
|
@@ -8767,6 +9593,30 @@ declare function safeParseJSON<T>(options: {
|
|
|
8767
9593
|
* @returns An object with either a `success` flag and the parsed and typed data, or a `success` flag and an error object.
|
|
8768
9594
|
*/
|
|
8769
9595
|
declare function safeValidateTypes<OBJECT>({ value, schema, context, }: {
|
|
9596
|
+
value: unknown;
|
|
9597
|
+
schema: FlexibleSchema_2<OBJECT>;
|
|
9598
|
+
context?: TypeValidationContext;
|
|
9599
|
+
}): Promise<{
|
|
9600
|
+
success: true;
|
|
9601
|
+
value: OBJECT;
|
|
9602
|
+
rawValue: unknown;
|
|
9603
|
+
} | {
|
|
9604
|
+
success: false;
|
|
9605
|
+
error: TypeValidationError;
|
|
9606
|
+
rawValue: unknown;
|
|
9607
|
+
}>;
|
|
9608
|
+
|
|
9609
|
+
/**
|
|
9610
|
+
* Safely validates the types of an unknown object using a schema and
|
|
9611
|
+
* return a strongly-typed object.
|
|
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, }: {
|
|
8770
9620
|
value: unknown;
|
|
8771
9621
|
schema: FlexibleSchema<OBJECT>;
|
|
8772
9622
|
context?: TypeValidationContext;
|
|
@@ -8805,6 +9655,26 @@ export declare type SafeValidateUIMessagesResult<UI_MESSAGE extends UIMessage> =
|
|
|
8805
9655
|
};
|
|
8806
9656
|
|
|
8807
9657
|
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> = {
|
|
8808
9678
|
/**
|
|
8809
9679
|
* Used to mark schemas so we can support both Zod and custom schemas.
|
|
8810
9680
|
*/
|
|
@@ -8829,6 +9699,11 @@ export declare type Schema<OBJECT = unknown> = {
|
|
|
8829
9699
|
*/
|
|
8830
9700
|
declare const schemaSymbol: unique symbol;
|
|
8831
9701
|
|
|
9702
|
+
/**
|
|
9703
|
+
* Used to mark schemas so we can support both Zod and custom schemas.
|
|
9704
|
+
*/
|
|
9705
|
+
declare const schemaSymbol_2: unique symbol;
|
|
9706
|
+
|
|
8832
9707
|
export declare class SerialJobExecutor {
|
|
8833
9708
|
private queue;
|
|
8834
9709
|
private isProcessing;
|
|
@@ -9709,6 +10584,8 @@ declare namespace StandardJSONSchemaV1 {
|
|
|
9709
10584
|
|
|
9710
10585
|
declare type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & StandardJSONSchemaV1<unknown, SCHEMA>;
|
|
9711
10586
|
|
|
10587
|
+
declare type StandardSchema_2<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & StandardJSONSchemaV1<unknown, SCHEMA>;
|
|
10588
|
+
|
|
9712
10589
|
/** The Standard Schema interface. */
|
|
9713
10590
|
declare interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
9714
10591
|
/** The Standard Schema properties. */
|
|
@@ -9886,7 +10763,7 @@ export declare type StepResult<TOOLS extends ToolSet> = {
|
|
|
9886
10763
|
/**
|
|
9887
10764
|
* The reasoning that was generated during the generation.
|
|
9888
10765
|
*/
|
|
9889
|
-
readonly reasoning: Array<
|
|
10766
|
+
readonly reasoning: Array<ReasoningPart_2>;
|
|
9890
10767
|
/**
|
|
9891
10768
|
* The reasoning text that was generated during the generation.
|
|
9892
10769
|
*/
|
|
@@ -10088,7 +10965,7 @@ export declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = Fl
|
|
|
10088
10965
|
* to the provider from the AI SDK and enable provider-specific
|
|
10089
10966
|
* functionality that can be fully encapsulated in the provider.
|
|
10090
10967
|
*/
|
|
10091
|
-
providerOptions?:
|
|
10968
|
+
providerOptions?: ProviderOptions_2;
|
|
10092
10969
|
/**
|
|
10093
10970
|
* Callback that is invoked when an error occurs during streaming.
|
|
10094
10971
|
* You can use it to log errors.
|
|
@@ -10334,7 +11211,7 @@ export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_
|
|
|
10334
11211
|
* to the provider from the AI SDK and enable provider-specific
|
|
10335
11212
|
* functionality that can be fully encapsulated in the provider.
|
|
10336
11213
|
*/
|
|
10337
|
-
providerOptions?:
|
|
11214
|
+
providerOptions?: ProviderOptions_2;
|
|
10338
11215
|
/**
|
|
10339
11216
|
* @deprecated Use `activeTools` instead.
|
|
10340
11217
|
*/
|
|
@@ -10780,13 +11657,23 @@ export declare type StreamTextTransform<TOOLS extends ToolSet> = (options: {
|
|
|
10780
11657
|
*/
|
|
10781
11658
|
declare function stripFileExtension(filename: string): string;
|
|
10782
11659
|
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
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
|
+
declare const symbol$1: unique symbol;
|
|
11671
|
+
|
|
11672
|
+
declare const symbol$1_2: unique symbol;
|
|
11673
|
+
|
|
11674
|
+
declare const symbol$2: unique symbol;
|
|
11675
|
+
|
|
11676
|
+
declare const symbol$2_2: unique symbol;
|
|
10790
11677
|
|
|
10791
11678
|
declare const symbol$3: unique symbol;
|
|
10792
11679
|
|
|
@@ -10850,6 +11737,8 @@ declare const symbol_2: unique symbol;
|
|
|
10850
11737
|
|
|
10851
11738
|
declare const symbol_3: unique symbol;
|
|
10852
11739
|
|
|
11740
|
+
declare const symbol_4: unique symbol;
|
|
11741
|
+
|
|
10853
11742
|
/**
|
|
10854
11743
|
* A system message. It can contain system information.
|
|
10855
11744
|
*
|
|
@@ -10858,6 +11747,24 @@ declare const symbol_3: unique symbol;
|
|
|
10858
11747
|
* and because not all providers support several system messages.
|
|
10859
11748
|
*/
|
|
10860
11749
|
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 = {
|
|
10861
11768
|
role: 'system';
|
|
10862
11769
|
content: string;
|
|
10863
11770
|
/**
|
|
@@ -10930,6 +11837,23 @@ export declare type TelemetrySettings = {
|
|
|
10930
11837
|
* Text content part of a prompt. It contains a string of text.
|
|
10931
11838
|
*/
|
|
10932
11839
|
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 {
|
|
10933
11857
|
type: 'text';
|
|
10934
11858
|
/**
|
|
10935
11859
|
* The text content.
|
|
@@ -11095,7 +12019,7 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
11095
12019
|
* to the provider from the AI SDK and enable provider-specific
|
|
11096
12020
|
* functionality that can be fully encapsulated in the provider.
|
|
11097
12021
|
*/
|
|
11098
|
-
providerOptions?:
|
|
12022
|
+
providerOptions?: ProviderOptions_2;
|
|
11099
12023
|
/**
|
|
11100
12024
|
* The schema of the input that the tool expects.
|
|
11101
12025
|
* The language model will use this to generate the input.
|
|
@@ -11114,7 +12038,7 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
11114
12038
|
/**
|
|
11115
12039
|
* Whether the tool needs approval before it can be executed.
|
|
11116
12040
|
*/
|
|
11117
|
-
needsApproval?: boolean |
|
|
12041
|
+
needsApproval?: boolean | ToolNeedsApprovalFunction_2<[INPUT] extends [never] ? unknown : INPUT>;
|
|
11118
12042
|
/**
|
|
11119
12043
|
* Strict mode setting for the tool.
|
|
11120
12044
|
*
|
|
@@ -11142,7 +12066,7 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
11142
12066
|
onInputAvailable?: (options: {
|
|
11143
12067
|
input: [INPUT] extends [never] ? unknown : INPUT;
|
|
11144
12068
|
} & ToolExecutionOptions) => void | PromiseLike<void>;
|
|
11145
|
-
} &
|
|
12069
|
+
} & ToolOutputProperties_2<INPUT, OUTPUT> & {
|
|
11146
12070
|
/**
|
|
11147
12071
|
* Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
11148
12072
|
*
|
|
@@ -11161,7 +12085,7 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
11161
12085
|
* The output of the tool call.
|
|
11162
12086
|
*/
|
|
11163
12087
|
output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>;
|
|
11164
|
-
}) =>
|
|
12088
|
+
}) => ToolResultOutput_2 | PromiseLike<ToolResultOutput_2>;
|
|
11165
12089
|
} & ({
|
|
11166
12090
|
/**
|
|
11167
12091
|
* Tool with user-defined input and output schemas.
|
|
@@ -11213,6 +12137,146 @@ export declare function tool<OUTPUT>(tool: Tool<never, OUTPUT>): Tool<never, OUT
|
|
|
11213
12137
|
|
|
11214
12138
|
export declare function tool(tool: Tool<never, never>): Tool<never, never>;
|
|
11215
12139
|
|
|
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
|
+
|
|
11216
12280
|
/**
|
|
11217
12281
|
* Tool approval request prompt part.
|
|
11218
12282
|
*/
|
|
@@ -11228,6 +12292,21 @@ export declare type ToolApprovalRequest = {
|
|
|
11228
12292
|
toolCallId: string;
|
|
11229
12293
|
};
|
|
11230
12294
|
|
|
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
|
+
|
|
11231
12310
|
/**
|
|
11232
12311
|
* Output part that indicates that a tool approval request has been made.
|
|
11233
12312
|
*
|
|
@@ -11269,6 +12348,30 @@ export declare type ToolApprovalResponse = {
|
|
|
11269
12348
|
providerExecuted?: boolean;
|
|
11270
12349
|
};
|
|
11271
12350
|
|
|
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
|
+
|
|
11272
12375
|
/**
|
|
11273
12376
|
* Typed tool call that is returned by generateText and streamText.
|
|
11274
12377
|
* It contains the tool call ID, the tool name, and the tool arguments.
|
|
@@ -11297,6 +12400,34 @@ declare interface ToolCall<NAME extends string, INPUT> {
|
|
|
11297
12400
|
dynamic?: boolean;
|
|
11298
12401
|
}
|
|
11299
12402
|
|
|
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
|
+
|
|
11300
12431
|
export declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
11301
12432
|
private readonly [symbol$e];
|
|
11302
12433
|
readonly toolCallId: string;
|
|
@@ -11313,10 +12444,44 @@ export declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
|
11313
12444
|
*/
|
|
11314
12445
|
export declare type ToolCallOptions = ToolExecutionOptions;
|
|
11315
12446
|
|
|
12447
|
+
/**
|
|
12448
|
+
* @deprecated Use ToolExecutionOptions instead.
|
|
12449
|
+
*/
|
|
12450
|
+
declare type ToolCallOptions_2 = ToolExecutionOptions_2;
|
|
12451
|
+
|
|
11316
12452
|
/**
|
|
11317
12453
|
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
11318
12454
|
*/
|
|
11319
12455
|
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 {
|
|
11320
12485
|
type: 'tool-call';
|
|
11321
12486
|
/**
|
|
11322
12487
|
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
@@ -11395,8 +12560,15 @@ export declare type ToolChoice<TOOLS extends Record<string, unknown>> = 'auto' |
|
|
|
11395
12560
|
*/
|
|
11396
12561
|
export declare type ToolContent = Array<ToolResultPart | ToolApprovalResponse>;
|
|
11397
12562
|
|
|
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
|
+
|
|
11398
12568
|
export declare type ToolExecuteFunction<INPUT, OUTPUT> = (input: INPUT, options: ToolExecutionOptions) => AsyncIterable<OUTPUT> | PromiseLike<OUTPUT> | OUTPUT;
|
|
11399
12569
|
|
|
12570
|
+
declare type ToolExecuteFunction_2<INPUT, OUTPUT> = (input: INPUT, options: ToolExecutionOptions_2) => AsyncIterable<OUTPUT> | PromiseLike<OUTPUT> | OUTPUT;
|
|
12571
|
+
|
|
11400
12572
|
/**
|
|
11401
12573
|
* Additional options that are sent into each tool call.
|
|
11402
12574
|
*/
|
|
@@ -11429,6 +12601,38 @@ export declare interface ToolExecutionOptions {
|
|
|
11429
12601
|
experimental_context?: unknown;
|
|
11430
12602
|
}
|
|
11431
12603
|
|
|
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
|
+
|
|
11432
12636
|
/**
|
|
11433
12637
|
* A tool loop agent is an agent that runs tools in a loop. In each step,
|
|
11434
12638
|
* it calls the LLM, and if there are tool calls, it executes the tools
|
|
@@ -11561,7 +12765,7 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
11561
12765
|
* to the provider from the AI SDK and enable provider-specific
|
|
11562
12766
|
* functionality that can be fully encapsulated in the provider.
|
|
11563
12767
|
*/
|
|
11564
|
-
providerOptions?:
|
|
12768
|
+
providerOptions?: ProviderOptions_2;
|
|
11565
12769
|
/**
|
|
11566
12770
|
* Context that is passed into tool calls.
|
|
11567
12771
|
*
|
|
@@ -11585,7 +12789,7 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
11585
12789
|
*
|
|
11586
12790
|
* You can use this to have templates based on call options.
|
|
11587
12791
|
*/
|
|
11588
|
-
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'>) =>
|
|
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'>) => MaybePromiseLike_2<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'>>;
|
|
11589
12793
|
};
|
|
11590
12794
|
export { ToolLoopAgentSettings as Experimental_AgentSettings }
|
|
11591
12795
|
export { ToolLoopAgentSettings }
|
|
@@ -11596,6 +12800,20 @@ export { ToolLoopAgentSettings }
|
|
|
11596
12800
|
export declare type ToolModelMessage = {
|
|
11597
12801
|
role: 'tool';
|
|
11598
12802
|
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;
|
|
11599
12817
|
/**
|
|
11600
12818
|
* Additional provider-specific metadata. They are passed through
|
|
11601
12819
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -11628,10 +12846,53 @@ declare interface ToolNameMapping {
|
|
|
11628
12846
|
toCustomToolName: (providerToolName: string) => string;
|
|
11629
12847
|
}
|
|
11630
12848
|
|
|
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
|
+
|
|
11631
12871
|
/**
|
|
11632
12872
|
* Function that is called to determine if the tool needs approval before it can be executed.
|
|
11633
12873
|
*/
|
|
11634
12874
|
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: {
|
|
11635
12896
|
/**
|
|
11636
12897
|
* The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
|
|
11637
12898
|
*/
|
|
@@ -11650,6 +12911,21 @@ declare type ToolNeedsApprovalFunction<INPUT> = (input: INPUT, options: {
|
|
|
11650
12911
|
}) => boolean | PromiseLike<boolean>;
|
|
11651
12912
|
|
|
11652
12913
|
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, {
|
|
11653
12929
|
/**
|
|
11654
12930
|
* An async function that is called with the arguments from the tool call and produces a result.
|
|
11655
12931
|
* If not provided, the tool will not be executed automatically.
|
|
@@ -11668,7 +12944,38 @@ declare type ToolOutputProperties<INPUT, OUTPUT> = NeverOptional<OUTPUT, {
|
|
|
11668
12944
|
* Typed tool result that is returned by `generateText` and `streamText`.
|
|
11669
12945
|
* It contains the tool call ID, the tool name, the tool arguments, and the tool result.
|
|
11670
12946
|
*/
|
|
11671
|
-
declare interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
12947
|
+
declare interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
12948
|
+
/**
|
|
12949
|
+
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
12950
|
+
*/
|
|
12951
|
+
toolCallId: string;
|
|
12952
|
+
/**
|
|
12953
|
+
* Name of the tool that was called.
|
|
12954
|
+
*/
|
|
12955
|
+
toolName: NAME;
|
|
12956
|
+
/**
|
|
12957
|
+
* Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
12958
|
+
*/
|
|
12959
|
+
input: INPUT;
|
|
12960
|
+
/**
|
|
12961
|
+
* Result of the tool call. This is the result of the tool's execution.
|
|
12962
|
+
*/
|
|
12963
|
+
output: OUTPUT;
|
|
12964
|
+
/**
|
|
12965
|
+
* Whether the tool result has been executed by the provider.
|
|
12966
|
+
*/
|
|
12967
|
+
providerExecuted?: boolean;
|
|
12968
|
+
/**
|
|
12969
|
+
* Whether the tool is dynamic.
|
|
12970
|
+
*/
|
|
12971
|
+
dynamic?: boolean;
|
|
12972
|
+
}
|
|
12973
|
+
|
|
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> {
|
|
11672
12979
|
/**
|
|
11673
12980
|
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
11674
12981
|
*/
|
|
@@ -11867,10 +13174,207 @@ declare type ToolResultOutput = {
|
|
|
11867
13174
|
}>;
|
|
11868
13175
|
};
|
|
11869
13176
|
|
|
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
|
+
|
|
11870
13349
|
/**
|
|
11871
13350
|
* Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
11872
13351
|
*/
|
|
11873
13352
|
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 {
|
|
11874
13378
|
type: 'tool-result';
|
|
11875
13379
|
/**
|
|
11876
13380
|
* ID of the tool call that this result is associated with.
|
|
@@ -12554,7 +14058,7 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
12554
14058
|
messageMetadata: METADATA;
|
|
12555
14059
|
};
|
|
12556
14060
|
|
|
12557
|
-
export declare const uiMessageChunkSchema:
|
|
14061
|
+
export declare const uiMessageChunkSchema: _ai_sdk_provider_utils_2.LazySchema<{
|
|
12558
14062
|
type: "text-start";
|
|
12559
14063
|
id: string;
|
|
12560
14064
|
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
@@ -12935,7 +14439,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
12935
14439
|
export declare type UITools = Record<string, UITool>;
|
|
12936
14440
|
|
|
12937
14441
|
export declare class UnsupportedFunctionalityError extends AISDKError {
|
|
12938
|
-
private readonly [
|
|
14442
|
+
private readonly [symbol_3];
|
|
12939
14443
|
readonly functionality: string;
|
|
12940
14444
|
constructor({ functionality, message, }: {
|
|
12941
14445
|
functionality: string;
|
|
@@ -13017,7 +14521,7 @@ export declare type UseCompletionOptions = {
|
|
|
13017
14521
|
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
13018
14522
|
* or to provide a custom fetch implementation for e.g. testing.
|
|
13019
14523
|
*/
|
|
13020
|
-
fetch?:
|
|
14524
|
+
fetch?: FetchFunction_2;
|
|
13021
14525
|
};
|
|
13022
14526
|
|
|
13023
14527
|
/**
|
|
@@ -13025,12 +14529,31 @@ export declare type UseCompletionOptions = {
|
|
|
13025
14529
|
*/
|
|
13026
14530
|
export declare type UserContent = string | Array<TextPart | ImagePart | FilePart>;
|
|
13027
14531
|
|
|
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
|
+
|
|
13028
14537
|
/**
|
|
13029
14538
|
* A user message. It can contain text or a combination of text and images.
|
|
13030
14539
|
*/
|
|
13031
14540
|
export declare type UserModelMessage = {
|
|
13032
14541
|
role: 'user';
|
|
13033
14542
|
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;
|
|
13034
14557
|
/**
|
|
13035
14558
|
* Additional provider-specific metadata. They are passed through
|
|
13036
14559
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -13050,6 +14573,15 @@ export declare const userModelMessageSchema: z.ZodType<UserModelMessage>;
|
|
|
13050
14573
|
*/
|
|
13051
14574
|
declare function validateDownloadUrl(url: string): void;
|
|
13052
14575
|
|
|
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
|
+
|
|
13053
14585
|
/**
|
|
13054
14586
|
* Validates the types of an unknown object using a schema and
|
|
13055
14587
|
* return a strongly-typed object.
|
|
@@ -13061,6 +14593,22 @@ declare function validateDownloadUrl(url: string): void;
|
|
|
13061
14593
|
* @returns {Promise<T>} - The typed object.
|
|
13062
14594
|
*/
|
|
13063
14595
|
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, }: {
|
|
13064
14612
|
value: unknown;
|
|
13065
14613
|
schema: FlexibleSchema<OBJECT>;
|
|
13066
14614
|
context?: TypeValidationContext;
|
|
@@ -13092,6 +14640,14 @@ declare type ValidationResult<OBJECT> = {
|
|
|
13092
14640
|
error: Error;
|
|
13093
14641
|
};
|
|
13094
14642
|
|
|
14643
|
+
declare type ValidationResult_2<OBJECT> = {
|
|
14644
|
+
success: true;
|
|
14645
|
+
value: OBJECT;
|
|
14646
|
+
} | {
|
|
14647
|
+
success: false;
|
|
14648
|
+
error: Error;
|
|
14649
|
+
};
|
|
14650
|
+
|
|
13095
14651
|
/**
|
|
13096
14652
|
* Create a union of the given object's values, and optionally specify which keys to get the values from.
|
|
13097
14653
|
*
|
|
@@ -13136,6 +14692,8 @@ declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof Obje
|
|
|
13136
14692
|
|
|
13137
14693
|
declare const VERSION: string;
|
|
13138
14694
|
|
|
14695
|
+
declare const VERSION_2: string;
|
|
14696
|
+
|
|
13139
14697
|
/**
|
|
13140
14698
|
* A video model can be a string (model ID) or a Experimental_VideoModelV3 object.
|
|
13141
14699
|
*/
|
|
@@ -13389,6 +14947,8 @@ export declare type Warning = SharedV3Warning;
|
|
|
13389
14947
|
|
|
13390
14948
|
declare function withoutTrailingSlash(url: string | undefined): string | undefined;
|
|
13391
14949
|
|
|
14950
|
+
declare function withoutTrailingSlash_2(url: string | undefined): string | undefined;
|
|
14951
|
+
|
|
13392
14952
|
/**
|
|
13393
14953
|
* Appends suffix parts to the `user-agent` header.
|
|
13394
14954
|
* If a `user-agent` header already exists, the suffix parts are appended to it.
|
|
@@ -13401,6 +14961,18 @@ declare function withoutTrailingSlash(url: string | undefined): string | undefin
|
|
|
13401
14961
|
*/
|
|
13402
14962
|
declare function withUserAgentSuffix(headers: HeadersInit | Record<string, string | undefined> | undefined, ...userAgentSuffixParts: string[]): Record<string, string>;
|
|
13403
14963
|
|
|
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
|
+
|
|
13404
14976
|
/**
|
|
13405
14977
|
* Wraps an EmbeddingModelV3 instance with middleware functionality.
|
|
13406
14978
|
* This function allows you to apply middleware to transform parameters,
|
|
@@ -13488,6 +15060,20 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
|
|
|
13488
15060
|
useReferences?: boolean;
|
|
13489
15061
|
}): Schema<OBJECT>;
|
|
13490
15062
|
|
|
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
|
+
|
|
13491
15075
|
export { }
|
|
13492
|
-
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider,
|
|
13493
|
-
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 };
|
|
15076
|
+
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, LazySchema_2 as LazySchema_2, ZodSchema_2 as ZodSchema_2, StandardSchema_2 as StandardSchema_2, ValidationResult_2 as ValidationResult_2, ParseResult_2 as ParseResult_2, ProviderOptions_2 as ProviderOptions_2, ReasoningPart_2 as ReasoningPart_2, ToolOutputProperties_2 as ToolOutputProperties_2, ToolResultOutput_2 as ToolResultOutput_2, ToolNeedsApprovalFunction_2 as ToolNeedsApprovalFunction_2, 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, SharedV3ProviderMetadata as SharedV3ProviderMetadata, SpeechModelV2 as SpeechModelV2, TranscriptionModelV2 as TranscriptionModelV2, ImageModelV3Usage as ImageModelV3Usage, BaseToolCall as BaseToolCall, Source as Source, DeepPartialInternal as DeepPartialInternal, CallbackModelInfo as CallbackModelInfo, LanguageModelV3ToolChoice as LanguageModelV3ToolChoice, Listener as Listener, AttributeValue as AttributeValue, Tracer as Tracer, LanguageModelV3ToolCall as LanguageModelV3ToolCall, GenerateTextIncludeSettings as GenerateTextIncludeSettings, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils_2 as _ai_sdk_provider_utils_2, _ai_sdk_provider as _ai_sdk_provider, DataUIMessageChunk as DataUIMessageChunk, InferElementOutput as InferElementOutput, ConsumeStreamOptions as ConsumeStreamOptions, StreamTextIncludeSettings as StreamTextIncludeSettings, StreamTextOnAbortCallback as StreamTextOnAbortCallback, ResponseMessage as ResponseMessage, MaybePromiseLike_2 as MaybePromiseLike_2, Output_2 as Output_2, InferAgentTools as InferAgentTools, UIMessageStreamResponseInit as UIMessageStreamResponseInit, getOriginalFetch as getOriginalFetch, InferUIMessageToolCall as InferUIMessageToolCall, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, InferUIMessageTools as InferUIMessageTools, Resolvable_2 as Resolvable_2, FetchFunction_2 as FetchFunction_2, 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 };
|
|
15077
|
+
export { schemaSymbol, schemaSymbol_2, 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, symbol_4 };
|
|
15078
|
+
|
|
15079
|
+
export type ProviderOptions = NonNullable<EmbeddingModelV3CallOptions['providerOptions']>;
|