@mastra/schema-compat 1.2.9 → 1.2.10-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +425 -1757
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +311 -1772
- package/dist/index.cjs +32 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -28
- package/dist/index.js.map +1 -1
- package/dist/provider-compats/google.d.ts +1 -0
- package/dist/provider-compats/google.d.ts.map +1 -1
- package/package.json +15 -15
|
@@ -76,33 +76,9 @@ export declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
76
76
|
*/
|
|
77
77
|
clearError: () => void;
|
|
78
78
|
addToolApprovalResponse: ChatAddToolApproveResponseFunction;
|
|
79
|
-
addToolOutput: <
|
|
80
|
-
state?: "output-available";
|
|
81
|
-
tool: TOOL;
|
|
82
|
-
toolCallId: string;
|
|
83
|
-
output: InferUIMessageTools<UI_MESSAGE>[TOOL]["output"];
|
|
84
|
-
errorText?: never;
|
|
85
|
-
} | {
|
|
86
|
-
state: "output-error";
|
|
87
|
-
tool: TOOL;
|
|
88
|
-
toolCallId: string;
|
|
89
|
-
output?: never;
|
|
90
|
-
errorText: string;
|
|
91
|
-
}) => Promise<void>;
|
|
79
|
+
addToolOutput: ChatAddToolOutputFunction<UI_MESSAGE>;
|
|
92
80
|
/** @deprecated Use addToolOutput */
|
|
93
|
-
addToolResult: <
|
|
94
|
-
state?: "output-available";
|
|
95
|
-
tool: TOOL;
|
|
96
|
-
toolCallId: string;
|
|
97
|
-
output: InferUIMessageTools<UI_MESSAGE>[TOOL]["output"];
|
|
98
|
-
errorText?: never;
|
|
99
|
-
} | {
|
|
100
|
-
state: "output-error";
|
|
101
|
-
tool: TOOL;
|
|
102
|
-
toolCallId: string;
|
|
103
|
-
output?: never;
|
|
104
|
-
errorText: string;
|
|
105
|
-
}) => Promise<void>;
|
|
81
|
+
addToolResult: ChatAddToolOutputFunction<UI_MESSAGE>;
|
|
106
82
|
/**
|
|
107
83
|
* Abort the current request immediately, keep the generated tokens if any.
|
|
108
84
|
*/
|
|
@@ -229,30 +205,10 @@ CALL_OPTIONS
|
|
|
229
205
|
* Timeout in milliseconds. Can be specified as a number or as an object with `totalMs`.
|
|
230
206
|
*/
|
|
231
207
|
timeout?: TimeoutConfiguration;
|
|
232
|
-
/**
|
|
233
|
-
* Callback that is called when the agent operation begins, before any LLM calls.
|
|
234
|
-
*/
|
|
235
|
-
experimental_onStart?: ToolLoopAgentOnStartCallback<TOOLS>;
|
|
236
|
-
/**
|
|
237
|
-
* Callback that is called when a step (LLM call) begins, before the provider is called.
|
|
238
|
-
*/
|
|
239
|
-
experimental_onStepStart?: ToolLoopAgentOnStepStartCallback<TOOLS>;
|
|
240
|
-
/**
|
|
241
|
-
* Callback that is called before each tool execution begins.
|
|
242
|
-
*/
|
|
243
|
-
experimental_onToolCallStart?: ToolLoopAgentOnToolCallStartCallback<TOOLS>;
|
|
244
|
-
/**
|
|
245
|
-
* Callback that is called after each tool execution completes.
|
|
246
|
-
*/
|
|
247
|
-
experimental_onToolCallFinish?: ToolLoopAgentOnToolCallFinishCallback<TOOLS>;
|
|
248
208
|
/**
|
|
249
209
|
* Callback that is called when each step (LLM call) is finished, including intermediate steps.
|
|
250
210
|
*/
|
|
251
211
|
onStepFinish?: ToolLoopAgentOnStepFinishCallback<TOOLS>;
|
|
252
|
-
/**
|
|
253
|
-
* Callback that is called when all steps are finished and the response is complete.
|
|
254
|
-
*/
|
|
255
|
-
onFinish?: ToolLoopAgentOnFinishCallback<TOOLS>;
|
|
256
212
|
};
|
|
257
213
|
|
|
258
214
|
/**
|
|
@@ -387,7 +343,7 @@ declare namespace _ai_sdk_provider {
|
|
|
387
343
|
TypeValidationContext,
|
|
388
344
|
TypeValidationError,
|
|
389
345
|
UnsupportedFunctionalityError,
|
|
390
|
-
|
|
346
|
+
getErrorMessage_2 as getErrorMessage,
|
|
391
347
|
isJSONArray,
|
|
392
348
|
isJSONObject,
|
|
393
349
|
isJSONValue
|
|
@@ -398,23 +354,23 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
398
354
|
export {
|
|
399
355
|
EventSourceMessage,
|
|
400
356
|
EventSourceParserStream,
|
|
401
|
-
|
|
402
|
-
|
|
357
|
+
AssistantContent,
|
|
358
|
+
AssistantModelMessage,
|
|
403
359
|
DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
404
|
-
|
|
360
|
+
DataContent,
|
|
405
361
|
DelayedPromise,
|
|
406
|
-
|
|
362
|
+
DownloadError,
|
|
407
363
|
FetchFunction,
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
364
|
+
FilePart,
|
|
365
|
+
FlexibleSchema,
|
|
366
|
+
IdGenerator,
|
|
367
|
+
ImagePart,
|
|
368
|
+
InferSchema,
|
|
369
|
+
InferToolInput,
|
|
370
|
+
InferToolOutput,
|
|
415
371
|
LazySchema,
|
|
416
372
|
MaybePromiseLike,
|
|
417
|
-
|
|
373
|
+
ModelMessage,
|
|
418
374
|
ParseResult,
|
|
419
375
|
ProviderOptions,
|
|
420
376
|
ProviderToolFactory,
|
|
@@ -422,29 +378,29 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
422
378
|
ReasoningPart,
|
|
423
379
|
Resolvable,
|
|
424
380
|
ResponseHandler,
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
381
|
+
Schema,
|
|
382
|
+
SystemModelMessage,
|
|
383
|
+
TextPart,
|
|
384
|
+
Tool,
|
|
385
|
+
ToolApprovalRequest,
|
|
386
|
+
ToolApprovalResponse,
|
|
431
387
|
ToolCall,
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
388
|
+
ToolCallOptions,
|
|
389
|
+
ToolCallPart,
|
|
390
|
+
ToolContent,
|
|
391
|
+
ToolExecuteFunction,
|
|
392
|
+
ToolExecutionOptions,
|
|
393
|
+
ToolModelMessage,
|
|
438
394
|
ToolNameMapping,
|
|
439
395
|
ToolNeedsApprovalFunction,
|
|
440
396
|
ToolResult,
|
|
441
397
|
ToolResultOutput,
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
398
|
+
ToolResultPart,
|
|
399
|
+
UserContent,
|
|
400
|
+
UserModelMessage,
|
|
445
401
|
VERSION,
|
|
446
402
|
ValidationResult,
|
|
447
|
-
|
|
403
|
+
asSchema,
|
|
448
404
|
combineHeaders,
|
|
449
405
|
convertAsyncIteratorToReadableStream,
|
|
450
406
|
convertBase64ToUint8Array,
|
|
@@ -454,7 +410,7 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
454
410
|
convertUint8ArrayToBase64,
|
|
455
411
|
createBinaryResponseHandler,
|
|
456
412
|
createEventSourceResponseHandler,
|
|
457
|
-
|
|
413
|
+
createIdGenerator,
|
|
458
414
|
createJsonErrorResponseHandler,
|
|
459
415
|
createJsonResponseHandler,
|
|
460
416
|
createProviderToolFactory,
|
|
@@ -463,10 +419,10 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
463
419
|
createToolNameMapping,
|
|
464
420
|
delay,
|
|
465
421
|
downloadBlob,
|
|
466
|
-
|
|
422
|
+
dynamicTool,
|
|
467
423
|
executeTool,
|
|
468
424
|
extractResponseHeaders,
|
|
469
|
-
|
|
425
|
+
generateId,
|
|
470
426
|
getErrorMessage,
|
|
471
427
|
getFromApi,
|
|
472
428
|
getRuntimeEnvironmentUserAgent,
|
|
@@ -475,7 +431,7 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
475
431
|
isNonNullable,
|
|
476
432
|
isParsableJson,
|
|
477
433
|
isUrlSupported,
|
|
478
|
-
|
|
434
|
+
jsonSchema,
|
|
479
435
|
lazySchema,
|
|
480
436
|
loadApiKey,
|
|
481
437
|
loadOptionalSetting,
|
|
@@ -483,7 +439,7 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
483
439
|
mediaTypeToExtension,
|
|
484
440
|
normalizeHeaders,
|
|
485
441
|
parseJSON,
|
|
486
|
-
|
|
442
|
+
parseJsonEventStream,
|
|
487
443
|
parseProviderOptions,
|
|
488
444
|
postFormDataToApi,
|
|
489
445
|
postJsonToApi,
|
|
@@ -494,123 +450,11 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
494
450
|
safeParseJSON,
|
|
495
451
|
safeValidateTypes,
|
|
496
452
|
stripFileExtension,
|
|
497
|
-
|
|
453
|
+
tool,
|
|
498
454
|
validateDownloadUrl,
|
|
499
455
|
validateTypes,
|
|
500
456
|
withUserAgentSuffix,
|
|
501
457
|
withoutTrailingSlash,
|
|
502
|
-
zodSchema_2 as zodSchema,
|
|
503
|
-
StandardJSONSchemaV1,
|
|
504
|
-
StandardSchemaV1,
|
|
505
|
-
StandardTypedV1
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
declare namespace _ai_sdk_provider_utils_2 {
|
|
510
|
-
export {
|
|
511
|
-
EventSourceMessage,
|
|
512
|
-
EventSourceParserStream,
|
|
513
|
-
AssistantContent,
|
|
514
|
-
AssistantModelMessage,
|
|
515
|
-
DEFAULT_MAX_DOWNLOAD_SIZE_2 as DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
516
|
-
DataContent,
|
|
517
|
-
DelayedPromise_2 as DelayedPromise,
|
|
518
|
-
DownloadError,
|
|
519
|
-
FetchFunction_2 as FetchFunction,
|
|
520
|
-
FilePart,
|
|
521
|
-
FlexibleSchema,
|
|
522
|
-
IdGenerator,
|
|
523
|
-
ImagePart,
|
|
524
|
-
InferSchema,
|
|
525
|
-
InferToolInput,
|
|
526
|
-
InferToolOutput,
|
|
527
|
-
LazySchema_2 as LazySchema,
|
|
528
|
-
MaybePromiseLike_2 as MaybePromiseLike,
|
|
529
|
-
ModelMessage,
|
|
530
|
-
ParseResult_2 as ParseResult,
|
|
531
|
-
ProviderOptions_2 as ProviderOptions,
|
|
532
|
-
ProviderToolFactory_2 as ProviderToolFactory,
|
|
533
|
-
ProviderToolFactoryWithOutputSchema_2 as ProviderToolFactoryWithOutputSchema,
|
|
534
|
-
ReasoningPart_2 as ReasoningPart,
|
|
535
|
-
Resolvable_2 as Resolvable,
|
|
536
|
-
ResponseHandler_2 as ResponseHandler,
|
|
537
|
-
Schema,
|
|
538
|
-
SystemModelMessage,
|
|
539
|
-
TextPart,
|
|
540
|
-
Tool,
|
|
541
|
-
ToolApprovalRequest,
|
|
542
|
-
ToolApprovalResponse,
|
|
543
|
-
ToolCall_2 as ToolCall,
|
|
544
|
-
ToolCallOptions,
|
|
545
|
-
ToolCallPart,
|
|
546
|
-
ToolContent,
|
|
547
|
-
ToolExecuteFunction,
|
|
548
|
-
ToolExecutionOptions,
|
|
549
|
-
ToolModelMessage,
|
|
550
|
-
ToolNameMapping_2 as ToolNameMapping,
|
|
551
|
-
ToolNeedsApprovalFunction_2 as ToolNeedsApprovalFunction,
|
|
552
|
-
ToolResult_2 as ToolResult,
|
|
553
|
-
ToolResultOutput_2 as ToolResultOutput,
|
|
554
|
-
ToolResultPart,
|
|
555
|
-
UserContent,
|
|
556
|
-
UserModelMessage,
|
|
557
|
-
VERSION_2 as VERSION,
|
|
558
|
-
ValidationResult_2 as ValidationResult,
|
|
559
|
-
asSchema,
|
|
560
|
-
combineHeaders_2 as combineHeaders,
|
|
561
|
-
convertAsyncIteratorToReadableStream_2 as convertAsyncIteratorToReadableStream,
|
|
562
|
-
convertBase64ToUint8Array_2 as convertBase64ToUint8Array,
|
|
563
|
-
convertImageModelFileToDataUri_2 as convertImageModelFileToDataUri,
|
|
564
|
-
convertToBase64_2 as convertToBase64,
|
|
565
|
-
convertToFormData_2 as convertToFormData,
|
|
566
|
-
convertUint8ArrayToBase64_2 as convertUint8ArrayToBase64,
|
|
567
|
-
createBinaryResponseHandler_2 as createBinaryResponseHandler,
|
|
568
|
-
createEventSourceResponseHandler_2 as createEventSourceResponseHandler,
|
|
569
|
-
createIdGenerator,
|
|
570
|
-
createJsonErrorResponseHandler_2 as createJsonErrorResponseHandler,
|
|
571
|
-
createJsonResponseHandler_2 as createJsonResponseHandler,
|
|
572
|
-
createProviderToolFactory_2 as createProviderToolFactory,
|
|
573
|
-
createProviderToolFactoryWithOutputSchema_2 as createProviderToolFactoryWithOutputSchema,
|
|
574
|
-
createStatusCodeErrorResponseHandler_2 as createStatusCodeErrorResponseHandler,
|
|
575
|
-
createToolNameMapping_2 as createToolNameMapping,
|
|
576
|
-
delay_2 as delay,
|
|
577
|
-
downloadBlob_2 as downloadBlob,
|
|
578
|
-
dynamicTool,
|
|
579
|
-
executeTool_2 as executeTool,
|
|
580
|
-
extractResponseHeaders_2 as extractResponseHeaders,
|
|
581
|
-
generateId,
|
|
582
|
-
getErrorMessage_2 as getErrorMessage,
|
|
583
|
-
getFromApi_2 as getFromApi,
|
|
584
|
-
getRuntimeEnvironmentUserAgent_2 as getRuntimeEnvironmentUserAgent,
|
|
585
|
-
injectJsonInstructionIntoMessages_2 as injectJsonInstructionIntoMessages,
|
|
586
|
-
isAbortError_2 as isAbortError,
|
|
587
|
-
isNonNullable_2 as isNonNullable,
|
|
588
|
-
isParsableJson_2 as isParsableJson,
|
|
589
|
-
isUrlSupported_2 as isUrlSupported,
|
|
590
|
-
jsonSchema,
|
|
591
|
-
lazySchema_2 as lazySchema,
|
|
592
|
-
loadApiKey_2 as loadApiKey,
|
|
593
|
-
loadOptionalSetting_2 as loadOptionalSetting,
|
|
594
|
-
loadSetting_2 as loadSetting,
|
|
595
|
-
mediaTypeToExtension_2 as mediaTypeToExtension,
|
|
596
|
-
normalizeHeaders_2 as normalizeHeaders,
|
|
597
|
-
parseJSON_2 as parseJSON,
|
|
598
|
-
parseJsonEventStream,
|
|
599
|
-
parseProviderOptions_2 as parseProviderOptions,
|
|
600
|
-
postFormDataToApi_2 as postFormDataToApi,
|
|
601
|
-
postJsonToApi_2 as postJsonToApi,
|
|
602
|
-
postToApi_2 as postToApi,
|
|
603
|
-
readResponseWithSizeLimit_2 as readResponseWithSizeLimit,
|
|
604
|
-
removeUndefinedEntries_2 as removeUndefinedEntries,
|
|
605
|
-
resolve_2 as resolve,
|
|
606
|
-
safeParseJSON_2 as safeParseJSON,
|
|
607
|
-
safeValidateTypes_2 as safeValidateTypes,
|
|
608
|
-
stripFileExtension_2 as stripFileExtension,
|
|
609
|
-
tool,
|
|
610
|
-
validateDownloadUrl_2 as validateDownloadUrl,
|
|
611
|
-
validateTypes_2 as validateTypes,
|
|
612
|
-
withUserAgentSuffix_2 as withUserAgentSuffix,
|
|
613
|
-
withoutTrailingSlash_2 as withoutTrailingSlash,
|
|
614
458
|
zodSchema,
|
|
615
459
|
StandardJSONSchemaV1,
|
|
616
460
|
StandardSchemaV1,
|
|
@@ -676,19 +520,11 @@ export declare class APICallError extends AISDKError {
|
|
|
676
520
|
|
|
677
521
|
export declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
|
|
678
522
|
|
|
679
|
-
declare function asSchema_2<OBJECT>(schema: FlexibleSchema_2<OBJECT> | undefined): Schema_2<OBJECT>;
|
|
680
|
-
|
|
681
|
-
/**
|
|
682
|
-
* Content of an assistant message.
|
|
683
|
-
* It can be a string or an array of text, image, reasoning, redacted reasoning, and tool call parts.
|
|
684
|
-
*/
|
|
685
|
-
export declare type AssistantContent = string | Array<TextPart | FilePart | ReasoningPart_2 | ToolCallPart | ToolResultPart | ToolApprovalRequest>;
|
|
686
|
-
|
|
687
523
|
/**
|
|
688
524
|
* Content of an assistant message.
|
|
689
525
|
* It can be a string or an array of text, image, reasoning, redacted reasoning, and tool call parts.
|
|
690
526
|
*/
|
|
691
|
-
declare type
|
|
527
|
+
export declare type AssistantContent = string | Array<TextPart | FilePart | ReasoningPart | ToolCallPart | ToolResultPart | ToolApprovalRequest>;
|
|
692
528
|
|
|
693
529
|
/**
|
|
694
530
|
* An assistant message. It can contain text, tool calls, or a combination of text and tool calls.
|
|
@@ -696,20 +532,6 @@ declare type AssistantContent_2 = string | Array<TextPart_2 | FilePart_2 | Reaso
|
|
|
696
532
|
export declare type AssistantModelMessage = {
|
|
697
533
|
role: 'assistant';
|
|
698
534
|
content: AssistantContent;
|
|
699
|
-
/**
|
|
700
|
-
* Additional provider-specific metadata. They are passed through
|
|
701
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
702
|
-
* functionality that can be fully encapsulated in the provider.
|
|
703
|
-
*/
|
|
704
|
-
providerOptions?: ProviderOptions_2;
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
/**
|
|
708
|
-
* An assistant message. It can contain text, tool calls, or a combination of text and tool calls.
|
|
709
|
-
*/
|
|
710
|
-
declare type AssistantModelMessage_2 = {
|
|
711
|
-
role: 'assistant';
|
|
712
|
-
content: AssistantContent_2;
|
|
713
535
|
/**
|
|
714
536
|
* Additional provider-specific metadata. They are passed through
|
|
715
537
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -875,7 +697,7 @@ export declare type CallWarning = SharedV3Warning;
|
|
|
875
697
|
/**
|
|
876
698
|
* Function that can be called to add a tool approval response to the chat.
|
|
877
699
|
*/
|
|
878
|
-
export declare type ChatAddToolApproveResponseFunction = ({ id, approved, reason, }: {
|
|
700
|
+
export declare type ChatAddToolApproveResponseFunction = ({ id, approved, reason, options, }: {
|
|
879
701
|
id: string;
|
|
880
702
|
/**
|
|
881
703
|
* Flag indicating whether the approval was granted or denied.
|
|
@@ -885,8 +707,38 @@ export declare type ChatAddToolApproveResponseFunction = ({ id, approved, reason
|
|
|
885
707
|
* Optional reason for the approval or denial.
|
|
886
708
|
*/
|
|
887
709
|
reason?: string;
|
|
710
|
+
/**
|
|
711
|
+
* Optional request options to be used if `sendAutomaticallyWhen` callback returns true.
|
|
712
|
+
*/
|
|
713
|
+
options?: ChatRequestOptions;
|
|
888
714
|
}) => void | PromiseLike<void>;
|
|
889
715
|
|
|
716
|
+
/**
|
|
717
|
+
* Function that can be called to add a tool output to the chat.
|
|
718
|
+
*/
|
|
719
|
+
export declare type ChatAddToolOutputFunction<UI_MESSAGE extends UIMessage> = <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ state, tool, toolCallId, output, errorText, options, }: {
|
|
720
|
+
/**
|
|
721
|
+
* Name of the tool that was called.
|
|
722
|
+
*/
|
|
723
|
+
tool: TOOL;
|
|
724
|
+
/**
|
|
725
|
+
* Identifier of the tool call to add output for.
|
|
726
|
+
*/
|
|
727
|
+
toolCallId: string;
|
|
728
|
+
/**
|
|
729
|
+
* Optional request options to be used if `sendAutomaticallyWhen` callback returns true.
|
|
730
|
+
*/
|
|
731
|
+
options?: ChatRequestOptions;
|
|
732
|
+
} & ({
|
|
733
|
+
state?: 'output-available';
|
|
734
|
+
output: InferUIMessageTools<UI_MESSAGE>[TOOL]['output'];
|
|
735
|
+
errorText?: never;
|
|
736
|
+
} | {
|
|
737
|
+
state: 'output-error';
|
|
738
|
+
output?: never;
|
|
739
|
+
errorText: string;
|
|
740
|
+
})) => void | PromiseLike<void>;
|
|
741
|
+
|
|
890
742
|
export declare interface ChatInit<UI_MESSAGE extends UIMessage> {
|
|
891
743
|
/**
|
|
892
744
|
* A unique identifier for the chat. If not provided, a random one will be
|
|
@@ -1071,8 +923,6 @@ export declare type ChunkDetector = (buffer: string) => string | undefined | nul
|
|
|
1071
923
|
|
|
1072
924
|
declare function combineHeaders(...headers: Array<Record<string, string | undefined> | undefined>): Record<string, string | undefined>;
|
|
1073
925
|
|
|
1074
|
-
declare function combineHeaders_2(...headers: Array<Record<string, string | undefined> | undefined>): Record<string, string | undefined>;
|
|
1075
|
-
|
|
1076
926
|
export declare type CompletionRequestOptions = {
|
|
1077
927
|
/**
|
|
1078
928
|
* An optional object of headers to be passed to the API endpoint.
|
|
@@ -1165,19 +1015,8 @@ declare interface Context {
|
|
|
1165
1015
|
*/
|
|
1166
1016
|
declare function convertAsyncIteratorToReadableStream<T>(iterator: AsyncIterator<T>): ReadableStream<T>;
|
|
1167
1017
|
|
|
1168
|
-
/**
|
|
1169
|
-
* Converts an AsyncIterator to a ReadableStream.
|
|
1170
|
-
*
|
|
1171
|
-
* @template T - The type of elements produced by the AsyncIterator.
|
|
1172
|
-
* @param { <T>} iterator - The AsyncIterator to convert.
|
|
1173
|
-
* @returns {ReadableStream<T>} - A ReadableStream that provides the same data as the AsyncIterator.
|
|
1174
|
-
*/
|
|
1175
|
-
declare function convertAsyncIteratorToReadableStream_2<T>(iterator: AsyncIterator<T>): ReadableStream<T>;
|
|
1176
|
-
|
|
1177
1018
|
declare function convertBase64ToUint8Array(base64String: string): Uint8Array<ArrayBuffer>;
|
|
1178
1019
|
|
|
1179
|
-
declare function convertBase64ToUint8Array_2(base64String: string): Uint8Array<ArrayBuffer>;
|
|
1180
|
-
|
|
1181
1020
|
export declare function convertFileListToFileUIParts(files: FileList | undefined): Promise<Array<FileUIPart>>;
|
|
1182
1021
|
|
|
1183
1022
|
/**
|
|
@@ -1189,19 +1028,8 @@ export declare function convertFileListToFileUIParts(files: FileList | undefined
|
|
|
1189
1028
|
*/
|
|
1190
1029
|
declare function convertImageModelFileToDataUri(file: ImageModelV3File): string;
|
|
1191
1030
|
|
|
1192
|
-
/**
|
|
1193
|
-
* Convert an ImageModelV3File to a URL or data URI string.
|
|
1194
|
-
*
|
|
1195
|
-
* If the file is a URL, it returns the URL as-is.
|
|
1196
|
-
* If the file is base64 data, it returns a data URI with the base64 data.
|
|
1197
|
-
* If the file is a Uint8Array, it converts it to base64 and returns a data URI.
|
|
1198
|
-
*/
|
|
1199
|
-
declare function convertImageModelFileToDataUri_2(file: ImageModelV3File): string;
|
|
1200
|
-
|
|
1201
1031
|
declare function convertToBase64(value: string | Uint8Array): string;
|
|
1202
1032
|
|
|
1203
|
-
declare function convertToBase64_2(value: string | Uint8Array): string;
|
|
1204
|
-
|
|
1205
1033
|
/**
|
|
1206
1034
|
* Converts an input object to FormData for multipart/form-data requests.
|
|
1207
1035
|
*
|
|
@@ -1237,41 +1065,6 @@ declare function convertToFormData<T extends Record<string, unknown>>(input: T,
|
|
|
1237
1065
|
useArrayBrackets?: boolean;
|
|
1238
1066
|
}): FormData;
|
|
1239
1067
|
|
|
1240
|
-
/**
|
|
1241
|
-
* Converts an input object to FormData for multipart/form-data requests.
|
|
1242
|
-
*
|
|
1243
|
-
* Handles the following cases:
|
|
1244
|
-
* - `null` or `undefined` values are skipped
|
|
1245
|
-
* - Arrays with a single element are appended as a single value
|
|
1246
|
-
* - Arrays with multiple elements are appended with `[]` suffix (e.g., `image[]`)
|
|
1247
|
-
* unless `useArrayBrackets` is set to `false`
|
|
1248
|
-
* - All other values are appended directly
|
|
1249
|
-
*
|
|
1250
|
-
* @param input - The input object to convert. Use a generic type for type validation.
|
|
1251
|
-
* @param options - Optional configuration object.
|
|
1252
|
-
* @param options.useArrayBrackets - Whether to add `[]` suffix for multi-element arrays.
|
|
1253
|
-
* Defaults to `true`. Set to `false` for APIs that expect repeated keys without brackets.
|
|
1254
|
-
* @returns A FormData object containing the input values.
|
|
1255
|
-
*
|
|
1256
|
-
* @example
|
|
1257
|
-
* ```ts
|
|
1258
|
-
* type MyInput = {
|
|
1259
|
-
* model: string;
|
|
1260
|
-
* prompt: string;
|
|
1261
|
-
* images: Blob[];
|
|
1262
|
-
* };
|
|
1263
|
-
*
|
|
1264
|
-
* const formData = convertToFormData<MyInput>({
|
|
1265
|
-
* model: 'gpt-image-1',
|
|
1266
|
-
* prompt: 'A cat',
|
|
1267
|
-
* images: [blob1, blob2],
|
|
1268
|
-
* });
|
|
1269
|
-
* ```
|
|
1270
|
-
*/
|
|
1271
|
-
declare function convertToFormData_2<T extends Record<string, unknown>>(input: T, options?: {
|
|
1272
|
-
useArrayBrackets?: boolean;
|
|
1273
|
-
}): FormData;
|
|
1274
|
-
|
|
1275
1068
|
/**
|
|
1276
1069
|
* Converts an array of UI messages from useChat into an array of ModelMessages that can be used
|
|
1277
1070
|
* with the AI functions (e.g. `streamText`, `generateText`).
|
|
@@ -1291,8 +1084,6 @@ export declare function convertToModelMessages<UI_MESSAGE extends UIMessage>(mes
|
|
|
1291
1084
|
|
|
1292
1085
|
declare function convertUint8ArrayToBase64(array: Uint8Array): string;
|
|
1293
1086
|
|
|
1294
|
-
declare function convertUint8ArrayToBase64_2(array: Uint8Array): string;
|
|
1295
|
-
|
|
1296
1087
|
/**
|
|
1297
1088
|
* Calculates the cosine similarity between two vectors. This is a useful metric for
|
|
1298
1089
|
* comparing the similarity of two vectors such as embeddings.
|
|
@@ -1358,8 +1149,6 @@ export declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS
|
|
|
1358
1149
|
|
|
1359
1150
|
declare const createBinaryResponseHandler: () => ResponseHandler<Uint8Array>;
|
|
1360
1151
|
|
|
1361
|
-
declare const createBinaryResponseHandler_2: () => ResponseHandler_2<Uint8Array>;
|
|
1362
|
-
|
|
1363
1152
|
/**
|
|
1364
1153
|
* Creates a download function with configurable options.
|
|
1365
1154
|
*
|
|
@@ -1377,9 +1166,7 @@ export declare function createDownload(options?: {
|
|
|
1377
1166
|
mediaType: string | undefined;
|
|
1378
1167
|
}>;
|
|
1379
1168
|
|
|
1380
|
-
declare const createEventSourceResponseHandler: <T>(chunkSchema:
|
|
1381
|
-
|
|
1382
|
-
declare const createEventSourceResponseHandler_2: <T>(chunkSchema: FlexibleSchema<T>) => ResponseHandler_2<ReadableStream<ParseResult_2<T>>>;
|
|
1169
|
+
declare const createEventSourceResponseHandler: <T>(chunkSchema: FlexibleSchema<T>) => ResponseHandler<ReadableStream<ParseResult<T>>>;
|
|
1383
1170
|
|
|
1384
1171
|
/**
|
|
1385
1172
|
* Create a remote provider instance.
|
|
@@ -1403,38 +1190,13 @@ export declare const createIdGenerator: ({ prefix, size, alphabet, separator, }?
|
|
|
1403
1190
|
alphabet?: string;
|
|
1404
1191
|
}) => IdGenerator;
|
|
1405
1192
|
|
|
1406
|
-
/**
|
|
1407
|
-
* Creates an ID generator.
|
|
1408
|
-
* The total length of the ID is the sum of the prefix, separator, and random part length.
|
|
1409
|
-
* Not cryptographically secure.
|
|
1410
|
-
*
|
|
1411
|
-
* @param alphabet - The alphabet to use for the ID. Default: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.
|
|
1412
|
-
* @param prefix - The prefix of the ID to generate. Optional.
|
|
1413
|
-
* @param separator - The separator between the prefix and the random part of the ID. Default: '-'.
|
|
1414
|
-
* @param size - The size of the random part of the ID to generate. Default: 16.
|
|
1415
|
-
*/
|
|
1416
|
-
declare const createIdGenerator_2: ({ prefix, size, alphabet, separator, }?: {
|
|
1417
|
-
prefix?: string;
|
|
1418
|
-
separator?: string;
|
|
1419
|
-
size?: number;
|
|
1420
|
-
alphabet?: string;
|
|
1421
|
-
}) => IdGenerator_2;
|
|
1422
|
-
|
|
1423
1193
|
declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage, isRetryable, }: {
|
|
1424
|
-
errorSchema: FlexibleSchema_2<T>;
|
|
1425
|
-
errorToMessage: (error: T) => string;
|
|
1426
|
-
isRetryable?: (response: Response, error?: T) => boolean;
|
|
1427
|
-
}) => ResponseHandler<APICallError>;
|
|
1428
|
-
|
|
1429
|
-
declare const createJsonErrorResponseHandler_2: <T>({ errorSchema, errorToMessage, isRetryable, }: {
|
|
1430
1194
|
errorSchema: FlexibleSchema<T>;
|
|
1431
1195
|
errorToMessage: (error: T) => string;
|
|
1432
1196
|
isRetryable?: (response: Response, error?: T) => boolean;
|
|
1433
|
-
}) =>
|
|
1434
|
-
|
|
1435
|
-
declare const createJsonResponseHandler: <T>(responseSchema: FlexibleSchema_2<T>) => ResponseHandler<T>;
|
|
1197
|
+
}) => ResponseHandler<APICallError>;
|
|
1436
1198
|
|
|
1437
|
-
declare const
|
|
1199
|
+
declare const createJsonResponseHandler: <T>(responseSchema: FlexibleSchema<T>) => ResponseHandler<T>;
|
|
1438
1200
|
|
|
1439
1201
|
/**
|
|
1440
1202
|
* Creates a registry for the given providers with optional middleware functionality.
|
|
@@ -1456,33 +1218,11 @@ export declare function createProviderRegistry<PROVIDERS extends Record<string,
|
|
|
1456
1218
|
}): ProviderRegistryProvider<PROVIDERS, SEPARATOR>;
|
|
1457
1219
|
|
|
1458
1220
|
declare function createProviderToolFactory<INPUT, ARGS extends object>({ id, inputSchema, }: {
|
|
1459
|
-
id: `${string}.${string}`;
|
|
1460
|
-
inputSchema: FlexibleSchema_2<INPUT>;
|
|
1461
|
-
}): ProviderToolFactory<INPUT, ARGS>;
|
|
1462
|
-
|
|
1463
|
-
declare function createProviderToolFactory_2<INPUT, ARGS extends object>({ id, inputSchema, }: {
|
|
1464
1221
|
id: `${string}.${string}`;
|
|
1465
1222
|
inputSchema: FlexibleSchema<INPUT>;
|
|
1466
|
-
}):
|
|
1223
|
+
}): ProviderToolFactory<INPUT, ARGS>;
|
|
1467
1224
|
|
|
1468
1225
|
declare function createProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends object>({ id, inputSchema, outputSchema, supportsDeferredResults, }: {
|
|
1469
|
-
id: `${string}.${string}`;
|
|
1470
|
-
inputSchema: FlexibleSchema_2<INPUT>;
|
|
1471
|
-
outputSchema: FlexibleSchema_2<OUTPUT>;
|
|
1472
|
-
/**
|
|
1473
|
-
* Whether this provider-executed tool supports deferred results.
|
|
1474
|
-
*
|
|
1475
|
-
* When true, the tool result may not be returned in the same turn as the
|
|
1476
|
-
* tool call (e.g., when using programmatic tool calling where a server tool
|
|
1477
|
-
* triggers a client-executed tool, and the server tool's result is deferred
|
|
1478
|
-
* until the client tool is resolved).
|
|
1479
|
-
*
|
|
1480
|
-
* @default false
|
|
1481
|
-
*/
|
|
1482
|
-
supportsDeferredResults?: boolean;
|
|
1483
|
-
}): ProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS>;
|
|
1484
|
-
|
|
1485
|
-
declare function createProviderToolFactoryWithOutputSchema_2<INPUT, OUTPUT, ARGS extends object>({ id, inputSchema, outputSchema, supportsDeferredResults, }: {
|
|
1486
1226
|
id: `${string}.${string}`;
|
|
1487
1227
|
inputSchema: FlexibleSchema<INPUT>;
|
|
1488
1228
|
outputSchema: FlexibleSchema<OUTPUT>;
|
|
@@ -1497,12 +1237,10 @@ declare function createProviderToolFactoryWithOutputSchema_2<INPUT, OUTPUT, ARGS
|
|
|
1497
1237
|
* @default false
|
|
1498
1238
|
*/
|
|
1499
1239
|
supportsDeferredResults?: boolean;
|
|
1500
|
-
}):
|
|
1240
|
+
}): ProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS>;
|
|
1501
1241
|
|
|
1502
1242
|
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
|
|
1503
1243
|
|
|
1504
|
-
declare const createStatusCodeErrorResponseHandler_2: () => ResponseHandler_2<APICallError>;
|
|
1505
|
-
|
|
1506
1244
|
/**
|
|
1507
1245
|
* Creates a Response object from a text stream.
|
|
1508
1246
|
* Each text chunk is encoded as UTF-8 and sent as a separate chunk.
|
|
@@ -1539,26 +1277,6 @@ declare function createToolNameMapping({ tools, providerToolNames, resolveProvid
|
|
|
1539
1277
|
resolveProviderToolName?: (tool: LanguageModelV3ProviderTool) => string | undefined;
|
|
1540
1278
|
}): ToolNameMapping;
|
|
1541
1279
|
|
|
1542
|
-
/**
|
|
1543
|
-
* @param tools - Tools that were passed to the language model.
|
|
1544
|
-
* @param providerToolNames - Maps the provider tool ids to the provider tool names.
|
|
1545
|
-
*/
|
|
1546
|
-
declare function createToolNameMapping_2({ tools, providerToolNames, resolveProviderToolName, }: {
|
|
1547
|
-
/**
|
|
1548
|
-
* Tools that were passed to the language model.
|
|
1549
|
-
*/
|
|
1550
|
-
tools: Array<LanguageModelV3FunctionTool | LanguageModelV3ProviderTool> | undefined;
|
|
1551
|
-
/**
|
|
1552
|
-
* Maps the provider tool ids to the provider tool names.
|
|
1553
|
-
*/
|
|
1554
|
-
providerToolNames: Record<`${string}.${string}`, string>;
|
|
1555
|
-
/**
|
|
1556
|
-
* Optional resolver for provider tool names that cannot be represented as
|
|
1557
|
-
* static id -> name mappings (e.g. dynamic provider names).
|
|
1558
|
-
*/
|
|
1559
|
-
resolveProviderToolName?: (tool: LanguageModelV3ProviderTool) => string | undefined;
|
|
1560
|
-
}): ToolNameMapping_2;
|
|
1561
|
-
|
|
1562
1280
|
export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESSAGE, 'id' | 'role'> & {
|
|
1563
1281
|
id?: UI_MESSAGE['id'];
|
|
1564
1282
|
role?: UI_MESSAGE['role'];
|
|
@@ -1650,11 +1368,6 @@ export declare function customProvider<LANGUAGE_MODELS extends Record<string, La
|
|
|
1650
1368
|
*/
|
|
1651
1369
|
export declare type DataContent = string | Uint8Array | ArrayBuffer | Buffer;
|
|
1652
1370
|
|
|
1653
|
-
/**
|
|
1654
|
-
* Data content. Can either be a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer.
|
|
1655
|
-
*/
|
|
1656
|
-
declare type DataContent_2 = string | Uint8Array | ArrayBuffer | Buffer;
|
|
1657
|
-
|
|
1658
1371
|
declare type DataUIMessageChunk<DATA_TYPES extends UIDataTypes> = ValueOf<{
|
|
1659
1372
|
[NAME in keyof DATA_TYPES & string]: {
|
|
1660
1373
|
type: `data-${NAME}`;
|
|
@@ -1695,24 +1408,11 @@ declare type DeepPartialInternal<T> = T extends null | undefined | string | numb
|
|
|
1695
1408
|
* `DownloadError`.
|
|
1696
1409
|
*/
|
|
1697
1410
|
declare const DEFAULT_MAX_DOWNLOAD_SIZE: number;
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
* body internally, then creates the JS ArrayBuffer), so very large downloads
|
|
1704
|
-
* risk exceeding the default V8 heap limit on 64-bit systems and terminating
|
|
1705
|
-
* the process with an out-of-memory error.
|
|
1706
|
-
*
|
|
1707
|
-
* Setting this limit converts an unrecoverable OOM crash into a catchable
|
|
1708
|
-
* `DownloadError`.
|
|
1709
|
-
*/
|
|
1710
|
-
declare const DEFAULT_MAX_DOWNLOAD_SIZE_2: number;
|
|
1711
|
-
|
|
1712
|
-
export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends HttpChatTransport<UI_MESSAGE> {
|
|
1713
|
-
constructor(options?: HttpChatTransportInitOptions<UI_MESSAGE>);
|
|
1714
|
-
protected processResponseStream(stream: ReadableStream<Uint8Array<ArrayBufferLike>>): ReadableStream<UIMessageChunk>;
|
|
1715
|
-
}
|
|
1411
|
+
|
|
1412
|
+
export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends HttpChatTransport<UI_MESSAGE> {
|
|
1413
|
+
constructor(options?: HttpChatTransportInitOptions<UI_MESSAGE>);
|
|
1414
|
+
protected processResponseStream(stream: ReadableStream<Uint8Array<ArrayBufferLike>>): ReadableStream<UIMessageChunk>;
|
|
1415
|
+
}
|
|
1716
1416
|
|
|
1717
1417
|
/**
|
|
1718
1418
|
* Applies default settings for an embedding model.
|
|
@@ -1768,17 +1468,6 @@ declare function delay(delayInMs?: number | null, options?: {
|
|
|
1768
1468
|
abortSignal?: AbortSignal;
|
|
1769
1469
|
}): Promise<void>;
|
|
1770
1470
|
|
|
1771
|
-
/**
|
|
1772
|
-
* Creates a Promise that resolves after a specified delay
|
|
1773
|
-
* @param delayInMs - The delay duration in milliseconds. If null or undefined, resolves immediately.
|
|
1774
|
-
* @param signal - Optional AbortSignal to cancel the delay
|
|
1775
|
-
* @returns A Promise that resolves after the specified delay
|
|
1776
|
-
* @throws {DOMException} When the signal is aborted
|
|
1777
|
-
*/
|
|
1778
|
-
declare function delay_2(delayInMs?: number | null, options?: {
|
|
1779
|
-
abortSignal?: AbortSignal;
|
|
1780
|
-
}): Promise<void>;
|
|
1781
|
-
|
|
1782
1471
|
/**
|
|
1783
1472
|
* Delayed promise. It is only constructed once the value is accessed.
|
|
1784
1473
|
* This is useful to avoid unhandled promise rejections when the promise is created
|
|
@@ -1797,24 +1486,6 @@ declare class DelayedPromise<T> {
|
|
|
1797
1486
|
isPending(): boolean;
|
|
1798
1487
|
}
|
|
1799
1488
|
|
|
1800
|
-
/**
|
|
1801
|
-
* Delayed promise. It is only constructed once the value is accessed.
|
|
1802
|
-
* This is useful to avoid unhandled promise rejections when the promise is created
|
|
1803
|
-
* but not accessed.
|
|
1804
|
-
*/
|
|
1805
|
-
declare class DelayedPromise_2<T> {
|
|
1806
|
-
private status;
|
|
1807
|
-
private _promise;
|
|
1808
|
-
private _resolve;
|
|
1809
|
-
private _reject;
|
|
1810
|
-
get promise(): Promise<T>;
|
|
1811
|
-
resolve(value: T): void;
|
|
1812
|
-
reject(error: unknown): void;
|
|
1813
|
-
isResolved(): boolean;
|
|
1814
|
-
isRejected(): boolean;
|
|
1815
|
-
isPending(): boolean;
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
1489
|
/**
|
|
1819
1490
|
* A transport that directly communicates with an Agent in-process,
|
|
1820
1491
|
* without going through HTTP. This is useful for:
|
|
@@ -1878,22 +1549,6 @@ declare function downloadBlob(url: string, options?: {
|
|
|
1878
1549
|
abortSignal?: AbortSignal;
|
|
1879
1550
|
}): Promise<Blob>;
|
|
1880
1551
|
|
|
1881
|
-
/**
|
|
1882
|
-
* Download a file from a URL and return it as a Blob.
|
|
1883
|
-
*
|
|
1884
|
-
* @param url - The URL to download from.
|
|
1885
|
-
* @param options - Optional settings for the download.
|
|
1886
|
-
* @param options.maxBytes - Maximum allowed download size in bytes. Defaults to 100 MiB.
|
|
1887
|
-
* @param options.abortSignal - An optional abort signal to cancel the download.
|
|
1888
|
-
* @returns A Promise that resolves to the downloaded Blob.
|
|
1889
|
-
*
|
|
1890
|
-
* @throws DownloadError if the download fails or exceeds maxBytes.
|
|
1891
|
-
*/
|
|
1892
|
-
declare function downloadBlob_2(url: string, options?: {
|
|
1893
|
-
maxBytes?: number;
|
|
1894
|
-
abortSignal?: AbortSignal;
|
|
1895
|
-
}): Promise<Blob>;
|
|
1896
|
-
|
|
1897
1552
|
export declare class DownloadError extends AISDKError {
|
|
1898
1553
|
private readonly [symbol_2];
|
|
1899
1554
|
readonly url: string;
|
|
@@ -1909,66 +1564,16 @@ export declare class DownloadError extends AISDKError {
|
|
|
1909
1564
|
static isInstance(error: unknown): error is DownloadError;
|
|
1910
1565
|
}
|
|
1911
1566
|
|
|
1912
|
-
declare class DownloadError_2 extends AISDKError {
|
|
1913
|
-
private readonly [symbol];
|
|
1914
|
-
readonly url: string;
|
|
1915
|
-
readonly statusCode?: number;
|
|
1916
|
-
readonly statusText?: string;
|
|
1917
|
-
constructor({ url, statusCode, statusText, cause, message, }: {
|
|
1918
|
-
url: string;
|
|
1919
|
-
statusCode?: number;
|
|
1920
|
-
statusText?: string;
|
|
1921
|
-
message?: string;
|
|
1922
|
-
cause?: unknown;
|
|
1923
|
-
});
|
|
1924
|
-
static isInstance(error: unknown): error is DownloadError_2;
|
|
1925
|
-
}
|
|
1926
|
-
|
|
1927
1567
|
/**
|
|
1928
1568
|
* Defines a dynamic tool.
|
|
1929
1569
|
*/
|
|
1930
1570
|
export declare function dynamicTool(tool: {
|
|
1931
1571
|
description?: string;
|
|
1932
1572
|
title?: string;
|
|
1933
|
-
providerOptions?:
|
|
1573
|
+
providerOptions?: ProviderOptions;
|
|
1574
|
+
providerMetadata?: SharedV3ProviderMetadata;
|
|
1934
1575
|
inputSchema: FlexibleSchema<unknown>;
|
|
1935
1576
|
execute: ToolExecuteFunction<unknown, unknown>;
|
|
1936
|
-
/**
|
|
1937
|
-
* Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
1938
|
-
*
|
|
1939
|
-
* If not provided, the tool result will be sent as a JSON object.
|
|
1940
|
-
*/
|
|
1941
|
-
toModelOutput?: (options: {
|
|
1942
|
-
/**
|
|
1943
|
-
* The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
|
|
1944
|
-
*/
|
|
1945
|
-
toolCallId: string;
|
|
1946
|
-
/**
|
|
1947
|
-
* The input of the tool call.
|
|
1948
|
-
*/
|
|
1949
|
-
input: unknown;
|
|
1950
|
-
/**
|
|
1951
|
-
* The output of the tool call.
|
|
1952
|
-
*/
|
|
1953
|
-
output: unknown;
|
|
1954
|
-
}) => ToolResultOutput_2 | PromiseLike<ToolResultOutput_2>;
|
|
1955
|
-
/**
|
|
1956
|
-
* Whether the tool needs approval before it can be executed.
|
|
1957
|
-
*/
|
|
1958
|
-
needsApproval?: boolean | ToolNeedsApprovalFunction_2<unknown>;
|
|
1959
|
-
}): Tool<unknown, unknown> & {
|
|
1960
|
-
type: 'dynamic';
|
|
1961
|
-
};
|
|
1962
|
-
|
|
1963
|
-
/**
|
|
1964
|
-
* Defines a dynamic tool.
|
|
1965
|
-
*/
|
|
1966
|
-
declare function dynamicTool_2(tool: {
|
|
1967
|
-
description?: string;
|
|
1968
|
-
title?: string;
|
|
1969
|
-
providerOptions?: ProviderOptions;
|
|
1970
|
-
inputSchema: FlexibleSchema_2<unknown>;
|
|
1971
|
-
execute: ToolExecuteFunction_2<unknown, unknown>;
|
|
1972
1577
|
/**
|
|
1973
1578
|
* Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
1974
1579
|
*
|
|
@@ -1992,7 +1597,7 @@ declare function dynamicTool_2(tool: {
|
|
|
1992
1597
|
* Whether the tool needs approval before it can be executed.
|
|
1993
1598
|
*/
|
|
1994
1599
|
needsApproval?: boolean | ToolNeedsApprovalFunction<unknown>;
|
|
1995
|
-
}):
|
|
1600
|
+
}): Tool<unknown, unknown> & {
|
|
1996
1601
|
type: 'dynamic';
|
|
1997
1602
|
};
|
|
1998
1603
|
|
|
@@ -2094,6 +1699,7 @@ export declare type DynamicToolUIPart = {
|
|
|
2094
1699
|
output: unknown;
|
|
2095
1700
|
errorText?: never;
|
|
2096
1701
|
callProviderMetadata?: ProviderMetadata;
|
|
1702
|
+
resultProviderMetadata?: ProviderMetadata;
|
|
2097
1703
|
preliminary?: boolean;
|
|
2098
1704
|
approval?: {
|
|
2099
1705
|
id: string;
|
|
@@ -2106,6 +1712,7 @@ export declare type DynamicToolUIPart = {
|
|
|
2106
1712
|
output?: never;
|
|
2107
1713
|
errorText: string;
|
|
2108
1714
|
callProviderMetadata?: ProviderMetadata;
|
|
1715
|
+
resultProviderMetadata?: ProviderMetadata;
|
|
2109
1716
|
approval?: {
|
|
2110
1717
|
id: string;
|
|
2111
1718
|
approved: true;
|
|
@@ -2171,7 +1778,7 @@ export declare function embed({ model: modelArg, value, providerOptions, maxRetr
|
|
|
2171
1778
|
* to the provider from the AI SDK and enable provider-specific
|
|
2172
1779
|
* functionality that can be fully encapsulated in the provider.
|
|
2173
1780
|
*/
|
|
2174
|
-
providerOptions?:
|
|
1781
|
+
providerOptions?: ProviderOptions;
|
|
2175
1782
|
/**
|
|
2176
1783
|
* Optional telemetry configuration (experimental).
|
|
2177
1784
|
*/
|
|
@@ -2531,7 +2138,7 @@ export declare function embedMany({ model: modelArg, values, maxParallelCalls, m
|
|
|
2531
2138
|
* to the provider from the AI SDK and enable provider-specific
|
|
2532
2139
|
* functionality that can be fully encapsulated in the provider.
|
|
2533
2140
|
*/
|
|
2534
|
-
providerOptions?:
|
|
2141
|
+
providerOptions?: ProviderOptions;
|
|
2535
2142
|
/**
|
|
2536
2143
|
* Maximum number of concurrent requests.
|
|
2537
2144
|
*
|
|
@@ -2646,16 +2253,16 @@ declare interface EventSourceMessage {
|
|
|
2646
2253
|
* implementation in that browsers will default this to `message`, whereas this parser will
|
|
2647
2254
|
* leave this as `undefined` if not explicitly declared.
|
|
2648
2255
|
*/
|
|
2649
|
-
event?: string | undefined
|
|
2256
|
+
event?: string | undefined;
|
|
2650
2257
|
/**
|
|
2651
2258
|
* ID of the message, if any was provided by the server. Can be used by clients to keep the
|
|
2652
2259
|
* last received message ID in sync when reconnecting.
|
|
2653
2260
|
*/
|
|
2654
|
-
id?: string | undefined
|
|
2261
|
+
id?: string | undefined;
|
|
2655
2262
|
/**
|
|
2656
2263
|
* The data received for this message
|
|
2657
2264
|
*/
|
|
2658
|
-
data: string
|
|
2265
|
+
data: string;
|
|
2659
2266
|
}
|
|
2660
2267
|
|
|
2661
2268
|
/**
|
|
@@ -2679,8 +2286,11 @@ declare interface EventSourceMessage {
|
|
|
2679
2286
|
*
|
|
2680
2287
|
* @public
|
|
2681
2288
|
*/
|
|
2682
|
-
declare class EventSourceParserStream extends TransformStream<
|
|
2683
|
-
|
|
2289
|
+
declare class EventSourceParserStream extends TransformStream<
|
|
2290
|
+
string,
|
|
2291
|
+
EventSourceMessage
|
|
2292
|
+
> {
|
|
2293
|
+
constructor({ onError, onRetry, onComment }?: StreamOptions);
|
|
2684
2294
|
}
|
|
2685
2295
|
|
|
2686
2296
|
/**
|
|
@@ -2714,18 +2324,6 @@ declare interface ExceptionWithName {
|
|
|
2714
2324
|
}
|
|
2715
2325
|
|
|
2716
2326
|
declare function executeTool<INPUT, OUTPUT>({ execute, input, options, }: {
|
|
2717
|
-
execute: ToolExecuteFunction_2<INPUT, OUTPUT>;
|
|
2718
|
-
input: INPUT;
|
|
2719
|
-
options: ToolExecutionOptions_2;
|
|
2720
|
-
}): AsyncGenerator<{
|
|
2721
|
-
type: 'preliminary';
|
|
2722
|
-
output: OUTPUT;
|
|
2723
|
-
} | {
|
|
2724
|
-
type: 'final';
|
|
2725
|
-
output: OUTPUT;
|
|
2726
|
-
}>;
|
|
2727
|
-
|
|
2728
|
-
declare function executeTool_2<INPUT, OUTPUT>({ execute, input, options, }: {
|
|
2729
2327
|
execute: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
2730
2328
|
input: INPUT;
|
|
2731
2329
|
options: ToolExecutionOptions;
|
|
@@ -2842,7 +2440,7 @@ export declare function experimental_generateSpeech({ model, text, voice, output
|
|
|
2842
2440
|
* }
|
|
2843
2441
|
* ```
|
|
2844
2442
|
*/
|
|
2845
|
-
providerOptions?:
|
|
2443
|
+
providerOptions?: ProviderOptions;
|
|
2846
2444
|
/**
|
|
2847
2445
|
* Maximum number of retries per speech model call. Set to 0 to disable retries.
|
|
2848
2446
|
*
|
|
@@ -2901,7 +2499,7 @@ export declare function experimental_generateVideo({ model: modelArg, prompt: pr
|
|
|
2901
2499
|
* Additional provider-specific options that are passed through to the provider
|
|
2902
2500
|
* as body parameters.
|
|
2903
2501
|
*/
|
|
2904
|
-
providerOptions?:
|
|
2502
|
+
providerOptions?: ProviderOptions;
|
|
2905
2503
|
/**
|
|
2906
2504
|
* Maximum number of retries per video model call. Set to 0 to disable retries.
|
|
2907
2505
|
*
|
|
@@ -2978,7 +2576,7 @@ export declare function experimental_transcribe({ model, audio, providerOptions,
|
|
|
2978
2576
|
* }
|
|
2979
2577
|
* ```
|
|
2980
2578
|
*/
|
|
2981
|
-
providerOptions?:
|
|
2579
|
+
providerOptions?: ProviderOptions;
|
|
2982
2580
|
/**
|
|
2983
2581
|
* Maximum number of retries per transcript model call. Set to 0 to disable retries.
|
|
2984
2582
|
*
|
|
@@ -3108,26 +2706,11 @@ declare function extractResponseHeaders(response: Response): {
|
|
|
3108
2706
|
[k: string]: string;
|
|
3109
2707
|
};
|
|
3110
2708
|
|
|
3111
|
-
/**
|
|
3112
|
-
* Extracts the headers from a response object and returns them as a key-value object.
|
|
3113
|
-
*
|
|
3114
|
-
* @param response - The response object to extract headers from.
|
|
3115
|
-
* @returns The headers as a key-value object.
|
|
3116
|
-
*/
|
|
3117
|
-
declare function extractResponseHeaders_2(response: Response): {
|
|
3118
|
-
[k: string]: string;
|
|
3119
|
-
};
|
|
3120
|
-
|
|
3121
2709
|
/**
|
|
3122
2710
|
* Fetch function type (standardizes the version of fetch used).
|
|
3123
2711
|
*/
|
|
3124
2712
|
declare type FetchFunction = typeof globalThis.fetch;
|
|
3125
2713
|
|
|
3126
|
-
/**
|
|
3127
|
-
* Fetch function type (standardizes the version of fetch used).
|
|
3128
|
-
*/
|
|
3129
|
-
declare type FetchFunction_2 = typeof globalThis.fetch;
|
|
3130
|
-
|
|
3131
2714
|
/**
|
|
3132
2715
|
* File content part of a prompt. It contains a file.
|
|
3133
2716
|
*/
|
|
@@ -3150,36 +2733,6 @@ export declare interface FilePart {
|
|
|
3150
2733
|
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
3151
2734
|
*/
|
|
3152
2735
|
mediaType: string;
|
|
3153
|
-
/**
|
|
3154
|
-
* Additional provider-specific metadata. They are passed through
|
|
3155
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
3156
|
-
* functionality that can be fully encapsulated in the provider.
|
|
3157
|
-
*/
|
|
3158
|
-
providerOptions?: ProviderOptions_2;
|
|
3159
|
-
}
|
|
3160
|
-
|
|
3161
|
-
/**
|
|
3162
|
-
* File content part of a prompt. It contains a file.
|
|
3163
|
-
*/
|
|
3164
|
-
declare interface FilePart_2 {
|
|
3165
|
-
type: 'file';
|
|
3166
|
-
/**
|
|
3167
|
-
* File data. Can either be:
|
|
3168
|
-
*
|
|
3169
|
-
* - data: a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer
|
|
3170
|
-
* - URL: a URL that points to the image
|
|
3171
|
-
*/
|
|
3172
|
-
data: DataContent_2 | URL;
|
|
3173
|
-
/**
|
|
3174
|
-
* Optional filename of the file.
|
|
3175
|
-
*/
|
|
3176
|
-
filename?: string;
|
|
3177
|
-
/**
|
|
3178
|
-
* IANA media type of the file.
|
|
3179
|
-
*
|
|
3180
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
3181
|
-
*/
|
|
3182
|
-
mediaType: string;
|
|
3183
2736
|
/**
|
|
3184
2737
|
* Additional provider-specific metadata. They are passed through
|
|
3185
2738
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -3227,9 +2780,7 @@ export declare type FileUIPart = {
|
|
|
3227
2780
|
*/
|
|
3228
2781
|
export declare type FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
|
|
3229
2782
|
|
|
3230
|
-
export declare type FlexibleSchema<SCHEMA = any> = Schema<SCHEMA> |
|
|
3231
|
-
|
|
3232
|
-
declare type FlexibleSchema_2<SCHEMA = any> = Schema_2<SCHEMA> | LazySchema<SCHEMA> | ZodSchema<SCHEMA> | StandardSchema<SCHEMA>;
|
|
2783
|
+
export declare type FlexibleSchema<SCHEMA = any> = Schema<SCHEMA> | LazySchema<SCHEMA> | ZodSchema<SCHEMA> | StandardSchema<SCHEMA>;
|
|
3233
2784
|
|
|
3234
2785
|
export declare const gateway: GatewayProvider;
|
|
3235
2786
|
|
|
@@ -3240,13 +2791,57 @@ declare interface GatewayCreditsResponse {
|
|
|
3240
2791
|
totalUsed: string;
|
|
3241
2792
|
}
|
|
3242
2793
|
|
|
3243
|
-
declare type GatewayEmbeddingModelId = 'alibaba/qwen3-embedding-0.6b' | 'alibaba/qwen3-embedding-4b' | 'alibaba/qwen3-embedding-8b' | 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-4' | 'voyage/voyage-4-large' | 'voyage/voyage-4-lite' | 'voyage/voyage-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
|
|
2794
|
+
declare type GatewayEmbeddingModelId = 'alibaba/qwen3-embedding-0.6b' | 'alibaba/qwen3-embedding-4b' | 'alibaba/qwen3-embedding-8b' | 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/gemini-embedding-2' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-4' | 'voyage/voyage-4-large' | 'voyage/voyage-4-lite' | 'voyage/voyage-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
|
|
3244
2795
|
|
|
3245
2796
|
declare interface GatewayFetchMetadataResponse {
|
|
3246
2797
|
models: GatewayLanguageModelEntry[];
|
|
3247
2798
|
}
|
|
3248
2799
|
|
|
3249
|
-
declare
|
|
2800
|
+
declare interface GatewayGenerationInfo {
|
|
2801
|
+
/** The generation ID */
|
|
2802
|
+
id: string;
|
|
2803
|
+
/** Total cost in USD */
|
|
2804
|
+
totalCost: number;
|
|
2805
|
+
/** Upstream inference cost in USD (BYOK only) */
|
|
2806
|
+
upstreamInferenceCost: number;
|
|
2807
|
+
/** Usage cost in USD (same as totalCost) */
|
|
2808
|
+
usage: number;
|
|
2809
|
+
/** ISO 8601 timestamp when the generation was created */
|
|
2810
|
+
createdAt: string;
|
|
2811
|
+
/** Model identifier */
|
|
2812
|
+
model: string;
|
|
2813
|
+
/** Whether BYOK credentials were used */
|
|
2814
|
+
isByok: boolean;
|
|
2815
|
+
/** Provider that served this generation */
|
|
2816
|
+
providerName: string;
|
|
2817
|
+
/** Whether streaming was used */
|
|
2818
|
+
streamed: boolean;
|
|
2819
|
+
/** Finish reason (e.g. 'stop') */
|
|
2820
|
+
finishReason: string;
|
|
2821
|
+
/** Time to first token in milliseconds */
|
|
2822
|
+
latency: number;
|
|
2823
|
+
/** Total generation time in milliseconds */
|
|
2824
|
+
generationTime: number;
|
|
2825
|
+
/** Number of prompt tokens */
|
|
2826
|
+
promptTokens: number;
|
|
2827
|
+
/** Number of completion tokens */
|
|
2828
|
+
completionTokens: number;
|
|
2829
|
+
/** Reasoning tokens used */
|
|
2830
|
+
reasoningTokens: number;
|
|
2831
|
+
/** Cached tokens used */
|
|
2832
|
+
cachedTokens: number;
|
|
2833
|
+
/** Cache creation input tokens */
|
|
2834
|
+
cacheCreationTokens: number;
|
|
2835
|
+
/** Billable web search calls */
|
|
2836
|
+
billableWebSearchCalls: number;
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2839
|
+
declare interface GatewayGenerationInfoParams {
|
|
2840
|
+
/** The generation ID to look up (format: gen_<ulid>) */
|
|
2841
|
+
id: string;
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2844
|
+
declare type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'prodia/flux-fast-schnell' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'xai/grok-imagine-image' | 'xai/grok-imagine-image-pro' | (string & {});
|
|
3250
2845
|
|
|
3251
2846
|
declare interface GatewayLanguageModelEntry {
|
|
3252
2847
|
/**
|
|
@@ -3292,12 +2887,12 @@ declare interface GatewayLanguageModelEntry {
|
|
|
3292
2887
|
/**
|
|
3293
2888
|
* Optional field to differentiate between model types.
|
|
3294
2889
|
*/
|
|
3295
|
-
modelType?:
|
|
2890
|
+
modelType?: KnownModelType | null;
|
|
3296
2891
|
}
|
|
3297
2892
|
|
|
3298
2893
|
declare type GatewayLanguageModelSpecification = Pick<LanguageModelV3, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
3299
2894
|
|
|
3300
|
-
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | '
|
|
2895
|
+
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.7-sonnet' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'arcee-ai/trinity-large-preview' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking-2601' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'xai/grok-3' | 'xai/grok-3-fast' | 'xai/grok-3-mini' | 'xai/grok-3-mini-fast' | 'xai/grok-4' | 'xai/grok-4-fast-non-reasoning' | 'xai/grok-4-fast-reasoning' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-code-fast-1' | 'xiaomi/mimo-v2-flash' | 'xiaomi/mimo-v2-pro' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5v-turbo' | (string & {});
|
|
3301
2896
|
|
|
3302
2897
|
declare interface GatewayProvider extends ProviderV3 {
|
|
3303
2898
|
(modelId: GatewayModelId): LanguageModelV3;
|
|
@@ -3317,6 +2912,16 @@ declare interface GatewayProvider extends ProviderV3 {
|
|
|
3317
2912
|
* Returns credit information for the authenticated user.
|
|
3318
2913
|
*/
|
|
3319
2914
|
getCredits(): Promise<GatewayCreditsResponse>;
|
|
2915
|
+
/**
|
|
2916
|
+
* Returns a spend report with cost, token, and request count data,
|
|
2917
|
+
* aggregated by the specified dimension.
|
|
2918
|
+
*/
|
|
2919
|
+
getSpendReport(params: GatewaySpendReportParams): Promise<GatewaySpendReportResponse>;
|
|
2920
|
+
/**
|
|
2921
|
+
* Returns detailed information about a specific generation by its ID,
|
|
2922
|
+
* including cost, token usage, latency, and provider details.
|
|
2923
|
+
*/
|
|
2924
|
+
getGenerationInfo(params: GatewayGenerationInfoParams): Promise<GatewayGenerationInfo>;
|
|
3320
2925
|
/**
|
|
3321
2926
|
* Creates a model for generating text embeddings.
|
|
3322
2927
|
*/
|
|
@@ -3345,6 +2950,14 @@ declare interface GatewayProvider extends ProviderV3 {
|
|
|
3345
2950
|
* Creates a model for generating videos.
|
|
3346
2951
|
*/
|
|
3347
2952
|
videoModel(modelId: GatewayVideoModelId): VideoModelV3;
|
|
2953
|
+
/**
|
|
2954
|
+
* Creates a model for reranking documents.
|
|
2955
|
+
*/
|
|
2956
|
+
reranking(modelId: GatewayRerankingModelId): RerankingModelV3;
|
|
2957
|
+
/**
|
|
2958
|
+
* Creates a model for reranking documents.
|
|
2959
|
+
*/
|
|
2960
|
+
rerankingModel(modelId: GatewayRerankingModelId): RerankingModelV3;
|
|
3348
2961
|
/**
|
|
3349
2962
|
* Gateway-specific tools executed server-side.
|
|
3350
2963
|
*/
|
|
@@ -3375,6 +2988,66 @@ declare interface GatewayProviderSettings {
|
|
|
3375
2988
|
metadataCacheRefreshMillis?: number;
|
|
3376
2989
|
}
|
|
3377
2990
|
|
|
2991
|
+
declare type GatewayRerankingModelId = 'cohere/rerank-v3.5' | 'cohere/rerank-v4-fast' | 'cohere/rerank-v4-pro' | 'voyage/rerank-2.5' | 'voyage/rerank-2.5-lite' | (string & {});
|
|
2992
|
+
|
|
2993
|
+
declare interface GatewaySpendReportParams {
|
|
2994
|
+
/** Start date in YYYY-MM-DD format (inclusive) */
|
|
2995
|
+
startDate: string;
|
|
2996
|
+
/** End date in YYYY-MM-DD format (inclusive) */
|
|
2997
|
+
endDate: string;
|
|
2998
|
+
/** Primary aggregation dimension. Defaults to 'day'. */
|
|
2999
|
+
groupBy?: 'day' | 'user' | 'model' | 'tag' | 'provider' | 'credential_type';
|
|
3000
|
+
/** Time granularity when groupBy is 'day'. */
|
|
3001
|
+
datePart?: 'day' | 'hour';
|
|
3002
|
+
/** Filter to a specific user's spend. */
|
|
3003
|
+
userId?: string;
|
|
3004
|
+
/** Filter to a specific model (e.g. 'anthropic/claude-sonnet-4.5'). */
|
|
3005
|
+
model?: string;
|
|
3006
|
+
/** Filter to a specific provider (e.g. 'anthropic'). */
|
|
3007
|
+
provider?: string;
|
|
3008
|
+
/** Filter to BYOK or system credentials. */
|
|
3009
|
+
credentialType?: 'byok' | 'system';
|
|
3010
|
+
/** Filter to requests with these tags. */
|
|
3011
|
+
tags?: string[];
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
declare interface GatewaySpendReportResponse {
|
|
3015
|
+
results: GatewaySpendReportRow[];
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
declare interface GatewaySpendReportRow {
|
|
3019
|
+
/** Date string (present when groupBy is 'day') */
|
|
3020
|
+
day?: string;
|
|
3021
|
+
/** Hour timestamp (present when groupBy is 'day' and datePart is 'hour') */
|
|
3022
|
+
hour?: string;
|
|
3023
|
+
/** User identifier (present when groupBy is 'user') */
|
|
3024
|
+
user?: string;
|
|
3025
|
+
/** Model identifier (present when groupBy is 'model') */
|
|
3026
|
+
model?: string;
|
|
3027
|
+
/** Tag value (present when groupBy is 'tag') */
|
|
3028
|
+
tag?: string;
|
|
3029
|
+
/** Provider name (present when groupBy is 'provider') */
|
|
3030
|
+
provider?: string;
|
|
3031
|
+
/** Credential type (present when groupBy is 'credential_type') */
|
|
3032
|
+
credentialType?: 'byok' | 'system';
|
|
3033
|
+
/** Total cost in USD */
|
|
3034
|
+
totalCost: number;
|
|
3035
|
+
/** Market cost in USD */
|
|
3036
|
+
marketCost?: number;
|
|
3037
|
+
/** Number of input tokens */
|
|
3038
|
+
inputTokens?: number;
|
|
3039
|
+
/** Number of output tokens */
|
|
3040
|
+
outputTokens?: number;
|
|
3041
|
+
/** Number of cached input tokens */
|
|
3042
|
+
cachedInputTokens?: number;
|
|
3043
|
+
/** Number of cache creation input tokens */
|
|
3044
|
+
cacheCreationInputTokens?: number;
|
|
3045
|
+
/** Number of reasoning tokens */
|
|
3046
|
+
reasoningTokens?: number;
|
|
3047
|
+
/** Number of requests */
|
|
3048
|
+
requestCount?: number;
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3378
3051
|
/**
|
|
3379
3052
|
* Gateway-specific provider-defined tools.
|
|
3380
3053
|
*/
|
|
@@ -3398,7 +3071,7 @@ declare const gatewayTools: {
|
|
|
3398
3071
|
perplexitySearch: (config?: PerplexitySearchConfig) => ReturnType<typeof perplexitySearchToolFactory>;
|
|
3399
3072
|
};
|
|
3400
3073
|
|
|
3401
|
-
declare type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'bytedance/seedance-v1.0-lite-i2v' | 'bytedance/seedance-v1.0-lite-t2v' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-t2v' | 'xai/grok-imagine-video' | (string & {});
|
|
3074
|
+
declare type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'bytedance/seedance-2.0' | 'bytedance/seedance-2.0-fast' | 'bytedance/seedance-v1.0-lite-i2v' | 'bytedance/seedance-v1.0-lite-t2v' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-t2v' | 'xai/grok-imagine-video' | (string & {});
|
|
3402
3075
|
|
|
3403
3076
|
/**
|
|
3404
3077
|
* A generated audio file.
|
|
@@ -3438,12 +3111,6 @@ export { GeneratedFile }
|
|
|
3438
3111
|
*/
|
|
3439
3112
|
export declare const generateId: IdGenerator;
|
|
3440
3113
|
|
|
3441
|
-
/**
|
|
3442
|
-
* Generates a 16-character random string to use for IDs.
|
|
3443
|
-
* Not cryptographically secure.
|
|
3444
|
-
*/
|
|
3445
|
-
declare const generateId_2: IdGenerator_2;
|
|
3446
|
-
|
|
3447
3114
|
/**
|
|
3448
3115
|
* Generates images using an image model.
|
|
3449
3116
|
*
|
|
@@ -3505,7 +3172,7 @@ export declare function generateImage({ model: modelArg, prompt: promptArg, n, m
|
|
|
3505
3172
|
* }
|
|
3506
3173
|
* ```
|
|
3507
3174
|
*/
|
|
3508
|
-
providerOptions?:
|
|
3175
|
+
providerOptions?: ProviderOptions;
|
|
3509
3176
|
/**
|
|
3510
3177
|
* Maximum number of retries per image model call. Set to 0 to disable retries.
|
|
3511
3178
|
*
|
|
@@ -3571,6 +3238,7 @@ export declare interface GenerateImageResult {
|
|
|
3571
3238
|
* @param system - A system message that will be part of the prompt.
|
|
3572
3239
|
* @param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
|
|
3573
3240
|
* @param messages - A list of messages. You can either use `prompt` or `messages` but not both.
|
|
3241
|
+
* @param allowSystemInMessages - Whether system messages are allowed in the `prompt` or `messages` fields. When unset, system messages are allowed with a warning.
|
|
3574
3242
|
*
|
|
3575
3243
|
* @param maxOutputTokens - Maximum number of tokens to generate.
|
|
3576
3244
|
* @param temperature - Temperature setting.
|
|
@@ -3675,7 +3343,7 @@ export declare function generateObject<SCHEMA extends FlexibleSchema<unknown> =
|
|
|
3675
3343
|
* to the provider from the AI SDK and enable provider-specific
|
|
3676
3344
|
* functionality that can be fully encapsulated in the provider.
|
|
3677
3345
|
*/
|
|
3678
|
-
providerOptions?:
|
|
3346
|
+
providerOptions?: ProviderOptions;
|
|
3679
3347
|
/**
|
|
3680
3348
|
* Internal. For test use only. May change without notice.
|
|
3681
3349
|
*/
|
|
@@ -3749,6 +3417,7 @@ export declare interface GenerateObjectResult<OBJECT> {
|
|
|
3749
3417
|
* @param system - A system message that will be part of the prompt.
|
|
3750
3418
|
* @param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
|
|
3751
3419
|
* @param messages - A list of messages. You can either use `prompt` or `messages` but not both.
|
|
3420
|
+
* @param allowSystemInMessages - Whether system messages are allowed in the `prompt` or `messages` fields. When unset, system messages are allowed with a warning.
|
|
3752
3421
|
*
|
|
3753
3422
|
* @param maxOutputTokens - Maximum number of tokens to generate.
|
|
3754
3423
|
* @param temperature - Temperature setting.
|
|
@@ -3790,7 +3459,7 @@ export declare interface GenerateObjectResult<OBJECT> {
|
|
|
3790
3459
|
* @returns
|
|
3791
3460
|
* A result object that contains the generated text, the results of the tool calls, and additional information.
|
|
3792
3461
|
*/
|
|
3793
|
-
export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string>>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, experimental_include: include, _internal: { generateId }, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
|
|
3462
|
+
export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string>>({ model: modelArg, tools, toolChoice, system, prompt, messages, allowSystemInMessages, maxRetries: maxRetriesArg, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, experimental_include: include, _internal: { generateId }, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
|
|
3794
3463
|
/**
|
|
3795
3464
|
* The language model to use.
|
|
3796
3465
|
*/
|
|
@@ -3819,7 +3488,7 @@ export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Outpu
|
|
|
3819
3488
|
* to the provider from the AI SDK and enable provider-specific
|
|
3820
3489
|
* functionality that can be fully encapsulated in the provider.
|
|
3821
3490
|
*/
|
|
3822
|
-
providerOptions?:
|
|
3491
|
+
providerOptions?: ProviderOptions;
|
|
3823
3492
|
/**
|
|
3824
3493
|
* @deprecated Use `activeTools` instead.
|
|
3825
3494
|
*/
|
|
@@ -4154,8 +3823,6 @@ declare function getErrorMessage(error: unknown | undefined): string;
|
|
|
4154
3823
|
|
|
4155
3824
|
declare function getErrorMessage_2(error: unknown | undefined): string;
|
|
4156
3825
|
|
|
4157
|
-
declare function getErrorMessage_3(error: unknown | undefined): string;
|
|
4158
|
-
|
|
4159
3826
|
declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
4160
3827
|
url: string;
|
|
4161
3828
|
headers?: Record<string, string | undefined>;
|
|
@@ -4169,19 +3836,6 @@ declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedR
|
|
|
4169
3836
|
responseHeaders?: Record<string, string>;
|
|
4170
3837
|
}>;
|
|
4171
3838
|
|
|
4172
|
-
declare const getFromApi_2: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
4173
|
-
url: string;
|
|
4174
|
-
headers?: Record<string, string | undefined>;
|
|
4175
|
-
failedResponseHandler: ResponseHandler_2<Error>;
|
|
4176
|
-
successfulResponseHandler: ResponseHandler_2<T>;
|
|
4177
|
-
abortSignal?: AbortSignal;
|
|
4178
|
-
fetch?: FetchFunction_2;
|
|
4179
|
-
}) => Promise<{
|
|
4180
|
-
value: T;
|
|
4181
|
-
rawValue?: unknown;
|
|
4182
|
-
responseHeaders?: Record<string, string>;
|
|
4183
|
-
}>;
|
|
4184
|
-
|
|
4185
3839
|
declare type GetMaxImagesPerCallFunction$1 = (options: {
|
|
4186
3840
|
modelId: string;
|
|
4187
3841
|
}) => PromiseLike<number | undefined> | number | undefined;
|
|
@@ -4198,8 +3852,6 @@ declare const getOriginalFetch: () => typeof fetch;
|
|
|
4198
3852
|
|
|
4199
3853
|
declare function getRuntimeEnvironmentUserAgent(globalThisAny?: any): string;
|
|
4200
3854
|
|
|
4201
|
-
declare function getRuntimeEnvironmentUserAgent_2(globalThisAny?: any): string;
|
|
4202
|
-
|
|
4203
3855
|
/**
|
|
4204
3856
|
* Returns the name of the static tool.
|
|
4205
3857
|
*
|
|
@@ -4256,7 +3908,7 @@ export declare abstract class HttpChatTransport<UI_MESSAGE extends UIMessage> im
|
|
|
4256
3908
|
protected credentials: HttpChatTransportInitOptions<UI_MESSAGE>['credentials'];
|
|
4257
3909
|
protected headers: HttpChatTransportInitOptions<UI_MESSAGE>['headers'];
|
|
4258
3910
|
protected body: HttpChatTransportInitOptions<UI_MESSAGE>['body'];
|
|
4259
|
-
protected fetch?:
|
|
3911
|
+
protected fetch?: FetchFunction;
|
|
4260
3912
|
protected prepareSendMessagesRequest?: PrepareSendMessagesRequest<UI_MESSAGE>;
|
|
4261
3913
|
protected prepareReconnectToStreamRequest?: PrepareReconnectToStreamRequest;
|
|
4262
3914
|
constructor({ api, credentials, headers, body, fetch, prepareSendMessagesRequest, prepareReconnectToStreamRequest, }: HttpChatTransportInitOptions<UI_MESSAGE>);
|
|
@@ -4281,11 +3933,11 @@ export declare type HttpChatTransportInitOptions<UI_MESSAGE extends UIMessage> =
|
|
|
4281
3933
|
* Possible values are: 'omit', 'same-origin', 'include'.
|
|
4282
3934
|
* Defaults to 'same-origin'.
|
|
4283
3935
|
*/
|
|
4284
|
-
credentials?:
|
|
3936
|
+
credentials?: Resolvable<RequestCredentials>;
|
|
4285
3937
|
/**
|
|
4286
3938
|
* HTTP headers to be sent with the API request.
|
|
4287
3939
|
*/
|
|
4288
|
-
headers?:
|
|
3940
|
+
headers?: Resolvable<Record<string, string> | Headers>;
|
|
4289
3941
|
/**
|
|
4290
3942
|
* Extra body object to be sent with the API request.
|
|
4291
3943
|
* @example
|
|
@@ -4298,12 +3950,12 @@ export declare type HttpChatTransportInitOptions<UI_MESSAGE extends UIMessage> =
|
|
|
4298
3950
|
* })
|
|
4299
3951
|
* ```
|
|
4300
3952
|
*/
|
|
4301
|
-
body?:
|
|
3953
|
+
body?: Resolvable<object>;
|
|
4302
3954
|
/**
|
|
4303
3955
|
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
4304
3956
|
* or to provide a custom fetch implementation for e.g. testing.
|
|
4305
3957
|
*/
|
|
4306
|
-
fetch?:
|
|
3958
|
+
fetch?: FetchFunction;
|
|
4307
3959
|
/**
|
|
4308
3960
|
* When a function is provided, it will be used
|
|
4309
3961
|
* to prepare the request body for the chat API. This can be useful for
|
|
@@ -4323,11 +3975,6 @@ export declare type HttpChatTransportInitOptions<UI_MESSAGE extends UIMessage> =
|
|
|
4323
3975
|
*/
|
|
4324
3976
|
export declare type IdGenerator = () => string;
|
|
4325
3977
|
|
|
4326
|
-
/**
|
|
4327
|
-
* A function that generates an ID.
|
|
4328
|
-
*/
|
|
4329
|
-
declare type IdGenerator_2 = () => string;
|
|
4330
|
-
|
|
4331
3978
|
/**
|
|
4332
3979
|
* Image model that is used by the AI SDK.
|
|
4333
3980
|
*/
|
|
@@ -4792,32 +4439,6 @@ export declare interface ImagePart {
|
|
|
4792
4439
|
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4793
4440
|
*/
|
|
4794
4441
|
mediaType?: string;
|
|
4795
|
-
/**
|
|
4796
|
-
* Additional provider-specific metadata. They are passed through
|
|
4797
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
4798
|
-
* functionality that can be fully encapsulated in the provider.
|
|
4799
|
-
*/
|
|
4800
|
-
providerOptions?: ProviderOptions_2;
|
|
4801
|
-
}
|
|
4802
|
-
|
|
4803
|
-
/**
|
|
4804
|
-
* Image content part of a prompt. It contains an image.
|
|
4805
|
-
*/
|
|
4806
|
-
declare interface ImagePart_2 {
|
|
4807
|
-
type: 'image';
|
|
4808
|
-
/**
|
|
4809
|
-
* Image data. Can either be:
|
|
4810
|
-
*
|
|
4811
|
-
* - data: a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer
|
|
4812
|
-
* - URL: a URL that points to the image
|
|
4813
|
-
*/
|
|
4814
|
-
image: DataContent_2 | URL;
|
|
4815
|
-
/**
|
|
4816
|
-
* Optional IANA media type of the image.
|
|
4817
|
-
*
|
|
4818
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4819
|
-
*/
|
|
4820
|
-
mediaType?: string;
|
|
4821
4442
|
/**
|
|
4822
4443
|
* Additional provider-specific metadata. They are passed through
|
|
4823
4444
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -4848,9 +4469,7 @@ declare type InferElementOutput<OUTPUT extends Output_2> = OUTPUT extends Output
|
|
|
4848
4469
|
*/
|
|
4849
4470
|
export declare type InferGenerateOutput<OUTPUT extends Output_2> = OUTPUT extends Output_2<infer COMPLETE_OUTPUT, any, any> ? COMPLETE_OUTPUT : never;
|
|
4850
4471
|
|
|
4851
|
-
export declare type InferSchema<SCHEMA> = SCHEMA extends
|
|
4852
|
-
|
|
4853
|
-
declare type InferSchema_2<SCHEMA> = SCHEMA extends ZodSchema<infer T> ? T : SCHEMA extends StandardSchema<infer T> ? T : SCHEMA extends LazySchema<infer T> ? T : SCHEMA extends Schema_2<infer T> ? T : never;
|
|
4472
|
+
export declare type InferSchema<SCHEMA> = SCHEMA extends ZodSchema<infer T> ? T : SCHEMA extends StandardSchema<infer T> ? T : SCHEMA extends LazySchema<infer T> ? T : SCHEMA extends Schema<infer T> ? T : never;
|
|
4854
4473
|
|
|
4855
4474
|
/**
|
|
4856
4475
|
* Infers the partial output type from the output specification.
|
|
@@ -4862,21 +4481,11 @@ export declare type InferStreamOutput<OUTPUT extends Output_2> = OUTPUT extends
|
|
|
4862
4481
|
*/
|
|
4863
4482
|
export declare type InferToolInput<TOOL extends Tool> = TOOL extends Tool<infer INPUT, any> ? INPUT : never;
|
|
4864
4483
|
|
|
4865
|
-
/**
|
|
4866
|
-
* Infer the input type of a tool.
|
|
4867
|
-
*/
|
|
4868
|
-
declare type InferToolInput_2<TOOL extends Tool_2> = TOOL extends Tool_2<infer INPUT, any> ? INPUT : never;
|
|
4869
|
-
|
|
4870
4484
|
/**
|
|
4871
4485
|
* Infer the output type of a tool.
|
|
4872
4486
|
*/
|
|
4873
4487
|
export declare type InferToolOutput<TOOL extends Tool> = TOOL extends Tool<any, infer OUTPUT> ? OUTPUT : never;
|
|
4874
4488
|
|
|
4875
|
-
/**
|
|
4876
|
-
* Infer the output type of a tool.
|
|
4877
|
-
*/
|
|
4878
|
-
declare type InferToolOutput_2<TOOL extends Tool_2> = TOOL extends Tool_2<any, infer OUTPUT> ? OUTPUT : never;
|
|
4879
|
-
|
|
4880
4489
|
export declare type InferUIDataParts<T extends UIDataPartSchemas> = {
|
|
4881
4490
|
[K in keyof T]: InferSchema<T[K]>;
|
|
4882
4491
|
};
|
|
@@ -4888,12 +4497,12 @@ declare type InferUIMessageData<T extends UIMessage> = T extends UIMessage<unkno
|
|
|
4888
4497
|
declare type InferUIMessageMetadata<T extends UIMessage> = T extends UIMessage<infer METADATA> ? METADATA : unknown;
|
|
4889
4498
|
|
|
4890
4499
|
declare type InferUIMessageToolCall<UI_MESSAGE extends UIMessage> = ValueOf<{
|
|
4891
|
-
[NAME in keyof InferUIMessageTools<UI_MESSAGE>]:
|
|
4500
|
+
[NAME in keyof InferUIMessageTools<UI_MESSAGE>]: ToolCall<NAME & string, InferUIMessageTools<UI_MESSAGE>[NAME] extends {
|
|
4892
4501
|
input: infer INPUT;
|
|
4893
4502
|
} ? INPUT : never> & {
|
|
4894
4503
|
dynamic?: false;
|
|
4895
4504
|
};
|
|
4896
|
-
}> | (
|
|
4505
|
+
}> | (ToolCall<string, unknown> & {
|
|
4897
4506
|
dynamic: true;
|
|
4898
4507
|
});
|
|
4899
4508
|
|
|
@@ -4921,13 +4530,6 @@ declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPre
|
|
|
4921
4530
|
schemaSuffix?: string;
|
|
4922
4531
|
}): LanguageModelV3Prompt;
|
|
4923
4532
|
|
|
4924
|
-
declare function injectJsonInstructionIntoMessages_2({ messages, schema, schemaPrefix, schemaSuffix, }: {
|
|
4925
|
-
messages: LanguageModelV3Prompt;
|
|
4926
|
-
schema?: JSONSchema7;
|
|
4927
|
-
schemaPrefix?: string;
|
|
4928
|
-
schemaSuffix?: string;
|
|
4929
|
-
}): LanguageModelV3Prompt;
|
|
4930
|
-
|
|
4931
4533
|
export declare class InvalidArgumentError extends AISDKError {
|
|
4932
4534
|
private readonly [symbol$h];
|
|
4933
4535
|
readonly parameter: string;
|
|
@@ -5038,8 +4640,6 @@ export declare class InvalidToolInputError extends AISDKError {
|
|
|
5038
4640
|
|
|
5039
4641
|
declare function isAbortError(error: unknown): error is Error;
|
|
5040
4642
|
|
|
5041
|
-
declare function isAbortError_2(error: unknown): error is Error;
|
|
5042
|
-
|
|
5043
4643
|
/**
|
|
5044
4644
|
* Check if a message part is a data part.
|
|
5045
4645
|
*/
|
|
@@ -5065,14 +4665,7 @@ declare function isJSONObject(value: unknown): value is JSONObject;
|
|
|
5065
4665
|
|
|
5066
4666
|
declare function isJSONValue(value: unknown): value is JSONValue_2;
|
|
5067
4667
|
|
|
5068
|
-
|
|
5069
|
-
* Type guard that checks whether a value is not `null` or `undefined`.
|
|
5070
|
-
*
|
|
5071
|
-
* @template T - The type of the value to check.
|
|
5072
|
-
* @param value - The value to check.
|
|
5073
|
-
* @returns `true` if the value is neither `null` nor `undefined`, otherwise `false`.
|
|
5074
|
-
*/
|
|
5075
|
-
declare function isNonNullable<T>(value: T | undefined | null): value is NonNullable<T>;
|
|
4668
|
+
export declare function isLoopFinished(): StopCondition<any>;
|
|
5076
4669
|
|
|
5077
4670
|
/**
|
|
5078
4671
|
* Type guard that checks whether a value is not `null` or `undefined`.
|
|
@@ -5081,12 +4674,10 @@ declare function isNonNullable<T>(value: T | undefined | null): value is NonNull
|
|
|
5081
4674
|
* @param value - The value to check.
|
|
5082
4675
|
* @returns `true` if the value is neither `null` nor `undefined`, otherwise `false`.
|
|
5083
4676
|
*/
|
|
5084
|
-
declare function
|
|
4677
|
+
declare function isNonNullable<T>(value: T | undefined | null): value is NonNullable<T>;
|
|
5085
4678
|
|
|
5086
4679
|
declare function isParsableJson(input: string): boolean;
|
|
5087
4680
|
|
|
5088
|
-
declare function isParsableJson_2(input: string): boolean;
|
|
5089
|
-
|
|
5090
4681
|
/**
|
|
5091
4682
|
* Type guard to check if a message part is a reasoning part.
|
|
5092
4683
|
*/
|
|
@@ -5135,23 +4726,6 @@ declare function isUrlSupported({ mediaType, url, supportedUrls, }: {
|
|
|
5135
4726
|
supportedUrls: Record<string, RegExp[]>;
|
|
5136
4727
|
}): boolean;
|
|
5137
4728
|
|
|
5138
|
-
/**
|
|
5139
|
-
* Checks if the given URL is supported natively by the model.
|
|
5140
|
-
*
|
|
5141
|
-
* @param mediaType - The media type of the URL. Case-sensitive.
|
|
5142
|
-
* @param url - The URL to check.
|
|
5143
|
-
* @param supportedUrls - A record where keys are case-sensitive media types (or '*')
|
|
5144
|
-
* and values are arrays of RegExp patterns for URLs.
|
|
5145
|
-
*
|
|
5146
|
-
* @returns `true` if the URL matches a pattern under the specific media type
|
|
5147
|
-
* or the wildcard '*', `false` otherwise.
|
|
5148
|
-
*/
|
|
5149
|
-
declare function isUrlSupported_2({ mediaType, url, supportedUrls, }: {
|
|
5150
|
-
mediaType: string;
|
|
5151
|
-
url: string;
|
|
5152
|
-
supportedUrls: Record<string, RegExp[]>;
|
|
5153
|
-
}): boolean;
|
|
5154
|
-
|
|
5155
4729
|
declare type Job = () => Promise<void>;
|
|
5156
4730
|
|
|
5157
4731
|
declare type JSONArray = JSONValue_2[];
|
|
@@ -5177,7 +4751,7 @@ export declare class JSONParseError extends AISDKError {
|
|
|
5177
4751
|
* @param options.validate Optional. A validation function for the schema.
|
|
5178
4752
|
*/
|
|
5179
4753
|
export declare function jsonSchema<OBJECT = unknown>(jsonSchema: JSONSchema7 | PromiseLike<JSONSchema7> | (() => JSONSchema7 | PromiseLike<JSONSchema7>), { validate, }?: {
|
|
5180
|
-
validate?: (value: unknown) =>
|
|
4754
|
+
validate?: (value: unknown) => ValidationResult<OBJECT> | PromiseLike<ValidationResult<OBJECT>>;
|
|
5181
4755
|
}): Schema<OBJECT>;
|
|
5182
4756
|
|
|
5183
4757
|
export declare interface JSONSchema7 {
|
|
@@ -5339,16 +4913,6 @@ declare type JSONSchema7TypeName =
|
|
|
5339
4913
|
*/
|
|
5340
4914
|
declare type JSONSchema7Version = string;
|
|
5341
4915
|
|
|
5342
|
-
/**
|
|
5343
|
-
* Create a schema using a JSON Schema.
|
|
5344
|
-
*
|
|
5345
|
-
* @param jsonSchema The JSON Schema for the schema.
|
|
5346
|
-
* @param options.validate Optional. A validation function for the schema.
|
|
5347
|
-
*/
|
|
5348
|
-
declare function jsonSchema_2<OBJECT = unknown>(jsonSchema: JSONSchema7 | PromiseLike<JSONSchema7> | (() => JSONSchema7 | PromiseLike<JSONSchema7>), { validate, }?: {
|
|
5349
|
-
validate?: (value: unknown) => ValidationResult<OBJECT> | PromiseLike<ValidationResult<OBJECT>>;
|
|
5350
|
-
}): Schema_2<OBJECT>;
|
|
5351
|
-
|
|
5352
4916
|
/**
|
|
5353
4917
|
* A TransformStream that converts JSON objects to Server-Sent Events (SSE) format.
|
|
5354
4918
|
* Each object is serialized to JSON and wrapped in `data: ...\n\n` format.
|
|
@@ -5366,6 +4930,10 @@ export declare type JSONValue = JSONValue_2;
|
|
|
5366
4930
|
*/
|
|
5367
4931
|
declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
|
|
5368
4932
|
|
|
4933
|
+
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "video"];
|
|
4934
|
+
|
|
4935
|
+
declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
|
|
4936
|
+
|
|
5369
4937
|
/**
|
|
5370
4938
|
* Language model that is used by the AI SDK.
|
|
5371
4939
|
*/
|
|
@@ -7418,19 +6986,7 @@ export declare function lastAssistantMessageIsCompleteWithToolCalls({ messages,
|
|
|
7418
6986
|
messages: UIMessage[];
|
|
7419
6987
|
}): boolean;
|
|
7420
6988
|
|
|
7421
|
-
declare type LazySchema<SCHEMA> = () =>
|
|
7422
|
-
|
|
7423
|
-
/**
|
|
7424
|
-
* Creates a schema with deferred creation.
|
|
7425
|
-
* This is important to reduce the startup time of the library
|
|
7426
|
-
* and to avoid initializing unused validators.
|
|
7427
|
-
*
|
|
7428
|
-
* @param createValidator A function that creates a schema.
|
|
7429
|
-
* @returns A function that returns a schema.
|
|
7430
|
-
*/
|
|
7431
|
-
declare function lazySchema<SCHEMA>(createSchema: () => Schema_2<SCHEMA>): LazySchema<SCHEMA>;
|
|
7432
|
-
|
|
7433
|
-
declare type LazySchema_2<SCHEMA> = () => Schema<SCHEMA>;
|
|
6989
|
+
declare type LazySchema<SCHEMA> = () => Schema<SCHEMA>;
|
|
7434
6990
|
|
|
7435
6991
|
/**
|
|
7436
6992
|
* Creates a schema with deferred creation.
|
|
@@ -7440,7 +6996,7 @@ declare type LazySchema_2<SCHEMA> = () => Schema<SCHEMA>;
|
|
|
7440
6996
|
* @param createValidator A function that creates a schema.
|
|
7441
6997
|
* @returns A function that returns a schema.
|
|
7442
6998
|
*/
|
|
7443
|
-
declare function
|
|
6999
|
+
declare function lazySchema<SCHEMA>(createSchema: () => Schema<SCHEMA>): LazySchema<SCHEMA>;
|
|
7444
7000
|
|
|
7445
7001
|
/**
|
|
7446
7002
|
* A pointer from the current {@link Span} to another span in the same trace or
|
|
@@ -7480,13 +7036,6 @@ declare function loadApiKey({ apiKey, environmentVariableName, apiKeyParameterNa
|
|
|
7480
7036
|
description: string;
|
|
7481
7037
|
}): string;
|
|
7482
7038
|
|
|
7483
|
-
declare function loadApiKey_2({ apiKey, environmentVariableName, apiKeyParameterName, description, }: {
|
|
7484
|
-
apiKey: string | undefined;
|
|
7485
|
-
environmentVariableName: string;
|
|
7486
|
-
apiKeyParameterName?: string;
|
|
7487
|
-
description: string;
|
|
7488
|
-
}): string;
|
|
7489
|
-
|
|
7490
7039
|
export declare class LoadAPIKeyError extends AISDKError {
|
|
7491
7040
|
private readonly [symbol$6];
|
|
7492
7041
|
constructor({ message }: {
|
|
@@ -7507,18 +7056,6 @@ declare function loadOptionalSetting({ settingValue, environmentVariableName, }:
|
|
|
7507
7056
|
environmentVariableName: string;
|
|
7508
7057
|
}): string | undefined;
|
|
7509
7058
|
|
|
7510
|
-
/**
|
|
7511
|
-
* Loads an optional `string` setting from the environment or a parameter.
|
|
7512
|
-
*
|
|
7513
|
-
* @param settingValue - The setting value.
|
|
7514
|
-
* @param environmentVariableName - The environment variable name.
|
|
7515
|
-
* @returns The setting value.
|
|
7516
|
-
*/
|
|
7517
|
-
declare function loadOptionalSetting_2({ settingValue, environmentVariableName, }: {
|
|
7518
|
-
settingValue: string | undefined;
|
|
7519
|
-
environmentVariableName: string;
|
|
7520
|
-
}): string | undefined;
|
|
7521
|
-
|
|
7522
7059
|
/**
|
|
7523
7060
|
* Loads a `string` setting from the environment or a parameter.
|
|
7524
7061
|
*
|
|
@@ -7535,22 +7072,6 @@ declare function loadSetting({ settingValue, environmentVariableName, settingNam
|
|
|
7535
7072
|
description: string;
|
|
7536
7073
|
}): string;
|
|
7537
7074
|
|
|
7538
|
-
/**
|
|
7539
|
-
* Loads a `string` setting from the environment or a parameter.
|
|
7540
|
-
*
|
|
7541
|
-
* @param settingValue - The setting value.
|
|
7542
|
-
* @param environmentVariableName - The environment variable name.
|
|
7543
|
-
* @param settingName - The setting name.
|
|
7544
|
-
* @param description - The description of the setting.
|
|
7545
|
-
* @returns The setting value.
|
|
7546
|
-
*/
|
|
7547
|
-
declare function loadSetting_2({ settingValue, environmentVariableName, settingName, description, }: {
|
|
7548
|
-
settingValue: string | undefined;
|
|
7549
|
-
environmentVariableName: string;
|
|
7550
|
-
settingName: string;
|
|
7551
|
-
description: string;
|
|
7552
|
-
}): string;
|
|
7553
|
-
|
|
7554
7075
|
export declare class LoadSettingError extends AISDKError {
|
|
7555
7076
|
private readonly [symbol$5];
|
|
7556
7077
|
constructor({ message }: {
|
|
@@ -7590,8 +7111,6 @@ export { LogWarningsFunction }
|
|
|
7590
7111
|
|
|
7591
7112
|
declare type MaybePromiseLike<T> = T | PromiseLike<T>;
|
|
7592
7113
|
|
|
7593
|
-
declare type MaybePromiseLike_2<T> = T | PromiseLike<T>;
|
|
7594
|
-
|
|
7595
7114
|
/**
|
|
7596
7115
|
* Maps a media type to its corresponding file extension.
|
|
7597
7116
|
* It was originally introduced to set a filename for audio file uploads
|
|
@@ -7603,17 +7122,6 @@ declare type MaybePromiseLike_2<T> = T | PromiseLike<T>;
|
|
|
7603
7122
|
*/
|
|
7604
7123
|
declare function mediaTypeToExtension(mediaType: string): string;
|
|
7605
7124
|
|
|
7606
|
-
/**
|
|
7607
|
-
* Maps a media type to its corresponding file extension.
|
|
7608
|
-
* It was originally introduced to set a filename for audio file uploads
|
|
7609
|
-
* in https://github.com/vercel/ai/pull/8159.
|
|
7610
|
-
*
|
|
7611
|
-
* @param mediaType The media type to map.
|
|
7612
|
-
* @returns The corresponding file extension
|
|
7613
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/MIME_types/Common_types
|
|
7614
|
-
*/
|
|
7615
|
-
declare function mediaTypeToExtension_2(mediaType: string): string;
|
|
7616
|
-
|
|
7617
7125
|
export declare class MessageConversionError extends AISDKError {
|
|
7618
7126
|
private readonly [symbol$2_2];
|
|
7619
7127
|
readonly originalMessage: Omit<UIMessage, 'id'>;
|
|
@@ -7639,18 +7147,10 @@ export declare class MissingToolResultsError extends AISDKError {
|
|
|
7639
7147
|
*/
|
|
7640
7148
|
export declare type ModelMessage = SystemModelMessage | UserModelMessage | AssistantModelMessage | ToolModelMessage;
|
|
7641
7149
|
|
|
7642
|
-
/**
|
|
7643
|
-
* A message that can be used in the `messages` field of a prompt.
|
|
7644
|
-
* It can be a user message, an assistant message, or a tool message.
|
|
7645
|
-
*/
|
|
7646
|
-
declare type ModelMessage_2 = SystemModelMessage_2 | UserModelMessage_2 | AssistantModelMessage_2 | ToolModelMessage_2;
|
|
7647
|
-
|
|
7648
7150
|
export declare const modelMessageSchema: z.ZodType<ModelMessage>;
|
|
7649
7151
|
|
|
7650
7152
|
declare type NeverOptional<N, T> = 0 extends 1 & N ? Partial<T> : [N] extends [never] ? Partial<Record<keyof T, undefined>> : T;
|
|
7651
7153
|
|
|
7652
|
-
declare type NeverOptional_2<N, T> = 0 extends 1 & N ? Partial<T> : [N] extends [never] ? Partial<Record<keyof T, undefined>> : T;
|
|
7653
|
-
|
|
7654
7154
|
/**
|
|
7655
7155
|
* Thrown when the AI provider fails to generate any content.
|
|
7656
7156
|
*/
|
|
@@ -7743,15 +7243,6 @@ export declare class NoOutputGeneratedError extends AISDKError {
|
|
|
7743
7243
|
*/
|
|
7744
7244
|
declare function normalizeHeaders(headers: HeadersInit | Record<string, string | undefined> | Array<[string, string | undefined]> | undefined): Record<string, string>;
|
|
7745
7245
|
|
|
7746
|
-
/**
|
|
7747
|
-
* Normalizes different header inputs into a plain record with lower-case keys.
|
|
7748
|
-
* Entries with `undefined` or `null` values are removed.
|
|
7749
|
-
*
|
|
7750
|
-
* @param headers - Input headers (`Headers`, tuples array, plain record) to normalize.
|
|
7751
|
-
* @returns A record containing the normalized header entries.
|
|
7752
|
-
*/
|
|
7753
|
-
declare function normalizeHeaders_2(headers: HeadersInit | Record<string, string | undefined> | Array<[string, string | undefined]> | undefined): Record<string, string>;
|
|
7754
|
-
|
|
7755
7246
|
/**
|
|
7756
7247
|
* Error that is thrown when no speech audio was generated.
|
|
7757
7248
|
*/
|
|
@@ -7778,7 +7269,7 @@ export declare class NoSuchModelError extends AISDKError {
|
|
|
7778
7269
|
}
|
|
7779
7270
|
|
|
7780
7271
|
export declare class NoSuchProviderError extends NoSuchModelError {
|
|
7781
|
-
private readonly [
|
|
7272
|
+
private readonly [symbol_3];
|
|
7782
7273
|
readonly providerId: string;
|
|
7783
7274
|
readonly availableProviders: string[];
|
|
7784
7275
|
constructor({ modelId, modelType, providerId, availableProviders, message, }: {
|
|
@@ -7931,7 +7422,7 @@ export declare interface OnStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT ex
|
|
|
7931
7422
|
/** Additional HTTP headers sent with the request. */
|
|
7932
7423
|
readonly headers: Record<string, string | undefined> | undefined;
|
|
7933
7424
|
/** Additional provider-specific options. */
|
|
7934
|
-
readonly providerOptions:
|
|
7425
|
+
readonly providerOptions: ProviderOptions | undefined;
|
|
7935
7426
|
/**
|
|
7936
7427
|
* Condition(s) for stopping the generation.
|
|
7937
7428
|
* When the condition is an array, any of the conditions can be met to stop.
|
|
@@ -7997,7 +7488,7 @@ export declare interface OnStepStartEvent<TOOLS extends ToolSet = ToolSet, OUTPU
|
|
|
7997
7488
|
/** Array of results from previous steps (empty for first step). */
|
|
7998
7489
|
readonly steps: ReadonlyArray<StepResult<TOOLS>>;
|
|
7999
7490
|
/** Additional provider-specific options for this step. */
|
|
8000
|
-
readonly providerOptions:
|
|
7491
|
+
readonly providerOptions: ProviderOptions | undefined;
|
|
8001
7492
|
/**
|
|
8002
7493
|
* Timeout configuration for the generation.
|
|
8003
7494
|
* Can be a number (milliseconds) or an object with totalMs, stepMs, chunkMs.
|
|
@@ -8297,30 +7788,6 @@ declare function parseJSON(options: {
|
|
|
8297
7788
|
* @returns {Promise<T>} - The parsed object.
|
|
8298
7789
|
*/
|
|
8299
7790
|
declare function parseJSON<T>(options: {
|
|
8300
|
-
text: string;
|
|
8301
|
-
schema: FlexibleSchema_2<T>;
|
|
8302
|
-
}): Promise<T>;
|
|
8303
|
-
|
|
8304
|
-
/**
|
|
8305
|
-
* Parses a JSON string into an unknown object.
|
|
8306
|
-
*
|
|
8307
|
-
* @param text - The JSON string to parse.
|
|
8308
|
-
* @returns {JSONValue} - The parsed JSON object.
|
|
8309
|
-
*/
|
|
8310
|
-
declare function parseJSON_2(options: {
|
|
8311
|
-
text: string;
|
|
8312
|
-
schema?: undefined;
|
|
8313
|
-
}): Promise<JSONValue_2>;
|
|
8314
|
-
|
|
8315
|
-
/**
|
|
8316
|
-
* Parses a JSON string into a strongly-typed object using the provided schema.
|
|
8317
|
-
*
|
|
8318
|
-
* @template T - The type of the object to parse the JSON into.
|
|
8319
|
-
* @param {string} text - The JSON string to parse.
|
|
8320
|
-
* @param {Validator<T>} schema - The schema to use for parsing the JSON.
|
|
8321
|
-
* @returns {Promise<T>} - The parsed object.
|
|
8322
|
-
*/
|
|
8323
|
-
declare function parseJSON_2<T>(options: {
|
|
8324
7791
|
text: string;
|
|
8325
7792
|
schema: FlexibleSchema<T>;
|
|
8326
7793
|
}): Promise<T>;
|
|
@@ -8331,14 +7798,6 @@ declare function parseJSON_2<T>(options: {
|
|
|
8331
7798
|
export declare function parseJsonEventStream<T>({ stream, schema, }: {
|
|
8332
7799
|
stream: ReadableStream<Uint8Array>;
|
|
8333
7800
|
schema: FlexibleSchema<T>;
|
|
8334
|
-
}): ReadableStream<ParseResult_2<T>>;
|
|
8335
|
-
|
|
8336
|
-
/**
|
|
8337
|
-
* Parses a JSON event stream into a stream of parsed JSON objects.
|
|
8338
|
-
*/
|
|
8339
|
-
declare function parseJsonEventStream_2<T>({ stream, schema, }: {
|
|
8340
|
-
stream: ReadableStream<Uint8Array>;
|
|
8341
|
-
schema: FlexibleSchema_2<T>;
|
|
8342
7801
|
}): ReadableStream<ParseResult<T>>;
|
|
8343
7802
|
|
|
8344
7803
|
export declare function parsePartialJson(jsonText: string | undefined): Promise<{
|
|
@@ -8347,12 +7806,6 @@ export declare function parsePartialJson(jsonText: string | undefined): Promise<
|
|
|
8347
7806
|
}>;
|
|
8348
7807
|
|
|
8349
7808
|
declare function parseProviderOptions<OPTIONS>({ provider, providerOptions, schema, }: {
|
|
8350
|
-
provider: string;
|
|
8351
|
-
providerOptions: Record<string, unknown> | undefined;
|
|
8352
|
-
schema: FlexibleSchema_2<OPTIONS>;
|
|
8353
|
-
}): Promise<OPTIONS | undefined>;
|
|
8354
|
-
|
|
8355
|
-
declare function parseProviderOptions_2<OPTIONS>({ provider, providerOptions, schema, }: {
|
|
8356
7809
|
provider: string;
|
|
8357
7810
|
providerOptions: Record<string, unknown> | undefined;
|
|
8358
7811
|
schema: FlexibleSchema<OPTIONS>;
|
|
@@ -8368,16 +7821,6 @@ declare type ParseResult<T> = {
|
|
|
8368
7821
|
rawValue: unknown;
|
|
8369
7822
|
};
|
|
8370
7823
|
|
|
8371
|
-
declare type ParseResult_2<T> = {
|
|
8372
|
-
success: true;
|
|
8373
|
-
value: T;
|
|
8374
|
-
rawValue: unknown;
|
|
8375
|
-
} | {
|
|
8376
|
-
success: false;
|
|
8377
|
-
error: JSONParseError | TypeValidationError;
|
|
8378
|
-
rawValue: unknown;
|
|
8379
|
-
};
|
|
8380
|
-
|
|
8381
7824
|
declare type PartialMap<KeyType, ValueType> = {} & Map<DeepPartialInternal<KeyType>, DeepPartialInternal<ValueType>>;
|
|
8382
7825
|
|
|
8383
7826
|
declare type PartialObject<ObjectType extends object> = {
|
|
@@ -8598,20 +8041,6 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
|
|
|
8598
8041
|
responseHeaders?: Record<string, string>;
|
|
8599
8042
|
}>;
|
|
8600
8043
|
|
|
8601
|
-
declare const postFormDataToApi_2: <T>({ url, headers, formData, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
|
|
8602
|
-
url: string;
|
|
8603
|
-
headers?: Record<string, string | undefined>;
|
|
8604
|
-
formData: FormData;
|
|
8605
|
-
failedResponseHandler: ResponseHandler_2<APICallError>;
|
|
8606
|
-
successfulResponseHandler: ResponseHandler_2<T>;
|
|
8607
|
-
abortSignal?: AbortSignal;
|
|
8608
|
-
fetch?: FetchFunction_2;
|
|
8609
|
-
}) => Promise<{
|
|
8610
|
-
value: T;
|
|
8611
|
-
rawValue?: unknown;
|
|
8612
|
-
responseHeaders?: Record<string, string>;
|
|
8613
|
-
}>;
|
|
8614
|
-
|
|
8615
8044
|
declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
|
|
8616
8045
|
url: string;
|
|
8617
8046
|
headers?: Record<string, string | undefined>;
|
|
@@ -8626,20 +8055,6 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
|
|
|
8626
8055
|
responseHeaders?: Record<string, string>;
|
|
8627
8056
|
}>;
|
|
8628
8057
|
|
|
8629
|
-
declare const postJsonToApi_2: <T>({ url, headers, body, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
|
|
8630
|
-
url: string;
|
|
8631
|
-
headers?: Record<string, string | undefined>;
|
|
8632
|
-
body: unknown;
|
|
8633
|
-
failedResponseHandler: ResponseHandler_2<APICallError>;
|
|
8634
|
-
successfulResponseHandler: ResponseHandler_2<T>;
|
|
8635
|
-
abortSignal?: AbortSignal;
|
|
8636
|
-
fetch?: FetchFunction_2;
|
|
8637
|
-
}) => Promise<{
|
|
8638
|
-
value: T;
|
|
8639
|
-
rawValue?: unknown;
|
|
8640
|
-
responseHeaders?: Record<string, string>;
|
|
8641
|
-
}>;
|
|
8642
|
-
|
|
8643
8058
|
declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
8644
8059
|
url: string;
|
|
8645
8060
|
headers?: Record<string, string | undefined>;
|
|
@@ -8657,23 +8072,6 @@ declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, fa
|
|
|
8657
8072
|
responseHeaders?: Record<string, string>;
|
|
8658
8073
|
}>;
|
|
8659
8074
|
|
|
8660
|
-
declare const postToApi_2: <T>({ url, headers, body, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
8661
|
-
url: string;
|
|
8662
|
-
headers?: Record<string, string | undefined>;
|
|
8663
|
-
body: {
|
|
8664
|
-
content: string | FormData | Uint8Array;
|
|
8665
|
-
values: unknown;
|
|
8666
|
-
};
|
|
8667
|
-
failedResponseHandler: ResponseHandler_2<Error>;
|
|
8668
|
-
successfulResponseHandler: ResponseHandler_2<T>;
|
|
8669
|
-
abortSignal?: AbortSignal;
|
|
8670
|
-
fetch?: FetchFunction_2;
|
|
8671
|
-
}) => Promise<{
|
|
8672
|
-
value: T;
|
|
8673
|
-
rawValue?: unknown;
|
|
8674
|
-
responseHeaders?: Record<string, string>;
|
|
8675
|
-
}>;
|
|
8676
|
-
|
|
8677
8075
|
export declare type PrepareReconnectToStreamRequest = (options: {
|
|
8678
8076
|
id: string;
|
|
8679
8077
|
requestMetadata: unknown;
|
|
@@ -8790,7 +8188,7 @@ export declare type PrepareStepResult<TOOLS extends Record<string, Tool> = Recor
|
|
|
8790
8188
|
* Can be used to pass provider-specific configuration such as
|
|
8791
8189
|
* container IDs for Anthropic's code execution.
|
|
8792
8190
|
*/
|
|
8793
|
-
providerOptions?:
|
|
8191
|
+
providerOptions?: ProviderOptions;
|
|
8794
8192
|
} | undefined;
|
|
8795
8193
|
|
|
8796
8194
|
/**
|
|
@@ -8802,6 +8200,15 @@ export declare type Prompt = {
|
|
|
8802
8200
|
* System message to include in the prompt. Can be used with `prompt` or `messages`.
|
|
8803
8201
|
*/
|
|
8804
8202
|
system?: string | SystemModelMessage | Array<SystemModelMessage>;
|
|
8203
|
+
/**
|
|
8204
|
+
* Whether system messages are allowed in the `prompt` or `messages` fields.
|
|
8205
|
+
*
|
|
8206
|
+
* When disabled, system messages must be provided through the `system`
|
|
8207
|
+
* option. When unset, system messages are allowed with a warning.
|
|
8208
|
+
*
|
|
8209
|
+
* @default undefined
|
|
8210
|
+
*/
|
|
8211
|
+
allowSystemInMessages?: boolean;
|
|
8805
8212
|
} & ({
|
|
8806
8213
|
/**
|
|
8807
8214
|
* A prompt. It can be either a text prompt or a list of messages.
|
|
@@ -8884,14 +8291,15 @@ export declare type Provider = {
|
|
|
8884
8291
|
* This is needed to enable provider-specific functionality that can be
|
|
8885
8292
|
* fully encapsulated in the provider.
|
|
8886
8293
|
*/
|
|
8887
|
-
export declare type ProviderMetadata = SharedV3ProviderMetadata;
|
|
8294
|
+
export declare type ProviderMetadata = SharedV3ProviderMetadata;
|
|
8295
|
+
|
|
8888
8296
|
/**
|
|
8889
8297
|
* Additional provider-specific options.
|
|
8890
8298
|
*
|
|
8891
8299
|
* They are passed through to the provider from the AI SDK and enable
|
|
8892
8300
|
* provider-specific functionality that can be fully encapsulated in the provider.
|
|
8893
8301
|
*/
|
|
8894
|
-
declare type
|
|
8302
|
+
declare type ProviderOptions = SharedV3ProviderOptions;
|
|
8895
8303
|
|
|
8896
8304
|
export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV3> = Record<string, ProviderV3>, SEPARATOR extends string = ':'> {
|
|
8897
8305
|
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV3;
|
|
@@ -8909,15 +8317,6 @@ export declare interface ProviderRegistryProvider<PROVIDERS extends Record<strin
|
|
|
8909
8317
|
}
|
|
8910
8318
|
|
|
8911
8319
|
declare type ProviderToolFactory<INPUT, ARGS extends object> = <OUTPUT>(options: ARGS & {
|
|
8912
|
-
execute?: ToolExecuteFunction_2<INPUT, OUTPUT>;
|
|
8913
|
-
needsApproval?: Tool_2<INPUT, OUTPUT>['needsApproval'];
|
|
8914
|
-
toModelOutput?: Tool_2<INPUT, OUTPUT>['toModelOutput'];
|
|
8915
|
-
onInputStart?: Tool_2<INPUT, OUTPUT>['onInputStart'];
|
|
8916
|
-
onInputDelta?: Tool_2<INPUT, OUTPUT>['onInputDelta'];
|
|
8917
|
-
onInputAvailable?: Tool_2<INPUT, OUTPUT>['onInputAvailable'];
|
|
8918
|
-
}) => Tool_2<INPUT, OUTPUT>;
|
|
8919
|
-
|
|
8920
|
-
declare type ProviderToolFactory_2<INPUT, ARGS extends object> = <OUTPUT>(options: ARGS & {
|
|
8921
8320
|
execute?: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
8922
8321
|
needsApproval?: Tool<INPUT, OUTPUT>['needsApproval'];
|
|
8923
8322
|
toModelOutput?: Tool<INPUT, OUTPUT>['toModelOutput'];
|
|
@@ -8927,15 +8326,6 @@ declare type ProviderToolFactory_2<INPUT, ARGS extends object> = <OUTPUT>(option
|
|
|
8927
8326
|
}) => Tool<INPUT, OUTPUT>;
|
|
8928
8327
|
|
|
8929
8328
|
declare type ProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends object> = (options: ARGS & {
|
|
8930
|
-
execute?: ToolExecuteFunction_2<INPUT, OUTPUT>;
|
|
8931
|
-
needsApproval?: Tool_2<INPUT, OUTPUT>['needsApproval'];
|
|
8932
|
-
toModelOutput?: Tool_2<INPUT, OUTPUT>['toModelOutput'];
|
|
8933
|
-
onInputStart?: Tool_2<INPUT, OUTPUT>['onInputStart'];
|
|
8934
|
-
onInputDelta?: Tool_2<INPUT, OUTPUT>['onInputDelta'];
|
|
8935
|
-
onInputAvailable?: Tool_2<INPUT, OUTPUT>['onInputAvailable'];
|
|
8936
|
-
}) => Tool_2<INPUT, OUTPUT>;
|
|
8937
|
-
|
|
8938
|
-
declare type ProviderToolFactoryWithOutputSchema_2<INPUT, OUTPUT, ARGS extends object> = (options: ARGS & {
|
|
8939
8329
|
execute?: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
8940
8330
|
needsApproval?: Tool<INPUT, OUTPUT>['needsApproval'];
|
|
8941
8331
|
toModelOutput?: Tool<INPUT, OUTPUT>['toModelOutput'];
|
|
@@ -9118,25 +8508,6 @@ declare function readResponseWithSizeLimit({ response, url, maxBytes, }: {
|
|
|
9118
8508
|
maxBytes?: number;
|
|
9119
8509
|
}): Promise<Uint8Array>;
|
|
9120
8510
|
|
|
9121
|
-
/**
|
|
9122
|
-
* Reads a fetch Response body with a size limit to prevent memory exhaustion.
|
|
9123
|
-
*
|
|
9124
|
-
* Checks the Content-Length header for early rejection, then reads the body
|
|
9125
|
-
* incrementally via ReadableStream and aborts with a DownloadError when the
|
|
9126
|
-
* limit is exceeded.
|
|
9127
|
-
*
|
|
9128
|
-
* @param response - The fetch Response to read.
|
|
9129
|
-
* @param url - The URL being downloaded (used in error messages).
|
|
9130
|
-
* @param maxBytes - Maximum allowed bytes. Defaults to DEFAULT_MAX_DOWNLOAD_SIZE.
|
|
9131
|
-
* @returns A Uint8Array containing the response body.
|
|
9132
|
-
* @throws DownloadError if the response exceeds maxBytes.
|
|
9133
|
-
*/
|
|
9134
|
-
declare function readResponseWithSizeLimit_2({ response, url, maxBytes, }: {
|
|
9135
|
-
response: Response;
|
|
9136
|
-
url: string;
|
|
9137
|
-
maxBytes?: number;
|
|
9138
|
-
}): Promise<Uint8Array>;
|
|
9139
|
-
|
|
9140
8511
|
/**
|
|
9141
8512
|
* Transforms a stream of `UIMessageChunk`s into an `AsyncIterableStream` of `UIMessage`s.
|
|
9142
8513
|
*
|
|
@@ -9189,23 +8560,6 @@ declare interface ReasoningPart {
|
|
|
9189
8560
|
providerOptions?: ProviderOptions;
|
|
9190
8561
|
}
|
|
9191
8562
|
|
|
9192
|
-
/**
|
|
9193
|
-
* Reasoning content part of a prompt. It contains a reasoning.
|
|
9194
|
-
*/
|
|
9195
|
-
declare interface ReasoningPart_2 {
|
|
9196
|
-
type: 'reasoning';
|
|
9197
|
-
/**
|
|
9198
|
-
* The reasoning text.
|
|
9199
|
-
*/
|
|
9200
|
-
text: string;
|
|
9201
|
-
/**
|
|
9202
|
-
* Additional provider-specific metadata. They are passed through
|
|
9203
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
9204
|
-
* functionality that can be fully encapsulated in the provider.
|
|
9205
|
-
*/
|
|
9206
|
-
providerOptions?: ProviderOptions_2;
|
|
9207
|
-
}
|
|
9208
|
-
|
|
9209
8563
|
/**
|
|
9210
8564
|
* A reasoning part of a message.
|
|
9211
8565
|
*/
|
|
@@ -9237,13 +8591,6 @@ export declare function registerTelemetryIntegration(integration: TelemetryInteg
|
|
|
9237
8591
|
*/
|
|
9238
8592
|
declare function removeUndefinedEntries<T>(record: Record<string, T | undefined>): Record<string, T>;
|
|
9239
8593
|
|
|
9240
|
-
/**
|
|
9241
|
-
* Removes entries from a record where the value is null or undefined.
|
|
9242
|
-
* @param record - The input object whose entries may be null or undefined.
|
|
9243
|
-
* @returns A new object containing only entries with non-null and non-undefined values.
|
|
9244
|
-
*/
|
|
9245
|
-
declare function removeUndefinedEntries_2<T>(record: Record<string, T | undefined>): Record<string, T>;
|
|
9246
|
-
|
|
9247
8594
|
/**
|
|
9248
8595
|
* A function that attempts to repair the raw output of the model
|
|
9249
8596
|
* to enable JSON parsing.
|
|
@@ -9271,7 +8618,7 @@ export declare type RepairTextFunction = (options: {
|
|
|
9271
8618
|
*
|
|
9272
8619
|
* @returns A result object that contains the reranked documents, the reranked indices, and additional information.
|
|
9273
8620
|
*/
|
|
9274
|
-
export declare function rerank<VALUE extends JSONObject | string>({ model, documents, query, topN, maxRetries: maxRetriesArg, abortSignal, headers, providerOptions, experimental_telemetry: telemetry, }: {
|
|
8621
|
+
export declare function rerank<VALUE extends JSONObject | string>({ model: modelArg, documents, query, topN, maxRetries: maxRetriesArg, abortSignal, headers, providerOptions, experimental_telemetry: telemetry, }: {
|
|
9275
8622
|
/**
|
|
9276
8623
|
* The reranking model to use.
|
|
9277
8624
|
*/
|
|
@@ -9312,13 +8659,13 @@ export declare function rerank<VALUE extends JSONObject | string>({ model, docum
|
|
|
9312
8659
|
* to the provider from the AI SDK and enable provider-specific
|
|
9313
8660
|
* functionality that can be fully encapsulated in the provider.
|
|
9314
8661
|
*/
|
|
9315
|
-
providerOptions?:
|
|
8662
|
+
providerOptions?: ProviderOptions;
|
|
9316
8663
|
}): Promise<RerankResult<VALUE>>;
|
|
9317
8664
|
|
|
9318
8665
|
/**
|
|
9319
8666
|
* Reranking model that is used by the AI SDK.
|
|
9320
8667
|
*/
|
|
9321
|
-
export declare type RerankingModel = RerankingModelV3;
|
|
8668
|
+
export declare type RerankingModel = string | RerankingModelV3;
|
|
9322
8669
|
|
|
9323
8670
|
/**
|
|
9324
8671
|
* Specification for a reranking model that implements the reranking model interface version 3.
|
|
@@ -9492,20 +8839,12 @@ export declare interface RerankResult<VALUE> {
|
|
|
9492
8839
|
|
|
9493
8840
|
declare type Resolvable<T> = MaybePromiseLike<T> | (() => MaybePromiseLike<T>);
|
|
9494
8841
|
|
|
9495
|
-
declare type Resolvable_2<T> = MaybePromiseLike_2<T> | (() => MaybePromiseLike_2<T>);
|
|
9496
|
-
|
|
9497
8842
|
/**
|
|
9498
8843
|
* Resolves a value that could be a raw value, a Promise, a function returning a value,
|
|
9499
8844
|
* or a function returning a Promise.
|
|
9500
8845
|
*/
|
|
9501
8846
|
declare function resolve<T>(value: Resolvable<T>): Promise<T>;
|
|
9502
8847
|
|
|
9503
|
-
/**
|
|
9504
|
-
* Resolves a value that could be a raw value, a Promise, a function returning a value,
|
|
9505
|
-
* or a function returning a Promise.
|
|
9506
|
-
*/
|
|
9507
|
-
declare function resolve_2<T>(value: Resolvable_2<T>): Promise<T>;
|
|
9508
|
-
|
|
9509
8848
|
declare type ResponseHandler<RETURN_TYPE> = (options: {
|
|
9510
8849
|
url: string;
|
|
9511
8850
|
requestBodyValues: unknown;
|
|
@@ -9516,16 +8855,6 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
|
|
|
9516
8855
|
responseHeaders?: Record<string, string>;
|
|
9517
8856
|
}>;
|
|
9518
8857
|
|
|
9519
|
-
declare type ResponseHandler_2<RETURN_TYPE> = (options: {
|
|
9520
|
-
url: string;
|
|
9521
|
-
requestBodyValues: unknown;
|
|
9522
|
-
response: Response;
|
|
9523
|
-
}) => PromiseLike<{
|
|
9524
|
-
value: RETURN_TYPE;
|
|
9525
|
-
rawValue?: unknown;
|
|
9526
|
-
responseHeaders?: Record<string, string>;
|
|
9527
|
-
}>;
|
|
9528
|
-
|
|
9529
8858
|
/**
|
|
9530
8859
|
* A message that was generated during the generation process.
|
|
9531
8860
|
* It can be either an assistant message or a tool message.
|
|
@@ -9567,33 +8896,9 @@ declare function safeParseJSON(options: {
|
|
|
9567
8896
|
* @returns An object with either a `success` flag and the parsed and typed data, or a `success` flag and an error object.
|
|
9568
8897
|
*/
|
|
9569
8898
|
declare function safeParseJSON<T>(options: {
|
|
9570
|
-
text: string;
|
|
9571
|
-
schema: FlexibleSchema_2<T>;
|
|
9572
|
-
}): Promise<ParseResult<T>>;
|
|
9573
|
-
|
|
9574
|
-
/**
|
|
9575
|
-
* Safely parses a JSON string and returns the result as an object of type `unknown`.
|
|
9576
|
-
*
|
|
9577
|
-
* @param text - The JSON string to parse.
|
|
9578
|
-
* @returns {Promise<object>} Either an object with `success: true` and the parsed data, or an object with `success: false` and the error that occurred.
|
|
9579
|
-
*/
|
|
9580
|
-
declare function safeParseJSON_2(options: {
|
|
9581
|
-
text: string;
|
|
9582
|
-
schema?: undefined;
|
|
9583
|
-
}): Promise<ParseResult_2<JSONValue_2>>;
|
|
9584
|
-
|
|
9585
|
-
/**
|
|
9586
|
-
* Safely parses a JSON string into a strongly-typed object, using a provided schema to validate the object.
|
|
9587
|
-
*
|
|
9588
|
-
* @template T - The type of the object to parse the JSON into.
|
|
9589
|
-
* @param {string} text - The JSON string to parse.
|
|
9590
|
-
* @param {Validator<T>} schema - The schema to use for parsing the JSON.
|
|
9591
|
-
* @returns An object with either a `success` flag and the parsed and typed data, or a `success` flag and an error object.
|
|
9592
|
-
*/
|
|
9593
|
-
declare function safeParseJSON_2<T>(options: {
|
|
9594
8899
|
text: string;
|
|
9595
8900
|
schema: FlexibleSchema<T>;
|
|
9596
|
-
}): Promise<
|
|
8901
|
+
}): Promise<ParseResult<T>>;
|
|
9597
8902
|
|
|
9598
8903
|
/**
|
|
9599
8904
|
* Safely validates the types of an unknown object using a schema and
|
|
@@ -9607,31 +8912,7 @@ declare function safeParseJSON_2<T>(options: {
|
|
|
9607
8912
|
*/
|
|
9608
8913
|
declare function safeValidateTypes<OBJECT>({ value, schema, context, }: {
|
|
9609
8914
|
value: unknown;
|
|
9610
|
-
schema:
|
|
9611
|
-
context?: TypeValidationContext;
|
|
9612
|
-
}): Promise<{
|
|
9613
|
-
success: true;
|
|
9614
|
-
value: OBJECT;
|
|
9615
|
-
rawValue: unknown;
|
|
9616
|
-
} | {
|
|
9617
|
-
success: false;
|
|
9618
|
-
error: TypeValidationError;
|
|
9619
|
-
rawValue: unknown;
|
|
9620
|
-
}>;
|
|
9621
|
-
|
|
9622
|
-
/**
|
|
9623
|
-
* Safely validates the types of an unknown object using a schema and
|
|
9624
|
-
* return a strongly-typed object.
|
|
9625
|
-
*
|
|
9626
|
-
* @template T - The type of the object to validate.
|
|
9627
|
-
* @param {string} options.value - The JSON object to validate.
|
|
9628
|
-
* @param {Validator<T>} options.schema - The schema to use for validating the JSON.
|
|
9629
|
-
* @param {TypeValidationContext} options.context - Optional context about what is being validated.
|
|
9630
|
-
* @returns An object with either a `success` flag and the parsed and typed data, or a `success` flag and an error object.
|
|
9631
|
-
*/
|
|
9632
|
-
declare function safeValidateTypes_2<OBJECT>({ value, schema, context, }: {
|
|
9633
|
-
value: unknown;
|
|
9634
|
-
schema: FlexibleSchema<OBJECT>;
|
|
8915
|
+
schema: FlexibleSchema<OBJECT>;
|
|
9635
8916
|
context?: TypeValidationContext;
|
|
9636
8917
|
}): Promise<{
|
|
9637
8918
|
success: true;
|
|
@@ -9668,26 +8949,6 @@ export declare type SafeValidateUIMessagesResult<UI_MESSAGE extends UIMessage> =
|
|
|
9668
8949
|
};
|
|
9669
8950
|
|
|
9670
8951
|
export declare type Schema<OBJECT = unknown> = {
|
|
9671
|
-
/**
|
|
9672
|
-
* Used to mark schemas so we can support both Zod and custom schemas.
|
|
9673
|
-
*/
|
|
9674
|
-
[schemaSymbol_2]: true;
|
|
9675
|
-
/**
|
|
9676
|
-
* Schema type for inference.
|
|
9677
|
-
*/
|
|
9678
|
-
_type: OBJECT;
|
|
9679
|
-
/**
|
|
9680
|
-
* Optional. Validates that the structure of a value matches this schema,
|
|
9681
|
-
* and returns a typed version of the value if it does.
|
|
9682
|
-
*/
|
|
9683
|
-
readonly validate?: (value: unknown) => ValidationResult_2<OBJECT> | PromiseLike<ValidationResult_2<OBJECT>>;
|
|
9684
|
-
/**
|
|
9685
|
-
* The JSON Schema for the schema. It is passed to the providers.
|
|
9686
|
-
*/
|
|
9687
|
-
readonly jsonSchema: JSONSchema7 | PromiseLike<JSONSchema7>;
|
|
9688
|
-
};
|
|
9689
|
-
|
|
9690
|
-
declare type Schema_2<OBJECT = unknown> = {
|
|
9691
8952
|
/**
|
|
9692
8953
|
* Used to mark schemas so we can support both Zod and custom schemas.
|
|
9693
8954
|
*/
|
|
@@ -9712,11 +8973,6 @@ declare type Schema_2<OBJECT = unknown> = {
|
|
|
9712
8973
|
*/
|
|
9713
8974
|
declare const schemaSymbol: unique symbol;
|
|
9714
8975
|
|
|
9715
|
-
/**
|
|
9716
|
-
* Used to mark schemas so we can support both Zod and custom schemas.
|
|
9717
|
-
*/
|
|
9718
|
-
declare const schemaSymbol_2: unique symbol;
|
|
9719
|
-
|
|
9720
8976
|
export declare class SerialJobExecutor {
|
|
9721
8977
|
private queue;
|
|
9722
8978
|
private isProcessing;
|
|
@@ -10623,8 +9879,6 @@ declare namespace StandardJSONSchemaV1 {
|
|
|
10623
9879
|
|
|
10624
9880
|
declare type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & StandardJSONSchemaV1<unknown, SCHEMA>;
|
|
10625
9881
|
|
|
10626
|
-
declare type StandardSchema_2<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & StandardJSONSchemaV1<unknown, SCHEMA>;
|
|
10627
|
-
|
|
10628
9882
|
/** The Standard Schema interface. */
|
|
10629
9883
|
declare interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
10630
9884
|
/** The Standard Schema properties. */
|
|
@@ -10802,7 +10056,7 @@ export declare type StepResult<TOOLS extends ToolSet> = {
|
|
|
10802
10056
|
/**
|
|
10803
10057
|
* The reasoning that was generated during the generation.
|
|
10804
10058
|
*/
|
|
10805
|
-
readonly reasoning: Array<
|
|
10059
|
+
readonly reasoning: Array<ReasoningPart>;
|
|
10806
10060
|
/**
|
|
10807
10061
|
* The reasoning text that was generated during the generation.
|
|
10808
10062
|
*/
|
|
@@ -10903,6 +10157,7 @@ export declare type StopCondition<TOOLS extends ToolSet> = (options: {
|
|
|
10903
10157
|
* @param system - A system message that will be part of the prompt.
|
|
10904
10158
|
* @param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
|
|
10905
10159
|
* @param messages - A list of messages. You can either use `prompt` or `messages` but not both.
|
|
10160
|
+
* @param allowSystemInMessages - Whether system messages are allowed in the `prompt` or `messages` fields. When unset, system messages are allowed with a warning.
|
|
10906
10161
|
*
|
|
10907
10162
|
* @param maxOutputTokens - Maximum number of tokens to generate.
|
|
10908
10163
|
* @param temperature - Temperature setting.
|
|
@@ -11004,7 +10259,7 @@ export declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = Fl
|
|
|
11004
10259
|
* to the provider from the AI SDK and enable provider-specific
|
|
11005
10260
|
* functionality that can be fully encapsulated in the provider.
|
|
11006
10261
|
*/
|
|
11007
|
-
providerOptions?:
|
|
10262
|
+
providerOptions?: ProviderOptions;
|
|
11008
10263
|
/**
|
|
11009
10264
|
* Callback that is invoked when an error occurs during streaming.
|
|
11010
10265
|
* You can use it to log errors.
|
|
@@ -11160,19 +10415,19 @@ declare interface StreamOptions {
|
|
|
11160
10415
|
*
|
|
11161
10416
|
* @defaultValue `undefined`
|
|
11162
10417
|
*/
|
|
11163
|
-
onError?: (
|
|
10418
|
+
onError?: ("terminate" | ((error: Error) => void)) | undefined;
|
|
11164
10419
|
/**
|
|
11165
10420
|
* Callback for when a reconnection interval is sent from the server.
|
|
11166
10421
|
*
|
|
11167
10422
|
* @param retry - The number of milliseconds to wait before reconnecting.
|
|
11168
10423
|
*/
|
|
11169
|
-
onRetry?: ((retry: number) => void) | undefined
|
|
10424
|
+
onRetry?: ((retry: number) => void) | undefined;
|
|
11170
10425
|
/**
|
|
11171
10426
|
* Callback for when a comment is encountered in the stream.
|
|
11172
10427
|
*
|
|
11173
10428
|
* @param comment - The comment encountered in the stream.
|
|
11174
10429
|
*/
|
|
11175
|
-
onComment?: ((comment: string) => void) | undefined
|
|
10430
|
+
onComment?: ((comment: string) => void) | undefined;
|
|
11176
10431
|
}
|
|
11177
10432
|
|
|
11178
10433
|
/**
|
|
@@ -11186,6 +10441,7 @@ declare interface StreamOptions {
|
|
|
11186
10441
|
* @param system - A system message that will be part of the prompt.
|
|
11187
10442
|
* @param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
|
|
11188
10443
|
* @param messages - A list of messages. You can either use `prompt` or `messages` but not both.
|
|
10444
|
+
* @param allowSystemInMessages - Whether system messages are allowed in the `prompt` or `messages` fields. When unset, system messages are allowed with a warning.
|
|
11189
10445
|
*
|
|
11190
10446
|
* @param maxOutputTokens - Maximum number of tokens to generate.
|
|
11191
10447
|
* @param temperature - Temperature setting.
|
|
@@ -11221,7 +10477,7 @@ declare interface StreamOptions {
|
|
|
11221
10477
|
* @returns
|
|
11222
10478
|
* A result object for accessing different stream types and additional information.
|
|
11223
10479
|
*/
|
|
11224
|
-
export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string, never>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, experimental_context, experimental_include: include, _internal: { now, generateId }, ...settings }: CallSettings & Prompt & {
|
|
10480
|
+
export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string, never>>({ model, tools, toolChoice, system, prompt, messages, allowSystemInMessages, maxRetries, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, experimental_context, experimental_include: include, _internal: { now, generateId }, ...settings }: CallSettings & Prompt & {
|
|
11225
10481
|
/**
|
|
11226
10482
|
* The language model to use.
|
|
11227
10483
|
*/
|
|
@@ -11250,7 +10506,7 @@ export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_
|
|
|
11250
10506
|
* to the provider from the AI SDK and enable provider-specific
|
|
11251
10507
|
* functionality that can be fully encapsulated in the provider.
|
|
11252
10508
|
*/
|
|
11253
|
-
providerOptions?:
|
|
10509
|
+
providerOptions?: ProviderOptions;
|
|
11254
10510
|
/**
|
|
11255
10511
|
* @deprecated Use `activeTools` instead.
|
|
11256
10512
|
*/
|
|
@@ -11696,16 +10952,6 @@ export declare type StreamTextTransform<TOOLS extends ToolSet> = (options: {
|
|
|
11696
10952
|
*/
|
|
11697
10953
|
declare function stripFileExtension(filename: string): string;
|
|
11698
10954
|
|
|
11699
|
-
/**
|
|
11700
|
-
* Strips file extension segments from a filename.
|
|
11701
|
-
*
|
|
11702
|
-
* Examples:
|
|
11703
|
-
* - "report.pdf" -> "report"
|
|
11704
|
-
* - "archive.tar.gz" -> "archive"
|
|
11705
|
-
* - "filename" -> "filename"
|
|
11706
|
-
*/
|
|
11707
|
-
declare function stripFileExtension_2(filename: string): string;
|
|
11708
|
-
|
|
11709
10955
|
declare const symbol$1: unique symbol;
|
|
11710
10956
|
|
|
11711
10957
|
declare const symbol$1_2: unique symbol;
|
|
@@ -11776,8 +11022,6 @@ declare const symbol_2: unique symbol;
|
|
|
11776
11022
|
|
|
11777
11023
|
declare const symbol_3: unique symbol;
|
|
11778
11024
|
|
|
11779
|
-
declare const symbol_4: unique symbol;
|
|
11780
|
-
|
|
11781
11025
|
/**
|
|
11782
11026
|
* A system message. It can contain system information.
|
|
11783
11027
|
*
|
|
@@ -11786,24 +11030,6 @@ declare const symbol_4: unique symbol;
|
|
|
11786
11030
|
* and because not all providers support several system messages.
|
|
11787
11031
|
*/
|
|
11788
11032
|
export declare type SystemModelMessage = {
|
|
11789
|
-
role: 'system';
|
|
11790
|
-
content: string;
|
|
11791
|
-
/**
|
|
11792
|
-
* Additional provider-specific metadata. They are passed through
|
|
11793
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
11794
|
-
* functionality that can be fully encapsulated in the provider.
|
|
11795
|
-
*/
|
|
11796
|
-
providerOptions?: ProviderOptions_2;
|
|
11797
|
-
};
|
|
11798
|
-
|
|
11799
|
-
/**
|
|
11800
|
-
* A system message. It can contain system information.
|
|
11801
|
-
*
|
|
11802
|
-
* Note: using the "system" part of the prompt is strongly preferred
|
|
11803
|
-
* to increase the resilience against prompt injection attacks,
|
|
11804
|
-
* and because not all providers support several system messages.
|
|
11805
|
-
*/
|
|
11806
|
-
declare type SystemModelMessage_2 = {
|
|
11807
11033
|
role: 'system';
|
|
11808
11034
|
content: string;
|
|
11809
11035
|
/**
|
|
@@ -11876,23 +11102,6 @@ export declare type TelemetrySettings = {
|
|
|
11876
11102
|
* Text content part of a prompt. It contains a string of text.
|
|
11877
11103
|
*/
|
|
11878
11104
|
export declare interface TextPart {
|
|
11879
|
-
type: 'text';
|
|
11880
|
-
/**
|
|
11881
|
-
* The text content.
|
|
11882
|
-
*/
|
|
11883
|
-
text: string;
|
|
11884
|
-
/**
|
|
11885
|
-
* Additional provider-specific metadata. They are passed through
|
|
11886
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
11887
|
-
* functionality that can be fully encapsulated in the provider.
|
|
11888
|
-
*/
|
|
11889
|
-
providerOptions?: ProviderOptions_2;
|
|
11890
|
-
}
|
|
11891
|
-
|
|
11892
|
-
/**
|
|
11893
|
-
* Text content part of a prompt. It contains a string of text.
|
|
11894
|
-
*/
|
|
11895
|
-
declare interface TextPart_2 {
|
|
11896
11105
|
type: 'text';
|
|
11897
11106
|
/**
|
|
11898
11107
|
* The text content.
|
|
@@ -12060,7 +11269,17 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
12060
11269
|
* to the provider from the AI SDK and enable provider-specific
|
|
12061
11270
|
* functionality that can be fully encapsulated in the provider.
|
|
12062
11271
|
*/
|
|
12063
|
-
providerOptions?:
|
|
11272
|
+
providerOptions?: ProviderOptions;
|
|
11273
|
+
/**
|
|
11274
|
+
* Optional metadata about the tool itself (e.g. its source).
|
|
11275
|
+
*
|
|
11276
|
+
* Unlike `providerOptions`, this metadata is not sent to the language
|
|
11277
|
+
* model. Instead, it is propagated onto the resulting tool call's
|
|
11278
|
+
* `providerMetadata` so consumers can read it from tool call / result
|
|
11279
|
+
* parts and UI message parts. This is useful for sources of dynamic
|
|
11280
|
+
* tools (e.g. an MCP server) to identify themselves.
|
|
11281
|
+
*/
|
|
11282
|
+
providerMetadata?: SharedV3ProviderMetadata;
|
|
12064
11283
|
/**
|
|
12065
11284
|
* The schema of the input that the tool expects.
|
|
12066
11285
|
* The language model will use this to generate the input.
|
|
@@ -12079,7 +11298,7 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
12079
11298
|
/**
|
|
12080
11299
|
* Whether the tool needs approval before it can be executed.
|
|
12081
11300
|
*/
|
|
12082
|
-
needsApproval?: boolean |
|
|
11301
|
+
needsApproval?: boolean | ToolNeedsApprovalFunction<[INPUT] extends [never] ? unknown : INPUT>;
|
|
12083
11302
|
/**
|
|
12084
11303
|
* Strict mode setting for the tool.
|
|
12085
11304
|
*
|
|
@@ -12107,7 +11326,7 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
12107
11326
|
onInputAvailable?: (options: {
|
|
12108
11327
|
input: [INPUT] extends [never] ? unknown : INPUT;
|
|
12109
11328
|
} & ToolExecutionOptions) => void | PromiseLike<void>;
|
|
12110
|
-
} &
|
|
11329
|
+
} & ToolOutputProperties<INPUT, OUTPUT> & {
|
|
12111
11330
|
/**
|
|
12112
11331
|
* Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
12113
11332
|
*
|
|
@@ -12126,7 +11345,7 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
12126
11345
|
* The output of the tool call.
|
|
12127
11346
|
*/
|
|
12128
11347
|
output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>;
|
|
12129
|
-
}) =>
|
|
11348
|
+
}) => ToolResultOutput | PromiseLike<ToolResultOutput>;
|
|
12130
11349
|
} & ({
|
|
12131
11350
|
/**
|
|
12132
11351
|
* Tool with user-defined input and output schemas.
|
|
@@ -12178,146 +11397,6 @@ export declare function tool<OUTPUT>(tool: Tool<never, OUTPUT>): Tool<never, OUT
|
|
|
12178
11397
|
|
|
12179
11398
|
export declare function tool(tool: Tool<never, never>): Tool<never, never>;
|
|
12180
11399
|
|
|
12181
|
-
/**
|
|
12182
|
-
* A tool contains the description and the schema of the input that the tool expects.
|
|
12183
|
-
* This enables the language model to generate the input.
|
|
12184
|
-
*
|
|
12185
|
-
* The tool can also contain an optional execute function for the actual execution function of the tool.
|
|
12186
|
-
*/
|
|
12187
|
-
declare type Tool_2<INPUT extends JSONValue_2 | unknown | never = any, OUTPUT extends JSONValue_2 | unknown | never = any> = {
|
|
12188
|
-
/**
|
|
12189
|
-
* An optional description of what the tool does.
|
|
12190
|
-
* Will be used by the language model to decide whether to use the tool.
|
|
12191
|
-
* Not used for provider-defined tools.
|
|
12192
|
-
*/
|
|
12193
|
-
description?: string;
|
|
12194
|
-
/**
|
|
12195
|
-
* An optional title of the tool.
|
|
12196
|
-
*/
|
|
12197
|
-
title?: string;
|
|
12198
|
-
/**
|
|
12199
|
-
* Additional provider-specific metadata. They are passed through
|
|
12200
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
12201
|
-
* functionality that can be fully encapsulated in the provider.
|
|
12202
|
-
*/
|
|
12203
|
-
providerOptions?: ProviderOptions;
|
|
12204
|
-
/**
|
|
12205
|
-
* The schema of the input that the tool expects.
|
|
12206
|
-
* The language model will use this to generate the input.
|
|
12207
|
-
* It is also used to validate the output of the language model.
|
|
12208
|
-
*
|
|
12209
|
-
* You can use descriptions on the schema properties to make the input understandable for the language model.
|
|
12210
|
-
*/
|
|
12211
|
-
inputSchema: FlexibleSchema_2<INPUT>;
|
|
12212
|
-
/**
|
|
12213
|
-
* An optional list of input examples that show the language
|
|
12214
|
-
* model what the input should look like.
|
|
12215
|
-
*/
|
|
12216
|
-
inputExamples?: Array<{
|
|
12217
|
-
input: NoInfer<INPUT>;
|
|
12218
|
-
}>;
|
|
12219
|
-
/**
|
|
12220
|
-
* Whether the tool needs approval before it can be executed.
|
|
12221
|
-
*/
|
|
12222
|
-
needsApproval?: boolean | ToolNeedsApprovalFunction<[INPUT] extends [never] ? unknown : INPUT>;
|
|
12223
|
-
/**
|
|
12224
|
-
* Strict mode setting for the tool.
|
|
12225
|
-
*
|
|
12226
|
-
* Providers that support strict mode will use this setting to determine
|
|
12227
|
-
* how the input should be generated. Strict mode will always produce
|
|
12228
|
-
* valid inputs, but it might limit what input schemas are supported.
|
|
12229
|
-
*/
|
|
12230
|
-
strict?: boolean;
|
|
12231
|
-
/**
|
|
12232
|
-
* Optional function that is called when the argument streaming starts.
|
|
12233
|
-
* Only called when the tool is used in a streaming context.
|
|
12234
|
-
*/
|
|
12235
|
-
onInputStart?: (options: ToolExecutionOptions_2) => void | PromiseLike<void>;
|
|
12236
|
-
/**
|
|
12237
|
-
* Optional function that is called when an argument streaming delta is available.
|
|
12238
|
-
* Only called when the tool is used in a streaming context.
|
|
12239
|
-
*/
|
|
12240
|
-
onInputDelta?: (options: {
|
|
12241
|
-
inputTextDelta: string;
|
|
12242
|
-
} & ToolExecutionOptions_2) => void | PromiseLike<void>;
|
|
12243
|
-
/**
|
|
12244
|
-
* Optional function that is called when a tool call can be started,
|
|
12245
|
-
* even if the execute function is not provided.
|
|
12246
|
-
*/
|
|
12247
|
-
onInputAvailable?: (options: {
|
|
12248
|
-
input: [INPUT] extends [never] ? unknown : INPUT;
|
|
12249
|
-
} & ToolExecutionOptions_2) => void | PromiseLike<void>;
|
|
12250
|
-
} & ToolOutputProperties<INPUT, OUTPUT> & {
|
|
12251
|
-
/**
|
|
12252
|
-
* Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
12253
|
-
*
|
|
12254
|
-
* If not provided, the tool result will be sent as a JSON object.
|
|
12255
|
-
*/
|
|
12256
|
-
toModelOutput?: (options: {
|
|
12257
|
-
/**
|
|
12258
|
-
* The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
|
|
12259
|
-
*/
|
|
12260
|
-
toolCallId: string;
|
|
12261
|
-
/**
|
|
12262
|
-
* The input of the tool call.
|
|
12263
|
-
*/
|
|
12264
|
-
input: [INPUT] extends [never] ? unknown : INPUT;
|
|
12265
|
-
/**
|
|
12266
|
-
* The output of the tool call.
|
|
12267
|
-
*/
|
|
12268
|
-
output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>;
|
|
12269
|
-
}) => ToolResultOutput | PromiseLike<ToolResultOutput>;
|
|
12270
|
-
} & ({
|
|
12271
|
-
/**
|
|
12272
|
-
* Tool with user-defined input and output schemas.
|
|
12273
|
-
*/
|
|
12274
|
-
type?: undefined | 'function';
|
|
12275
|
-
} | {
|
|
12276
|
-
/**
|
|
12277
|
-
* Tool that is defined at runtime (e.g. an MCP tool).
|
|
12278
|
-
* The types of input and output are not known at development time.
|
|
12279
|
-
*/
|
|
12280
|
-
type: 'dynamic';
|
|
12281
|
-
} | {
|
|
12282
|
-
/**
|
|
12283
|
-
* Tool with provider-defined input and output schemas.
|
|
12284
|
-
*/
|
|
12285
|
-
type: 'provider';
|
|
12286
|
-
/**
|
|
12287
|
-
* The ID of the tool. Must follow the format `<provider-name>.<unique-tool-name>`.
|
|
12288
|
-
*/
|
|
12289
|
-
id: `${string}.${string}`;
|
|
12290
|
-
/**
|
|
12291
|
-
* The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
|
|
12292
|
-
*/
|
|
12293
|
-
args: Record<string, unknown>;
|
|
12294
|
-
/**
|
|
12295
|
-
* Whether this provider-executed tool supports deferred results.
|
|
12296
|
-
*
|
|
12297
|
-
* When true, the tool result may not be returned in the same turn as the
|
|
12298
|
-
* tool call (e.g., when using programmatic tool calling where a server tool
|
|
12299
|
-
* triggers a client-executed tool, and the server tool's result is deferred
|
|
12300
|
-
* until the client tool is resolved).
|
|
12301
|
-
*
|
|
12302
|
-
* This flag allows the AI SDK to handle tool results that arrive without
|
|
12303
|
-
* a matching tool call in the current response.
|
|
12304
|
-
*
|
|
12305
|
-
* @default false
|
|
12306
|
-
*/
|
|
12307
|
-
supportsDeferredResults?: boolean;
|
|
12308
|
-
});
|
|
12309
|
-
|
|
12310
|
-
/**
|
|
12311
|
-
* Helper function for inferring the execute args of a tool.
|
|
12312
|
-
*/
|
|
12313
|
-
declare function tool_2<INPUT, OUTPUT>(tool: Tool_2<INPUT, OUTPUT>): Tool_2<INPUT, OUTPUT>;
|
|
12314
|
-
|
|
12315
|
-
declare function tool_2<INPUT>(tool: Tool_2<INPUT, never>): Tool_2<INPUT, never>;
|
|
12316
|
-
|
|
12317
|
-
declare function tool_2<OUTPUT>(tool: Tool_2<never, OUTPUT>): Tool_2<never, OUTPUT>;
|
|
12318
|
-
|
|
12319
|
-
declare function tool_2(tool: Tool_2<never, never>): Tool_2<never, never>;
|
|
12320
|
-
|
|
12321
11400
|
/**
|
|
12322
11401
|
* Tool approval request prompt part.
|
|
12323
11402
|
*/
|
|
@@ -12333,21 +11412,6 @@ export declare type ToolApprovalRequest = {
|
|
|
12333
11412
|
toolCallId: string;
|
|
12334
11413
|
};
|
|
12335
11414
|
|
|
12336
|
-
/**
|
|
12337
|
-
* Tool approval request prompt part.
|
|
12338
|
-
*/
|
|
12339
|
-
declare type ToolApprovalRequest_2 = {
|
|
12340
|
-
type: 'tool-approval-request';
|
|
12341
|
-
/**
|
|
12342
|
-
* ID of the tool approval.
|
|
12343
|
-
*/
|
|
12344
|
-
approvalId: string;
|
|
12345
|
-
/**
|
|
12346
|
-
* ID of the tool call that the approval request is for.
|
|
12347
|
-
*/
|
|
12348
|
-
toolCallId: string;
|
|
12349
|
-
};
|
|
12350
|
-
|
|
12351
11415
|
/**
|
|
12352
11416
|
* Output part that indicates that a tool approval request has been made.
|
|
12353
11417
|
*
|
|
@@ -12389,30 +11453,6 @@ export declare type ToolApprovalResponse = {
|
|
|
12389
11453
|
providerExecuted?: boolean;
|
|
12390
11454
|
};
|
|
12391
11455
|
|
|
12392
|
-
/**
|
|
12393
|
-
* Tool approval response prompt part.
|
|
12394
|
-
*/
|
|
12395
|
-
declare type ToolApprovalResponse_2 = {
|
|
12396
|
-
type: 'tool-approval-response';
|
|
12397
|
-
/**
|
|
12398
|
-
* ID of the tool approval.
|
|
12399
|
-
*/
|
|
12400
|
-
approvalId: string;
|
|
12401
|
-
/**
|
|
12402
|
-
* Flag indicating whether the approval was granted or denied.
|
|
12403
|
-
*/
|
|
12404
|
-
approved: boolean;
|
|
12405
|
-
/**
|
|
12406
|
-
* Optional reason for the approval or denial.
|
|
12407
|
-
*/
|
|
12408
|
-
reason?: string;
|
|
12409
|
-
/**
|
|
12410
|
-
* Flag indicating whether the tool call is provider-executed.
|
|
12411
|
-
* Only provider-executed tool approval responses should be sent to the model.
|
|
12412
|
-
*/
|
|
12413
|
-
providerExecuted?: boolean;
|
|
12414
|
-
};
|
|
12415
|
-
|
|
12416
11456
|
/**
|
|
12417
11457
|
* Typed tool call that is returned by generateText and streamText.
|
|
12418
11458
|
* It contains the tool call ID, the tool name, and the tool arguments.
|
|
@@ -12441,34 +11481,6 @@ declare interface ToolCall<NAME extends string, INPUT> {
|
|
|
12441
11481
|
dynamic?: boolean;
|
|
12442
11482
|
}
|
|
12443
11483
|
|
|
12444
|
-
/**
|
|
12445
|
-
* Typed tool call that is returned by generateText and streamText.
|
|
12446
|
-
* It contains the tool call ID, the tool name, and the tool arguments.
|
|
12447
|
-
*/
|
|
12448
|
-
declare interface ToolCall_2<NAME extends string, INPUT> {
|
|
12449
|
-
/**
|
|
12450
|
-
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
12451
|
-
*/
|
|
12452
|
-
toolCallId: string;
|
|
12453
|
-
/**
|
|
12454
|
-
* Name of the tool that is being called.
|
|
12455
|
-
*/
|
|
12456
|
-
toolName: NAME;
|
|
12457
|
-
/**
|
|
12458
|
-
* Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
12459
|
-
*/
|
|
12460
|
-
input: INPUT;
|
|
12461
|
-
/**
|
|
12462
|
-
* Whether the tool call will be executed by the provider.
|
|
12463
|
-
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
12464
|
-
*/
|
|
12465
|
-
providerExecuted?: boolean;
|
|
12466
|
-
/**
|
|
12467
|
-
* Whether the tool is dynamic.
|
|
12468
|
-
*/
|
|
12469
|
-
dynamic?: boolean;
|
|
12470
|
-
}
|
|
12471
|
-
|
|
12472
11484
|
export declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
12473
11485
|
private readonly [symbol$e];
|
|
12474
11486
|
readonly toolCallId: string;
|
|
@@ -12485,44 +11497,10 @@ export declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
|
12485
11497
|
*/
|
|
12486
11498
|
export declare type ToolCallOptions = ToolExecutionOptions;
|
|
12487
11499
|
|
|
12488
|
-
/**
|
|
12489
|
-
* @deprecated Use ToolExecutionOptions instead.
|
|
12490
|
-
*/
|
|
12491
|
-
declare type ToolCallOptions_2 = ToolExecutionOptions_2;
|
|
12492
|
-
|
|
12493
11500
|
/**
|
|
12494
11501
|
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
12495
11502
|
*/
|
|
12496
11503
|
export declare interface ToolCallPart {
|
|
12497
|
-
type: 'tool-call';
|
|
12498
|
-
/**
|
|
12499
|
-
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
12500
|
-
*/
|
|
12501
|
-
toolCallId: string;
|
|
12502
|
-
/**
|
|
12503
|
-
* Name of the tool that is being called.
|
|
12504
|
-
*/
|
|
12505
|
-
toolName: string;
|
|
12506
|
-
/**
|
|
12507
|
-
* Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
12508
|
-
*/
|
|
12509
|
-
input: unknown;
|
|
12510
|
-
/**
|
|
12511
|
-
* Additional provider-specific metadata. They are passed through
|
|
12512
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
12513
|
-
* functionality that can be fully encapsulated in the provider.
|
|
12514
|
-
*/
|
|
12515
|
-
providerOptions?: ProviderOptions_2;
|
|
12516
|
-
/**
|
|
12517
|
-
* Whether the tool call was executed by the provider.
|
|
12518
|
-
*/
|
|
12519
|
-
providerExecuted?: boolean;
|
|
12520
|
-
}
|
|
12521
|
-
|
|
12522
|
-
/**
|
|
12523
|
-
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
12524
|
-
*/
|
|
12525
|
-
declare interface ToolCallPart_2 {
|
|
12526
11504
|
type: 'tool-call';
|
|
12527
11505
|
/**
|
|
12528
11506
|
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
@@ -12601,15 +11579,8 @@ export declare type ToolChoice<TOOLS extends Record<string, unknown>> = 'auto' |
|
|
|
12601
11579
|
*/
|
|
12602
11580
|
export declare type ToolContent = Array<ToolResultPart | ToolApprovalResponse>;
|
|
12603
11581
|
|
|
12604
|
-
/**
|
|
12605
|
-
* Content of a tool message. It is an array of tool result parts.
|
|
12606
|
-
*/
|
|
12607
|
-
declare type ToolContent_2 = Array<ToolResultPart_2 | ToolApprovalResponse_2>;
|
|
12608
|
-
|
|
12609
11582
|
export declare type ToolExecuteFunction<INPUT, OUTPUT> = (input: INPUT, options: ToolExecutionOptions) => AsyncIterable<OUTPUT> | PromiseLike<OUTPUT> | OUTPUT;
|
|
12610
11583
|
|
|
12611
|
-
declare type ToolExecuteFunction_2<INPUT, OUTPUT> = (input: INPUT, options: ToolExecutionOptions_2) => AsyncIterable<OUTPUT> | PromiseLike<OUTPUT> | OUTPUT;
|
|
12612
|
-
|
|
12613
11584
|
/**
|
|
12614
11585
|
* Additional options that are sent into each tool call.
|
|
12615
11586
|
*/
|
|
@@ -12642,38 +11613,6 @@ export declare interface ToolExecutionOptions {
|
|
|
12642
11613
|
experimental_context?: unknown;
|
|
12643
11614
|
}
|
|
12644
11615
|
|
|
12645
|
-
/**
|
|
12646
|
-
* Additional options that are sent into each tool call.
|
|
12647
|
-
*/
|
|
12648
|
-
declare interface ToolExecutionOptions_2 {
|
|
12649
|
-
/**
|
|
12650
|
-
* The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
|
|
12651
|
-
*/
|
|
12652
|
-
toolCallId: string;
|
|
12653
|
-
/**
|
|
12654
|
-
* Messages that were sent to the language model to initiate the response that contained the tool call.
|
|
12655
|
-
* The messages **do not** include the system prompt nor the assistant response that contained the tool call.
|
|
12656
|
-
*/
|
|
12657
|
-
messages: ModelMessage_2[];
|
|
12658
|
-
/**
|
|
12659
|
-
* An optional abort signal that indicates that the overall operation should be aborted.
|
|
12660
|
-
*/
|
|
12661
|
-
abortSignal?: AbortSignal;
|
|
12662
|
-
/**
|
|
12663
|
-
* User-defined context.
|
|
12664
|
-
*
|
|
12665
|
-
* Treat the context object as immutable inside tools.
|
|
12666
|
-
* Mutating the context object can lead to race conditions and unexpected results
|
|
12667
|
-
* when tools are called in parallel.
|
|
12668
|
-
*
|
|
12669
|
-
* If you need to mutate the context, analyze the tool calls and results
|
|
12670
|
-
* in `prepareStep` and update it there.
|
|
12671
|
-
*
|
|
12672
|
-
* Experimental (can break in patch releases).
|
|
12673
|
-
*/
|
|
12674
|
-
experimental_context?: unknown;
|
|
12675
|
-
}
|
|
12676
|
-
|
|
12677
11616
|
/**
|
|
12678
11617
|
* A tool loop agent is an agent that runs tools in a loop. In each step,
|
|
12679
11618
|
* it calls the LLM, and if there are tool calls, it executes the tools
|
|
@@ -12698,31 +11637,23 @@ declare class ToolLoopAgent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OU
|
|
|
12698
11637
|
*/
|
|
12699
11638
|
get tools(): TOOLS;
|
|
12700
11639
|
private prepareCall;
|
|
12701
|
-
private
|
|
11640
|
+
private mergeOnStepFinishCallbacks;
|
|
12702
11641
|
/**
|
|
12703
11642
|
* Generates an output from the agent (non-streaming).
|
|
12704
11643
|
*/
|
|
12705
|
-
generate({ abortSignal, timeout,
|
|
11644
|
+
generate({ abortSignal, timeout, onStepFinish, ...options }: AgentCallParameters<CALL_OPTIONS, TOOLS>): Promise<GenerateTextResult<TOOLS, OUTPUT>>;
|
|
12706
11645
|
/**
|
|
12707
11646
|
* Streams an output from the agent (streaming).
|
|
12708
11647
|
*/
|
|
12709
|
-
stream({ abortSignal, timeout, experimental_transform,
|
|
11648
|
+
stream({ abortSignal, timeout, experimental_transform, onStepFinish, ...options }: AgentStreamParameters<CALL_OPTIONS, TOOLS>): Promise<StreamTextResult<TOOLS, OUTPUT>>;
|
|
12710
11649
|
}
|
|
12711
11650
|
export { ToolLoopAgent as Experimental_Agent }
|
|
12712
11651
|
export { ToolLoopAgent }
|
|
12713
11652
|
|
|
12714
11653
|
export declare type ToolLoopAgentOnFinishCallback<TOOLS extends ToolSet = {}> = (event: OnFinishEvent<TOOLS>) => PromiseLike<void> | void;
|
|
12715
11654
|
|
|
12716
|
-
export declare type ToolLoopAgentOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output_2 = Output_2> = (event: OnStartEvent<TOOLS, OUTPUT>) => PromiseLike<void> | void;
|
|
12717
|
-
|
|
12718
11655
|
export declare type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}> = (stepResult: OnStepFinishEvent<TOOLS>) => Promise<void> | void;
|
|
12719
11656
|
|
|
12720
|
-
export declare type ToolLoopAgentOnStepStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output_2 = Output_2> = (event: OnStepStartEvent<TOOLS, OUTPUT>) => PromiseLike<void> | void;
|
|
12721
|
-
|
|
12722
|
-
export declare type ToolLoopAgentOnToolCallFinishCallback<TOOLS extends ToolSet = ToolSet> = (event: OnToolCallFinishEvent<TOOLS>) => PromiseLike<void> | void;
|
|
12723
|
-
|
|
12724
|
-
export declare type ToolLoopAgentOnToolCallStartCallback<TOOLS extends ToolSet = ToolSet> = (event: OnToolCallStartEvent<TOOLS>) => PromiseLike<void> | void;
|
|
12725
|
-
|
|
12726
11657
|
/**
|
|
12727
11658
|
* Configuration options for an agent.
|
|
12728
11659
|
*/
|
|
@@ -12777,22 +11708,6 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
12777
11708
|
* A function that attempts to repair a tool call that failed to parse.
|
|
12778
11709
|
*/
|
|
12779
11710
|
experimental_repairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>;
|
|
12780
|
-
/**
|
|
12781
|
-
* Callback that is called when the agent operation begins, before any LLM calls.
|
|
12782
|
-
*/
|
|
12783
|
-
experimental_onStart?: ToolLoopAgentOnStartCallback<NoInfer<TOOLS>, OUTPUT>;
|
|
12784
|
-
/**
|
|
12785
|
-
* Callback that is called when a step (LLM call) begins, before the provider is called.
|
|
12786
|
-
*/
|
|
12787
|
-
experimental_onStepStart?: ToolLoopAgentOnStepStartCallback<NoInfer<TOOLS>, OUTPUT>;
|
|
12788
|
-
/**
|
|
12789
|
-
* Callback that is called before each tool execution begins.
|
|
12790
|
-
*/
|
|
12791
|
-
experimental_onToolCallStart?: ToolLoopAgentOnToolCallStartCallback<NoInfer<TOOLS>>;
|
|
12792
|
-
/**
|
|
12793
|
-
* Callback that is called after each tool execution completes.
|
|
12794
|
-
*/
|
|
12795
|
-
experimental_onToolCallFinish?: ToolLoopAgentOnToolCallFinishCallback<NoInfer<TOOLS>>;
|
|
12796
11711
|
/**
|
|
12797
11712
|
* Callback that is called when each step (LLM call) is finished, including intermediate steps.
|
|
12798
11713
|
*/
|
|
@@ -12806,7 +11721,7 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
12806
11721
|
* to the provider from the AI SDK and enable provider-specific
|
|
12807
11722
|
* functionality that can be fully encapsulated in the provider.
|
|
12808
11723
|
*/
|
|
12809
|
-
providerOptions?:
|
|
11724
|
+
providerOptions?: ProviderOptions;
|
|
12810
11725
|
/**
|
|
12811
11726
|
* Context that is passed into tool calls.
|
|
12812
11727
|
*
|
|
@@ -12830,7 +11745,7 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
12830
11745
|
*
|
|
12831
11746
|
* You can use this to have templates based on call options.
|
|
12832
11747
|
*/
|
|
12833
|
-
prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) =>
|
|
11748
|
+
prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
|
|
12834
11749
|
};
|
|
12835
11750
|
export { ToolLoopAgentSettings as Experimental_AgentSettings }
|
|
12836
11751
|
export { ToolLoopAgentSettings }
|
|
@@ -12841,20 +11756,6 @@ export { ToolLoopAgentSettings }
|
|
|
12841
11756
|
export declare type ToolModelMessage = {
|
|
12842
11757
|
role: 'tool';
|
|
12843
11758
|
content: ToolContent;
|
|
12844
|
-
/**
|
|
12845
|
-
* Additional provider-specific metadata. They are passed through
|
|
12846
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
12847
|
-
* functionality that can be fully encapsulated in the provider.
|
|
12848
|
-
*/
|
|
12849
|
-
providerOptions?: ProviderOptions_2;
|
|
12850
|
-
};
|
|
12851
|
-
|
|
12852
|
-
/**
|
|
12853
|
-
* A tool message. It contains the result of one or more tool calls.
|
|
12854
|
-
*/
|
|
12855
|
-
declare type ToolModelMessage_2 = {
|
|
12856
|
-
role: 'tool';
|
|
12857
|
-
content: ToolContent_2;
|
|
12858
11759
|
/**
|
|
12859
11760
|
* Additional provider-specific metadata. They are passed through
|
|
12860
11761
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -12887,53 +11788,10 @@ declare interface ToolNameMapping {
|
|
|
12887
11788
|
toCustomToolName: (providerToolName: string) => string;
|
|
12888
11789
|
}
|
|
12889
11790
|
|
|
12890
|
-
/**
|
|
12891
|
-
* Interface for mapping between custom tool names and provider tool names.
|
|
12892
|
-
*/
|
|
12893
|
-
declare interface ToolNameMapping_2 {
|
|
12894
|
-
/**
|
|
12895
|
-
* Maps a custom tool name (used by the client) to the provider's tool name.
|
|
12896
|
-
* If the custom tool name does not have a mapping, returns the input name.
|
|
12897
|
-
*
|
|
12898
|
-
* @param customToolName - The custom name of the tool defined by the client.
|
|
12899
|
-
* @returns The corresponding provider tool name, or the input name if not mapped.
|
|
12900
|
-
*/
|
|
12901
|
-
toProviderToolName: (customToolName: string) => string;
|
|
12902
|
-
/**
|
|
12903
|
-
* Maps a provider tool name to the custom tool name used by the client.
|
|
12904
|
-
* If the provider tool name does not have a mapping, returns the input name.
|
|
12905
|
-
*
|
|
12906
|
-
* @param providerToolName - The name of the tool as understood by the provider.
|
|
12907
|
-
* @returns The corresponding custom tool name, or the input name if not mapped.
|
|
12908
|
-
*/
|
|
12909
|
-
toCustomToolName: (providerToolName: string) => string;
|
|
12910
|
-
}
|
|
12911
|
-
|
|
12912
11791
|
/**
|
|
12913
11792
|
* Function that is called to determine if the tool needs approval before it can be executed.
|
|
12914
11793
|
*/
|
|
12915
11794
|
declare type ToolNeedsApprovalFunction<INPUT> = (input: INPUT, options: {
|
|
12916
|
-
/**
|
|
12917
|
-
* The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
|
|
12918
|
-
*/
|
|
12919
|
-
toolCallId: string;
|
|
12920
|
-
/**
|
|
12921
|
-
* Messages that were sent to the language model to initiate the response that contained the tool call.
|
|
12922
|
-
* The messages **do not** include the system prompt nor the assistant response that contained the tool call.
|
|
12923
|
-
*/
|
|
12924
|
-
messages: ModelMessage_2[];
|
|
12925
|
-
/**
|
|
12926
|
-
* Additional context.
|
|
12927
|
-
*
|
|
12928
|
-
* Experimental (can break in patch releases).
|
|
12929
|
-
*/
|
|
12930
|
-
experimental_context?: unknown;
|
|
12931
|
-
}) => boolean | PromiseLike<boolean>;
|
|
12932
|
-
|
|
12933
|
-
/**
|
|
12934
|
-
* Function that is called to determine if the tool needs approval before it can be executed.
|
|
12935
|
-
*/
|
|
12936
|
-
declare type ToolNeedsApprovalFunction_2<INPUT> = (input: INPUT, options: {
|
|
12937
11795
|
/**
|
|
12938
11796
|
* The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
|
|
12939
11797
|
*/
|
|
@@ -12952,21 +11810,6 @@ declare type ToolNeedsApprovalFunction_2<INPUT> = (input: INPUT, options: {
|
|
|
12952
11810
|
}) => boolean | PromiseLike<boolean>;
|
|
12953
11811
|
|
|
12954
11812
|
declare type ToolOutputProperties<INPUT, OUTPUT> = NeverOptional<OUTPUT, {
|
|
12955
|
-
/**
|
|
12956
|
-
* An async function that is called with the arguments from the tool call and produces a result.
|
|
12957
|
-
* If not provided, the tool will not be executed automatically.
|
|
12958
|
-
*
|
|
12959
|
-
* @args is the input of the tool call.
|
|
12960
|
-
* @options.abortSignal is a signal that can be used to abort the tool call.
|
|
12961
|
-
*/
|
|
12962
|
-
execute: ToolExecuteFunction_2<INPUT, OUTPUT>;
|
|
12963
|
-
outputSchema?: FlexibleSchema_2<OUTPUT>;
|
|
12964
|
-
} | {
|
|
12965
|
-
outputSchema: FlexibleSchema_2<OUTPUT>;
|
|
12966
|
-
execute?: never;
|
|
12967
|
-
}>;
|
|
12968
|
-
|
|
12969
|
-
declare type ToolOutputProperties_2<INPUT, OUTPUT> = NeverOptional_2<OUTPUT, {
|
|
12970
11813
|
/**
|
|
12971
11814
|
* An async function that is called with the arguments from the tool call and produces a result.
|
|
12972
11815
|
* If not provided, the tool will not be executed automatically.
|
|
@@ -12978,45 +11821,14 @@ declare type ToolOutputProperties_2<INPUT, OUTPUT> = NeverOptional_2<OUTPUT, {
|
|
|
12978
11821
|
outputSchema?: FlexibleSchema<OUTPUT>;
|
|
12979
11822
|
} | {
|
|
12980
11823
|
outputSchema: FlexibleSchema<OUTPUT>;
|
|
12981
|
-
execute?: never;
|
|
12982
|
-
}>;
|
|
12983
|
-
|
|
12984
|
-
/**
|
|
12985
|
-
* Typed tool result that is returned by `generateText` and `streamText`.
|
|
12986
|
-
* It contains the tool call ID, the tool name, the tool arguments, and the tool result.
|
|
12987
|
-
*/
|
|
12988
|
-
declare interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
12989
|
-
/**
|
|
12990
|
-
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
12991
|
-
*/
|
|
12992
|
-
toolCallId: string;
|
|
12993
|
-
/**
|
|
12994
|
-
* Name of the tool that was called.
|
|
12995
|
-
*/
|
|
12996
|
-
toolName: NAME;
|
|
12997
|
-
/**
|
|
12998
|
-
* Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
12999
|
-
*/
|
|
13000
|
-
input: INPUT;
|
|
13001
|
-
/**
|
|
13002
|
-
* Result of the tool call. This is the result of the tool's execution.
|
|
13003
|
-
*/
|
|
13004
|
-
output: OUTPUT;
|
|
13005
|
-
/**
|
|
13006
|
-
* Whether the tool result has been executed by the provider.
|
|
13007
|
-
*/
|
|
13008
|
-
providerExecuted?: boolean;
|
|
13009
|
-
/**
|
|
13010
|
-
* Whether the tool is dynamic.
|
|
13011
|
-
*/
|
|
13012
|
-
dynamic?: boolean;
|
|
13013
|
-
}
|
|
11824
|
+
execute?: never;
|
|
11825
|
+
}>;
|
|
13014
11826
|
|
|
13015
11827
|
/**
|
|
13016
11828
|
* Typed tool result that is returned by `generateText` and `streamText`.
|
|
13017
11829
|
* It contains the tool call ID, the tool name, the tool arguments, and the tool result.
|
|
13018
11830
|
*/
|
|
13019
|
-
declare interface
|
|
11831
|
+
declare interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
13020
11832
|
/**
|
|
13021
11833
|
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
13022
11834
|
*/
|
|
@@ -13215,207 +12027,10 @@ declare type ToolResultOutput = {
|
|
|
13215
12027
|
}>;
|
|
13216
12028
|
};
|
|
13217
12029
|
|
|
13218
|
-
/**
|
|
13219
|
-
* Output of a tool result.
|
|
13220
|
-
*/
|
|
13221
|
-
declare type ToolResultOutput_2 = {
|
|
13222
|
-
/**
|
|
13223
|
-
* Text tool output that should be directly sent to the API.
|
|
13224
|
-
*/
|
|
13225
|
-
type: 'text';
|
|
13226
|
-
value: string;
|
|
13227
|
-
/**
|
|
13228
|
-
* Provider-specific options.
|
|
13229
|
-
*/
|
|
13230
|
-
providerOptions?: ProviderOptions_2;
|
|
13231
|
-
} | {
|
|
13232
|
-
type: 'json';
|
|
13233
|
-
value: JSONValue_2;
|
|
13234
|
-
/**
|
|
13235
|
-
* Provider-specific options.
|
|
13236
|
-
*/
|
|
13237
|
-
providerOptions?: ProviderOptions_2;
|
|
13238
|
-
} | {
|
|
13239
|
-
/**
|
|
13240
|
-
* Type when the user has denied the execution of the tool call.
|
|
13241
|
-
*/
|
|
13242
|
-
type: 'execution-denied';
|
|
13243
|
-
/**
|
|
13244
|
-
* Optional reason for the execution denial.
|
|
13245
|
-
*/
|
|
13246
|
-
reason?: string;
|
|
13247
|
-
/**
|
|
13248
|
-
* Provider-specific options.
|
|
13249
|
-
*/
|
|
13250
|
-
providerOptions?: ProviderOptions_2;
|
|
13251
|
-
} | {
|
|
13252
|
-
type: 'error-text';
|
|
13253
|
-
value: string;
|
|
13254
|
-
/**
|
|
13255
|
-
* Provider-specific options.
|
|
13256
|
-
*/
|
|
13257
|
-
providerOptions?: ProviderOptions_2;
|
|
13258
|
-
} | {
|
|
13259
|
-
type: 'error-json';
|
|
13260
|
-
value: JSONValue_2;
|
|
13261
|
-
/**
|
|
13262
|
-
* Provider-specific options.
|
|
13263
|
-
*/
|
|
13264
|
-
providerOptions?: ProviderOptions_2;
|
|
13265
|
-
} | {
|
|
13266
|
-
type: 'content';
|
|
13267
|
-
value: Array<{
|
|
13268
|
-
type: 'text';
|
|
13269
|
-
/**
|
|
13270
|
-
* Text content.
|
|
13271
|
-
*/
|
|
13272
|
-
text: string;
|
|
13273
|
-
/**
|
|
13274
|
-
* Provider-specific options.
|
|
13275
|
-
*/
|
|
13276
|
-
providerOptions?: ProviderOptions_2;
|
|
13277
|
-
} | {
|
|
13278
|
-
/**
|
|
13279
|
-
* @deprecated Use image-data or file-data instead.
|
|
13280
|
-
*/
|
|
13281
|
-
type: 'media';
|
|
13282
|
-
data: string;
|
|
13283
|
-
mediaType: string;
|
|
13284
|
-
} | {
|
|
13285
|
-
type: 'file-data';
|
|
13286
|
-
/**
|
|
13287
|
-
* Base-64 encoded media data.
|
|
13288
|
-
*/
|
|
13289
|
-
data: string;
|
|
13290
|
-
/**
|
|
13291
|
-
* IANA media type.
|
|
13292
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
13293
|
-
*/
|
|
13294
|
-
mediaType: string;
|
|
13295
|
-
/**
|
|
13296
|
-
* Optional filename of the file.
|
|
13297
|
-
*/
|
|
13298
|
-
filename?: string;
|
|
13299
|
-
/**
|
|
13300
|
-
* Provider-specific options.
|
|
13301
|
-
*/
|
|
13302
|
-
providerOptions?: ProviderOptions_2;
|
|
13303
|
-
} | {
|
|
13304
|
-
type: 'file-url';
|
|
13305
|
-
/**
|
|
13306
|
-
* URL of the file.
|
|
13307
|
-
*/
|
|
13308
|
-
url: string;
|
|
13309
|
-
/**
|
|
13310
|
-
* Provider-specific options.
|
|
13311
|
-
*/
|
|
13312
|
-
providerOptions?: ProviderOptions_2;
|
|
13313
|
-
} | {
|
|
13314
|
-
type: 'file-id';
|
|
13315
|
-
/**
|
|
13316
|
-
* ID of the file.
|
|
13317
|
-
*
|
|
13318
|
-
* If you use multiple providers, you need to
|
|
13319
|
-
* specify the provider specific ids using
|
|
13320
|
-
* the Record option. The key is the provider
|
|
13321
|
-
* name, e.g. 'openai' or 'anthropic'.
|
|
13322
|
-
*/
|
|
13323
|
-
fileId: string | Record<string, string>;
|
|
13324
|
-
/**
|
|
13325
|
-
* Provider-specific options.
|
|
13326
|
-
*/
|
|
13327
|
-
providerOptions?: ProviderOptions_2;
|
|
13328
|
-
} | {
|
|
13329
|
-
/**
|
|
13330
|
-
* Images that are referenced using base64 encoded data.
|
|
13331
|
-
*/
|
|
13332
|
-
type: 'image-data';
|
|
13333
|
-
/**
|
|
13334
|
-
* Base-64 encoded image data.
|
|
13335
|
-
*/
|
|
13336
|
-
data: string;
|
|
13337
|
-
/**
|
|
13338
|
-
* IANA media type.
|
|
13339
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
13340
|
-
*/
|
|
13341
|
-
mediaType: string;
|
|
13342
|
-
/**
|
|
13343
|
-
* Provider-specific options.
|
|
13344
|
-
*/
|
|
13345
|
-
providerOptions?: ProviderOptions_2;
|
|
13346
|
-
} | {
|
|
13347
|
-
/**
|
|
13348
|
-
* Images that are referenced using a URL.
|
|
13349
|
-
*/
|
|
13350
|
-
type: 'image-url';
|
|
13351
|
-
/**
|
|
13352
|
-
* URL of the image.
|
|
13353
|
-
*/
|
|
13354
|
-
url: string;
|
|
13355
|
-
/**
|
|
13356
|
-
* Provider-specific options.
|
|
13357
|
-
*/
|
|
13358
|
-
providerOptions?: ProviderOptions_2;
|
|
13359
|
-
} | {
|
|
13360
|
-
/**
|
|
13361
|
-
* Images that are referenced using a provider file id.
|
|
13362
|
-
*/
|
|
13363
|
-
type: 'image-file-id';
|
|
13364
|
-
/**
|
|
13365
|
-
* Image that is referenced using a provider file id.
|
|
13366
|
-
*
|
|
13367
|
-
* If you use multiple providers, you need to
|
|
13368
|
-
* specify the provider specific ids using
|
|
13369
|
-
* the Record option. The key is the provider
|
|
13370
|
-
* name, e.g. 'openai' or 'anthropic'.
|
|
13371
|
-
*/
|
|
13372
|
-
fileId: string | Record<string, string>;
|
|
13373
|
-
/**
|
|
13374
|
-
* Provider-specific options.
|
|
13375
|
-
*/
|
|
13376
|
-
providerOptions?: ProviderOptions_2;
|
|
13377
|
-
} | {
|
|
13378
|
-
/**
|
|
13379
|
-
* Custom content part. This can be used to implement
|
|
13380
|
-
* provider-specific content parts.
|
|
13381
|
-
*/
|
|
13382
|
-
type: 'custom';
|
|
13383
|
-
/**
|
|
13384
|
-
* Provider-specific options.
|
|
13385
|
-
*/
|
|
13386
|
-
providerOptions?: ProviderOptions_2;
|
|
13387
|
-
}>;
|
|
13388
|
-
};
|
|
13389
|
-
|
|
13390
12030
|
/**
|
|
13391
12031
|
* Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
13392
12032
|
*/
|
|
13393
12033
|
export declare interface ToolResultPart {
|
|
13394
|
-
type: 'tool-result';
|
|
13395
|
-
/**
|
|
13396
|
-
* ID of the tool call that this result is associated with.
|
|
13397
|
-
*/
|
|
13398
|
-
toolCallId: string;
|
|
13399
|
-
/**
|
|
13400
|
-
* Name of the tool that generated this result.
|
|
13401
|
-
*/
|
|
13402
|
-
toolName: string;
|
|
13403
|
-
/**
|
|
13404
|
-
* Result of the tool call. This is a JSON-serializable object.
|
|
13405
|
-
*/
|
|
13406
|
-
output: ToolResultOutput_2;
|
|
13407
|
-
/**
|
|
13408
|
-
* Additional provider-specific metadata. They are passed through
|
|
13409
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
13410
|
-
* functionality that can be fully encapsulated in the provider.
|
|
13411
|
-
*/
|
|
13412
|
-
providerOptions?: ProviderOptions_2;
|
|
13413
|
-
}
|
|
13414
|
-
|
|
13415
|
-
/**
|
|
13416
|
-
* Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
13417
|
-
*/
|
|
13418
|
-
declare interface ToolResultPart_2 {
|
|
13419
12034
|
type: 'tool-result';
|
|
13420
12035
|
/**
|
|
13421
12036
|
* ID of the tool call that this result is associated with.
|
|
@@ -14043,6 +12658,7 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
14043
12658
|
toolCallId: string;
|
|
14044
12659
|
output: unknown;
|
|
14045
12660
|
providerExecuted?: boolean;
|
|
12661
|
+
providerMetadata?: ProviderMetadata;
|
|
14046
12662
|
dynamic?: boolean;
|
|
14047
12663
|
preliminary?: boolean;
|
|
14048
12664
|
} | {
|
|
@@ -14050,6 +12666,7 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
14050
12666
|
toolCallId: string;
|
|
14051
12667
|
errorText: string;
|
|
14052
12668
|
providerExecuted?: boolean;
|
|
12669
|
+
providerMetadata?: ProviderMetadata;
|
|
14053
12670
|
dynamic?: boolean;
|
|
14054
12671
|
} | {
|
|
14055
12672
|
type: 'tool-output-denied';
|
|
@@ -14104,7 +12721,7 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
14104
12721
|
messageMetadata: METADATA;
|
|
14105
12722
|
};
|
|
14106
12723
|
|
|
14107
|
-
export declare const uiMessageChunkSchema:
|
|
12724
|
+
export declare const uiMessageChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
14108
12725
|
type: "text-start";
|
|
14109
12726
|
id: string;
|
|
14110
12727
|
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
@@ -14160,6 +12777,7 @@ export declare const uiMessageChunkSchema: _ai_sdk_provider_utils_2.LazySchema<{
|
|
|
14160
12777
|
toolCallId: string;
|
|
14161
12778
|
output: unknown;
|
|
14162
12779
|
providerExecuted?: boolean | undefined;
|
|
12780
|
+
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
14163
12781
|
dynamic?: boolean | undefined;
|
|
14164
12782
|
preliminary?: boolean | undefined;
|
|
14165
12783
|
} | {
|
|
@@ -14167,6 +12785,7 @@ export declare const uiMessageChunkSchema: _ai_sdk_provider_utils_2.LazySchema<{
|
|
|
14167
12785
|
toolCallId: string;
|
|
14168
12786
|
errorText: string;
|
|
14169
12787
|
providerExecuted?: boolean | undefined;
|
|
12788
|
+
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
14170
12789
|
dynamic?: boolean | undefined;
|
|
14171
12790
|
} | {
|
|
14172
12791
|
type: "tool-output-denied";
|
|
@@ -14451,6 +13070,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14451
13070
|
output: asUITool<TOOL>['output'];
|
|
14452
13071
|
errorText?: never;
|
|
14453
13072
|
callProviderMetadata?: ProviderMetadata;
|
|
13073
|
+
resultProviderMetadata?: ProviderMetadata;
|
|
14454
13074
|
preliminary?: boolean;
|
|
14455
13075
|
approval?: {
|
|
14456
13076
|
id: string;
|
|
@@ -14464,6 +13084,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14464
13084
|
output?: never;
|
|
14465
13085
|
errorText: string;
|
|
14466
13086
|
callProviderMetadata?: ProviderMetadata;
|
|
13087
|
+
resultProviderMetadata?: ProviderMetadata;
|
|
14467
13088
|
approval?: {
|
|
14468
13089
|
id: string;
|
|
14469
13090
|
approved: true;
|
|
@@ -14485,7 +13106,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14485
13106
|
export declare type UITools = Record<string, UITool>;
|
|
14486
13107
|
|
|
14487
13108
|
export declare class UnsupportedFunctionalityError extends AISDKError {
|
|
14488
|
-
private readonly [
|
|
13109
|
+
private readonly [symbol];
|
|
14489
13110
|
readonly functionality: string;
|
|
14490
13111
|
constructor({ functionality, message, }: {
|
|
14491
13112
|
functionality: string;
|
|
@@ -14567,7 +13188,7 @@ export declare type UseCompletionOptions = {
|
|
|
14567
13188
|
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
14568
13189
|
* or to provide a custom fetch implementation for e.g. testing.
|
|
14569
13190
|
*/
|
|
14570
|
-
fetch?:
|
|
13191
|
+
fetch?: FetchFunction;
|
|
14571
13192
|
};
|
|
14572
13193
|
|
|
14573
13194
|
/**
|
|
@@ -14575,31 +13196,12 @@ export declare type UseCompletionOptions = {
|
|
|
14575
13196
|
*/
|
|
14576
13197
|
export declare type UserContent = string | Array<TextPart | ImagePart | FilePart>;
|
|
14577
13198
|
|
|
14578
|
-
/**
|
|
14579
|
-
* Content of a user message. It can be a string or an array of text and image parts.
|
|
14580
|
-
*/
|
|
14581
|
-
declare type UserContent_2 = string | Array<TextPart_2 | ImagePart_2 | FilePart_2>;
|
|
14582
|
-
|
|
14583
13199
|
/**
|
|
14584
13200
|
* A user message. It can contain text or a combination of text and images.
|
|
14585
13201
|
*/
|
|
14586
13202
|
export declare type UserModelMessage = {
|
|
14587
13203
|
role: 'user';
|
|
14588
13204
|
content: UserContent;
|
|
14589
|
-
/**
|
|
14590
|
-
* Additional provider-specific metadata. They are passed through
|
|
14591
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
14592
|
-
* functionality that can be fully encapsulated in the provider.
|
|
14593
|
-
*/
|
|
14594
|
-
providerOptions?: ProviderOptions_2;
|
|
14595
|
-
};
|
|
14596
|
-
|
|
14597
|
-
/**
|
|
14598
|
-
* A user message. It can contain text or a combination of text and images.
|
|
14599
|
-
*/
|
|
14600
|
-
declare type UserModelMessage_2 = {
|
|
14601
|
-
role: 'user';
|
|
14602
|
-
content: UserContent_2;
|
|
14603
13205
|
/**
|
|
14604
13206
|
* Additional provider-specific metadata. They are passed through
|
|
14605
13207
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -14619,15 +13221,6 @@ export declare const userModelMessageSchema: z.ZodType<UserModelMessage>;
|
|
|
14619
13221
|
*/
|
|
14620
13222
|
declare function validateDownloadUrl(url: string): void;
|
|
14621
13223
|
|
|
14622
|
-
/**
|
|
14623
|
-
* Validates that a URL is safe to download from, blocking private/internal addresses
|
|
14624
|
-
* to prevent SSRF attacks.
|
|
14625
|
-
*
|
|
14626
|
-
* @param url - The URL string to validate.
|
|
14627
|
-
* @throws DownloadError if the URL is unsafe.
|
|
14628
|
-
*/
|
|
14629
|
-
declare function validateDownloadUrl_2(url: string): void;
|
|
14630
|
-
|
|
14631
13224
|
/**
|
|
14632
13225
|
* Validates the types of an unknown object using a schema and
|
|
14633
13226
|
* return a strongly-typed object.
|
|
@@ -14639,22 +13232,6 @@ declare function validateDownloadUrl_2(url: string): void;
|
|
|
14639
13232
|
* @returns {Promise<T>} - The typed object.
|
|
14640
13233
|
*/
|
|
14641
13234
|
declare function validateTypes<OBJECT>({ value, schema, context, }: {
|
|
14642
|
-
value: unknown;
|
|
14643
|
-
schema: FlexibleSchema_2<OBJECT>;
|
|
14644
|
-
context?: TypeValidationContext;
|
|
14645
|
-
}): Promise<OBJECT>;
|
|
14646
|
-
|
|
14647
|
-
/**
|
|
14648
|
-
* Validates the types of an unknown object using a schema and
|
|
14649
|
-
* return a strongly-typed object.
|
|
14650
|
-
*
|
|
14651
|
-
* @template T - The type of the object to validate.
|
|
14652
|
-
* @param {string} options.value - The object to validate.
|
|
14653
|
-
* @param {Validator<T>} options.schema - The schema to use for validating the JSON.
|
|
14654
|
-
* @param {TypeValidationContext} options.context - Optional context about what is being validated.
|
|
14655
|
-
* @returns {Promise<T>} - The typed object.
|
|
14656
|
-
*/
|
|
14657
|
-
declare function validateTypes_2<OBJECT>({ value, schema, context, }: {
|
|
14658
13235
|
value: unknown;
|
|
14659
13236
|
schema: FlexibleSchema<OBJECT>;
|
|
14660
13237
|
context?: TypeValidationContext;
|
|
@@ -14686,14 +13263,6 @@ declare type ValidationResult<OBJECT> = {
|
|
|
14686
13263
|
error: Error;
|
|
14687
13264
|
};
|
|
14688
13265
|
|
|
14689
|
-
declare type ValidationResult_2<OBJECT> = {
|
|
14690
|
-
success: true;
|
|
14691
|
-
value: OBJECT;
|
|
14692
|
-
} | {
|
|
14693
|
-
success: false;
|
|
14694
|
-
error: Error;
|
|
14695
|
-
};
|
|
14696
|
-
|
|
14697
13266
|
/**
|
|
14698
13267
|
* Create a union of the given object's values, and optionally specify which keys to get the values from.
|
|
14699
13268
|
*
|
|
@@ -14738,8 +13307,6 @@ declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof Obje
|
|
|
14738
13307
|
|
|
14739
13308
|
declare const VERSION: string;
|
|
14740
13309
|
|
|
14741
|
-
declare const VERSION_2: string;
|
|
14742
|
-
|
|
14743
13310
|
/**
|
|
14744
13311
|
* A video model can be a string (model ID) or a Experimental_VideoModelV3 object.
|
|
14745
13312
|
*/
|
|
@@ -14993,8 +13560,6 @@ export declare type Warning = SharedV3Warning;
|
|
|
14993
13560
|
|
|
14994
13561
|
declare function withoutTrailingSlash(url: string | undefined): string | undefined;
|
|
14995
13562
|
|
|
14996
|
-
declare function withoutTrailingSlash_2(url: string | undefined): string | undefined;
|
|
14997
|
-
|
|
14998
13563
|
/**
|
|
14999
13564
|
* Appends suffix parts to the `user-agent` header.
|
|
15000
13565
|
* If a `user-agent` header already exists, the suffix parts are appended to it.
|
|
@@ -15007,18 +13572,6 @@ declare function withoutTrailingSlash_2(url: string | undefined): string | undef
|
|
|
15007
13572
|
*/
|
|
15008
13573
|
declare function withUserAgentSuffix(headers: HeadersInit | Record<string, string | undefined> | undefined, ...userAgentSuffixParts: string[]): Record<string, string>;
|
|
15009
13574
|
|
|
15010
|
-
/**
|
|
15011
|
-
* Appends suffix parts to the `user-agent` header.
|
|
15012
|
-
* If a `user-agent` header already exists, the suffix parts are appended to it.
|
|
15013
|
-
* If no `user-agent` header exists, a new one is created with the suffix parts.
|
|
15014
|
-
* Automatically removes undefined entries from the headers.
|
|
15015
|
-
*
|
|
15016
|
-
* @param headers - The original headers.
|
|
15017
|
-
* @param userAgentSuffixParts - The parts to append to the `user-agent` header.
|
|
15018
|
-
* @returns The new headers with the `user-agent` header set or updated.
|
|
15019
|
-
*/
|
|
15020
|
-
declare function withUserAgentSuffix_2(headers: HeadersInit | Record<string, string | undefined> | undefined, ...userAgentSuffixParts: string[]): Record<string, string>;
|
|
15021
|
-
|
|
15022
13575
|
/**
|
|
15023
13576
|
* Wraps an EmbeddingModelV3 instance with middleware functionality.
|
|
15024
13577
|
* This function allows you to apply middleware to transform parameters,
|
|
@@ -15106,20 +13659,6 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
|
|
|
15106
13659
|
useReferences?: boolean;
|
|
15107
13660
|
}): Schema<OBJECT>;
|
|
15108
13661
|
|
|
15109
|
-
declare type ZodSchema_2<SCHEMA = any> = z3.Schema<SCHEMA, z3.ZodTypeDef, any> | z4.core.$ZodType<SCHEMA, any>;
|
|
15110
|
-
|
|
15111
|
-
declare function zodSchema_2<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, any> | z3.Schema<OBJECT, z3.ZodTypeDef, any>, options?: {
|
|
15112
|
-
/**
|
|
15113
|
-
* Enables support for references in the schema.
|
|
15114
|
-
* This is required for recursive schemas, e.g. with `z.lazy`.
|
|
15115
|
-
* However, not all language models and providers support such references.
|
|
15116
|
-
* Defaults to `false`.
|
|
15117
|
-
*/
|
|
15118
|
-
useReferences?: boolean;
|
|
15119
|
-
}): Schema_2<OBJECT>;
|
|
15120
|
-
|
|
15121
13662
|
export { }
|
|
15122
|
-
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider,
|
|
15123
|
-
export { schemaSymbol,
|
|
15124
|
-
|
|
15125
|
-
export type ProviderOptions = NonNullable<EmbeddingModelV3CallOptions['providerOptions']>;
|
|
13663
|
+
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, LazySchema as LazySchema, ZodSchema as ZodSchema, StandardSchema as StandardSchema, ValidationResult as ValidationResult, ParseResult as ParseResult, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, ToolOutputProperties as ToolOutputProperties, SharedV3ProviderMetadata as SharedV3ProviderMetadata, ToolResultOutput as ToolResultOutput, ToolNeedsApprovalFunction as ToolNeedsApprovalFunction, TypeValidationContext as TypeValidationContext, JSONSchema7Version as JSONSchema7Version, JSONSchema7Definition as JSONSchema7Definition, JSONSchema7TypeName as JSONSchema7TypeName, JSONSchema7Type as JSONSchema7Type, EmbeddingModelV2 as EmbeddingModelV2, EmbeddingModelV3Embedding as EmbeddingModelV3Embedding, EmbeddingModelV3Middleware as EmbeddingModelV3Middleware, ImageModelV2 as ImageModelV2, ImageModelV3ProviderMetadata as ImageModelV3ProviderMetadata, ImageModelV2ProviderMetadata as ImageModelV2ProviderMetadata, ImageModelV3Middleware as ImageModelV3Middleware, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2 as LanguageModelV2, SharedV3Warning as SharedV3Warning, LanguageModelV3Middleware as LanguageModelV3Middleware, SpeechModelV2 as SpeechModelV2, TranscriptionModelV2 as TranscriptionModelV2, ImageModelV3Usage as ImageModelV3Usage, DeepPartialInternal as DeepPartialInternal, AttributeValue as AttributeValue, Tracer as Tracer, BaseToolCall as BaseToolCall, Source as Source, ResponseMessage as ResponseMessage, LanguageModelV3ToolCall as LanguageModelV3ToolCall, GenerateTextIncludeSettings as GenerateTextIncludeSettings, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, _ai_sdk_provider as _ai_sdk_provider, DataUIMessageChunk as DataUIMessageChunk, InferElementOutput as InferElementOutput, ConsumeStreamOptions as ConsumeStreamOptions, StreamTextIncludeSettings as StreamTextIncludeSettings, StreamTextOnAbortCallback as StreamTextOnAbortCallback, CallbackModelInfo as CallbackModelInfo, LanguageModelV3ToolChoice as LanguageModelV3ToolChoice, Listener as Listener, MaybePromiseLike as MaybePromiseLike, Output_2 as Output_2, InferAgentTools as InferAgentTools, UIMessageStreamResponseInit as UIMessageStreamResponseInit, getOriginalFetch as getOriginalFetch, InferUIMessageTools as InferUIMessageTools, InferUIMessageToolCall as InferUIMessageToolCall, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, Resolvable as Resolvable, FetchFunction as FetchFunction, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason as RetryErrorReason, GenerateImagePrompt as GenerateImagePrompt, JSONValue_2 as JSONValue_2, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, VideoModelResponseMetadata as VideoModelResponseMetadata, VideoModelProviderMetadata as VideoModelProviderMetadata, VideoModel as VideoModel, EmbeddingModelV3CallOptions as EmbeddingModelV3CallOptions, LanguageModelV3CallOptions as LanguageModelV3CallOptions, JSONObject as JSONObject, LanguageModelV3 as LanguageModelV3, EmbeddingModelV3 as EmbeddingModelV3, ImageModelV3 as ImageModelV3, TranscriptionModelV3 as TranscriptionModelV3, SpeechModelV3 as SpeechModelV3, RerankingModelV3 as RerankingModelV3, VideoModelV3 as VideoModelV3, ProviderV2 as ProviderV2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV3 as ProviderV3 };
|
|
13664
|
+
export { schemaSymbol, symbol$1, symbol$1_2, symbol$2, symbol$2_2, symbol$3, symbol$3_2, symbol$4, symbol$4_2, symbol$5, symbol$5_2, symbol$6, symbol$6_2, symbol$7, symbol$7_2, symbol$8, symbol$8_2, symbol$9, symbol$9_2, symbol$a, symbol$a_2, symbol$b, symbol$b_2, symbol$c, symbol$c_2, symbol$d, symbol$d_2, symbol$e, symbol$f, symbol$g, symbol$h, symbol$i, symbol$j, symbol, symbol_2, symbol_3 };
|