@mastra/schema-compat 1.2.9 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +414 -1749
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +332 -1775
- package/dist/index.cjs +31 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -27
- 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
|
|
@@ -753,6 +575,7 @@ declare type BaseToolCall = {
|
|
|
753
575
|
toolCallId: string;
|
|
754
576
|
providerExecuted?: boolean;
|
|
755
577
|
providerMetadata?: ProviderMetadata;
|
|
578
|
+
toolMetadata?: JSONObject;
|
|
756
579
|
};
|
|
757
580
|
|
|
758
581
|
/**
|
|
@@ -875,7 +698,7 @@ export declare type CallWarning = SharedV3Warning;
|
|
|
875
698
|
/**
|
|
876
699
|
* Function that can be called to add a tool approval response to the chat.
|
|
877
700
|
*/
|
|
878
|
-
export declare type ChatAddToolApproveResponseFunction = ({ id, approved, reason, }: {
|
|
701
|
+
export declare type ChatAddToolApproveResponseFunction = ({ id, approved, reason, options, }: {
|
|
879
702
|
id: string;
|
|
880
703
|
/**
|
|
881
704
|
* Flag indicating whether the approval was granted or denied.
|
|
@@ -885,8 +708,38 @@ export declare type ChatAddToolApproveResponseFunction = ({ id, approved, reason
|
|
|
885
708
|
* Optional reason for the approval or denial.
|
|
886
709
|
*/
|
|
887
710
|
reason?: string;
|
|
711
|
+
/**
|
|
712
|
+
* Optional request options to be used if `sendAutomaticallyWhen` callback returns true.
|
|
713
|
+
*/
|
|
714
|
+
options?: ChatRequestOptions;
|
|
888
715
|
}) => void | PromiseLike<void>;
|
|
889
716
|
|
|
717
|
+
/**
|
|
718
|
+
* Function that can be called to add a tool output to the chat.
|
|
719
|
+
*/
|
|
720
|
+
export declare type ChatAddToolOutputFunction<UI_MESSAGE extends UIMessage> = <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ state, tool, toolCallId, output, errorText, options, }: {
|
|
721
|
+
/**
|
|
722
|
+
* Name of the tool that was called.
|
|
723
|
+
*/
|
|
724
|
+
tool: TOOL;
|
|
725
|
+
/**
|
|
726
|
+
* Identifier of the tool call to add output for.
|
|
727
|
+
*/
|
|
728
|
+
toolCallId: string;
|
|
729
|
+
/**
|
|
730
|
+
* Optional request options to be used if `sendAutomaticallyWhen` callback returns true.
|
|
731
|
+
*/
|
|
732
|
+
options?: ChatRequestOptions;
|
|
733
|
+
} & ({
|
|
734
|
+
state?: 'output-available';
|
|
735
|
+
output: InferUIMessageTools<UI_MESSAGE>[TOOL]['output'];
|
|
736
|
+
errorText?: never;
|
|
737
|
+
} | {
|
|
738
|
+
state: 'output-error';
|
|
739
|
+
output?: never;
|
|
740
|
+
errorText: string;
|
|
741
|
+
})) => void | PromiseLike<void>;
|
|
742
|
+
|
|
890
743
|
export declare interface ChatInit<UI_MESSAGE extends UIMessage> {
|
|
891
744
|
/**
|
|
892
745
|
* A unique identifier for the chat. If not provided, a random one will be
|
|
@@ -1071,8 +924,6 @@ export declare type ChunkDetector = (buffer: string) => string | undefined | nul
|
|
|
1071
924
|
|
|
1072
925
|
declare function combineHeaders(...headers: Array<Record<string, string | undefined> | undefined>): Record<string, string | undefined>;
|
|
1073
926
|
|
|
1074
|
-
declare function combineHeaders_2(...headers: Array<Record<string, string | undefined> | undefined>): Record<string, string | undefined>;
|
|
1075
|
-
|
|
1076
927
|
export declare type CompletionRequestOptions = {
|
|
1077
928
|
/**
|
|
1078
929
|
* An optional object of headers to be passed to the API endpoint.
|
|
@@ -1165,19 +1016,8 @@ declare interface Context {
|
|
|
1165
1016
|
*/
|
|
1166
1017
|
declare function convertAsyncIteratorToReadableStream<T>(iterator: AsyncIterator<T>): ReadableStream<T>;
|
|
1167
1018
|
|
|
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
1019
|
declare function convertBase64ToUint8Array(base64String: string): Uint8Array<ArrayBuffer>;
|
|
1178
1020
|
|
|
1179
|
-
declare function convertBase64ToUint8Array_2(base64String: string): Uint8Array<ArrayBuffer>;
|
|
1180
|
-
|
|
1181
1021
|
export declare function convertFileListToFileUIParts(files: FileList | undefined): Promise<Array<FileUIPart>>;
|
|
1182
1022
|
|
|
1183
1023
|
/**
|
|
@@ -1189,19 +1029,8 @@ export declare function convertFileListToFileUIParts(files: FileList | undefined
|
|
|
1189
1029
|
*/
|
|
1190
1030
|
declare function convertImageModelFileToDataUri(file: ImageModelV3File): string;
|
|
1191
1031
|
|
|
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
1032
|
declare function convertToBase64(value: string | Uint8Array): string;
|
|
1202
1033
|
|
|
1203
|
-
declare function convertToBase64_2(value: string | Uint8Array): string;
|
|
1204
|
-
|
|
1205
1034
|
/**
|
|
1206
1035
|
* Converts an input object to FormData for multipart/form-data requests.
|
|
1207
1036
|
*
|
|
@@ -1237,41 +1066,6 @@ declare function convertToFormData<T extends Record<string, unknown>>(input: T,
|
|
|
1237
1066
|
useArrayBrackets?: boolean;
|
|
1238
1067
|
}): FormData;
|
|
1239
1068
|
|
|
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
1069
|
/**
|
|
1276
1070
|
* Converts an array of UI messages from useChat into an array of ModelMessages that can be used
|
|
1277
1071
|
* with the AI functions (e.g. `streamText`, `generateText`).
|
|
@@ -1291,8 +1085,6 @@ export declare function convertToModelMessages<UI_MESSAGE extends UIMessage>(mes
|
|
|
1291
1085
|
|
|
1292
1086
|
declare function convertUint8ArrayToBase64(array: Uint8Array): string;
|
|
1293
1087
|
|
|
1294
|
-
declare function convertUint8ArrayToBase64_2(array: Uint8Array): string;
|
|
1295
|
-
|
|
1296
1088
|
/**
|
|
1297
1089
|
* Calculates the cosine similarity between two vectors. This is a useful metric for
|
|
1298
1090
|
* comparing the similarity of two vectors such as embeddings.
|
|
@@ -1358,8 +1150,6 @@ export declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS
|
|
|
1358
1150
|
|
|
1359
1151
|
declare const createBinaryResponseHandler: () => ResponseHandler<Uint8Array>;
|
|
1360
1152
|
|
|
1361
|
-
declare const createBinaryResponseHandler_2: () => ResponseHandler_2<Uint8Array>;
|
|
1362
|
-
|
|
1363
1153
|
/**
|
|
1364
1154
|
* Creates a download function with configurable options.
|
|
1365
1155
|
*
|
|
@@ -1377,9 +1167,7 @@ export declare function createDownload(options?: {
|
|
|
1377
1167
|
mediaType: string | undefined;
|
|
1378
1168
|
}>;
|
|
1379
1169
|
|
|
1380
|
-
declare const createEventSourceResponseHandler: <T>(chunkSchema:
|
|
1381
|
-
|
|
1382
|
-
declare const createEventSourceResponseHandler_2: <T>(chunkSchema: FlexibleSchema<T>) => ResponseHandler_2<ReadableStream<ParseResult_2<T>>>;
|
|
1170
|
+
declare const createEventSourceResponseHandler: <T>(chunkSchema: FlexibleSchema<T>) => ResponseHandler<ReadableStream<ParseResult<T>>>;
|
|
1383
1171
|
|
|
1384
1172
|
/**
|
|
1385
1173
|
* Create a remote provider instance.
|
|
@@ -1403,38 +1191,13 @@ export declare const createIdGenerator: ({ prefix, size, alphabet, separator, }?
|
|
|
1403
1191
|
alphabet?: string;
|
|
1404
1192
|
}) => IdGenerator;
|
|
1405
1193
|
|
|
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
1194
|
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
1195
|
errorSchema: FlexibleSchema<T>;
|
|
1431
1196
|
errorToMessage: (error: T) => string;
|
|
1432
1197
|
isRetryable?: (response: Response, error?: T) => boolean;
|
|
1433
|
-
}) =>
|
|
1434
|
-
|
|
1435
|
-
declare const createJsonResponseHandler: <T>(responseSchema: FlexibleSchema_2<T>) => ResponseHandler<T>;
|
|
1198
|
+
}) => ResponseHandler<APICallError>;
|
|
1436
1199
|
|
|
1437
|
-
declare const
|
|
1200
|
+
declare const createJsonResponseHandler: <T>(responseSchema: FlexibleSchema<T>) => ResponseHandler<T>;
|
|
1438
1201
|
|
|
1439
1202
|
/**
|
|
1440
1203
|
* Creates a registry for the given providers with optional middleware functionality.
|
|
@@ -1456,33 +1219,11 @@ export declare function createProviderRegistry<PROVIDERS extends Record<string,
|
|
|
1456
1219
|
}): ProviderRegistryProvider<PROVIDERS, SEPARATOR>;
|
|
1457
1220
|
|
|
1458
1221
|
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
1222
|
id: `${string}.${string}`;
|
|
1465
1223
|
inputSchema: FlexibleSchema<INPUT>;
|
|
1466
|
-
}):
|
|
1224
|
+
}): ProviderToolFactory<INPUT, ARGS>;
|
|
1467
1225
|
|
|
1468
1226
|
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
1227
|
id: `${string}.${string}`;
|
|
1487
1228
|
inputSchema: FlexibleSchema<INPUT>;
|
|
1488
1229
|
outputSchema: FlexibleSchema<OUTPUT>;
|
|
@@ -1497,12 +1238,10 @@ declare function createProviderToolFactoryWithOutputSchema_2<INPUT, OUTPUT, ARGS
|
|
|
1497
1238
|
* @default false
|
|
1498
1239
|
*/
|
|
1499
1240
|
supportsDeferredResults?: boolean;
|
|
1500
|
-
}):
|
|
1241
|
+
}): ProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS>;
|
|
1501
1242
|
|
|
1502
1243
|
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
|
|
1503
1244
|
|
|
1504
|
-
declare const createStatusCodeErrorResponseHandler_2: () => ResponseHandler_2<APICallError>;
|
|
1505
|
-
|
|
1506
1245
|
/**
|
|
1507
1246
|
* Creates a Response object from a text stream.
|
|
1508
1247
|
* Each text chunk is encoded as UTF-8 and sent as a separate chunk.
|
|
@@ -1539,26 +1278,6 @@ declare function createToolNameMapping({ tools, providerToolNames, resolveProvid
|
|
|
1539
1278
|
resolveProviderToolName?: (tool: LanguageModelV3ProviderTool) => string | undefined;
|
|
1540
1279
|
}): ToolNameMapping;
|
|
1541
1280
|
|
|
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
1281
|
export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESSAGE, 'id' | 'role'> & {
|
|
1563
1282
|
id?: UI_MESSAGE['id'];
|
|
1564
1283
|
role?: UI_MESSAGE['role'];
|
|
@@ -1650,11 +1369,6 @@ export declare function customProvider<LANGUAGE_MODELS extends Record<string, La
|
|
|
1650
1369
|
*/
|
|
1651
1370
|
export declare type DataContent = string | Uint8Array | ArrayBuffer | Buffer;
|
|
1652
1371
|
|
|
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
1372
|
declare type DataUIMessageChunk<DATA_TYPES extends UIDataTypes> = ValueOf<{
|
|
1659
1373
|
[NAME in keyof DATA_TYPES & string]: {
|
|
1660
1374
|
type: `data-${NAME}`;
|
|
@@ -1695,24 +1409,11 @@ declare type DeepPartialInternal<T> = T extends null | undefined | string | numb
|
|
|
1695
1409
|
* `DownloadError`.
|
|
1696
1410
|
*/
|
|
1697
1411
|
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
|
-
}
|
|
1412
|
+
|
|
1413
|
+
export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends HttpChatTransport<UI_MESSAGE> {
|
|
1414
|
+
constructor(options?: HttpChatTransportInitOptions<UI_MESSAGE>);
|
|
1415
|
+
protected processResponseStream(stream: ReadableStream<Uint8Array<ArrayBufferLike>>): ReadableStream<UIMessageChunk>;
|
|
1416
|
+
}
|
|
1716
1417
|
|
|
1717
1418
|
/**
|
|
1718
1419
|
* Applies default settings for an embedding model.
|
|
@@ -1768,17 +1469,6 @@ declare function delay(delayInMs?: number | null, options?: {
|
|
|
1768
1469
|
abortSignal?: AbortSignal;
|
|
1769
1470
|
}): Promise<void>;
|
|
1770
1471
|
|
|
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
1472
|
/**
|
|
1783
1473
|
* Delayed promise. It is only constructed once the value is accessed.
|
|
1784
1474
|
* This is useful to avoid unhandled promise rejections when the promise is created
|
|
@@ -1797,24 +1487,6 @@ declare class DelayedPromise<T> {
|
|
|
1797
1487
|
isPending(): boolean;
|
|
1798
1488
|
}
|
|
1799
1489
|
|
|
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
1490
|
/**
|
|
1819
1491
|
* A transport that directly communicates with an Agent in-process,
|
|
1820
1492
|
* without going through HTTP. This is useful for:
|
|
@@ -1878,22 +1550,6 @@ declare function downloadBlob(url: string, options?: {
|
|
|
1878
1550
|
abortSignal?: AbortSignal;
|
|
1879
1551
|
}): Promise<Blob>;
|
|
1880
1552
|
|
|
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
1553
|
export declare class DownloadError extends AISDKError {
|
|
1898
1554
|
private readonly [symbol_2];
|
|
1899
1555
|
readonly url: string;
|
|
@@ -1909,66 +1565,16 @@ export declare class DownloadError extends AISDKError {
|
|
|
1909
1565
|
static isInstance(error: unknown): error is DownloadError;
|
|
1910
1566
|
}
|
|
1911
1567
|
|
|
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
1568
|
/**
|
|
1928
1569
|
* Defines a dynamic tool.
|
|
1929
1570
|
*/
|
|
1930
1571
|
export declare function dynamicTool(tool: {
|
|
1931
1572
|
description?: string;
|
|
1932
1573
|
title?: string;
|
|
1933
|
-
providerOptions?:
|
|
1574
|
+
providerOptions?: ProviderOptions;
|
|
1575
|
+
metadata?: JSONObject;
|
|
1934
1576
|
inputSchema: FlexibleSchema<unknown>;
|
|
1935
1577
|
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
1578
|
/**
|
|
1973
1579
|
* Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
1974
1580
|
*
|
|
@@ -1992,7 +1598,7 @@ declare function dynamicTool_2(tool: {
|
|
|
1992
1598
|
* Whether the tool needs approval before it can be executed.
|
|
1993
1599
|
*/
|
|
1994
1600
|
needsApproval?: boolean | ToolNeedsApprovalFunction<unknown>;
|
|
1995
|
-
}):
|
|
1601
|
+
}): Tool<unknown, unknown> & {
|
|
1996
1602
|
type: 'dynamic';
|
|
1997
1603
|
};
|
|
1998
1604
|
|
|
@@ -2020,6 +1626,7 @@ export declare type DynamicToolError = {
|
|
|
2020
1626
|
error: unknown;
|
|
2021
1627
|
providerExecuted?: boolean;
|
|
2022
1628
|
providerMetadata?: ProviderMetadata;
|
|
1629
|
+
toolMetadata?: JSONObject;
|
|
2023
1630
|
dynamic: true;
|
|
2024
1631
|
title?: string;
|
|
2025
1632
|
};
|
|
@@ -2032,6 +1639,7 @@ export declare type DynamicToolResult = {
|
|
|
2032
1639
|
output: unknown;
|
|
2033
1640
|
providerExecuted?: boolean;
|
|
2034
1641
|
providerMetadata?: ProviderMetadata;
|
|
1642
|
+
toolMetadata?: JSONObject;
|
|
2035
1643
|
dynamic: true;
|
|
2036
1644
|
preliminary?: boolean;
|
|
2037
1645
|
title?: string;
|
|
@@ -2048,6 +1656,7 @@ export declare type DynamicToolUIPart = {
|
|
|
2048
1656
|
*/
|
|
2049
1657
|
toolCallId: string;
|
|
2050
1658
|
title?: string;
|
|
1659
|
+
toolMetadata?: JSONObject;
|
|
2051
1660
|
/**
|
|
2052
1661
|
* Whether the tool call was executed by the provider.
|
|
2053
1662
|
*/
|
|
@@ -2094,6 +1703,7 @@ export declare type DynamicToolUIPart = {
|
|
|
2094
1703
|
output: unknown;
|
|
2095
1704
|
errorText?: never;
|
|
2096
1705
|
callProviderMetadata?: ProviderMetadata;
|
|
1706
|
+
resultProviderMetadata?: ProviderMetadata;
|
|
2097
1707
|
preliminary?: boolean;
|
|
2098
1708
|
approval?: {
|
|
2099
1709
|
id: string;
|
|
@@ -2106,6 +1716,7 @@ export declare type DynamicToolUIPart = {
|
|
|
2106
1716
|
output?: never;
|
|
2107
1717
|
errorText: string;
|
|
2108
1718
|
callProviderMetadata?: ProviderMetadata;
|
|
1719
|
+
resultProviderMetadata?: ProviderMetadata;
|
|
2109
1720
|
approval?: {
|
|
2110
1721
|
id: string;
|
|
2111
1722
|
approved: true;
|
|
@@ -2171,7 +1782,7 @@ export declare function embed({ model: modelArg, value, providerOptions, maxRetr
|
|
|
2171
1782
|
* to the provider from the AI SDK and enable provider-specific
|
|
2172
1783
|
* functionality that can be fully encapsulated in the provider.
|
|
2173
1784
|
*/
|
|
2174
|
-
providerOptions?:
|
|
1785
|
+
providerOptions?: ProviderOptions;
|
|
2175
1786
|
/**
|
|
2176
1787
|
* Optional telemetry configuration (experimental).
|
|
2177
1788
|
*/
|
|
@@ -2531,7 +2142,7 @@ export declare function embedMany({ model: modelArg, values, maxParallelCalls, m
|
|
|
2531
2142
|
* to the provider from the AI SDK and enable provider-specific
|
|
2532
2143
|
* functionality that can be fully encapsulated in the provider.
|
|
2533
2144
|
*/
|
|
2534
|
-
providerOptions?:
|
|
2145
|
+
providerOptions?: ProviderOptions;
|
|
2535
2146
|
/**
|
|
2536
2147
|
* Maximum number of concurrent requests.
|
|
2537
2148
|
*
|
|
@@ -2646,16 +2257,16 @@ declare interface EventSourceMessage {
|
|
|
2646
2257
|
* implementation in that browsers will default this to `message`, whereas this parser will
|
|
2647
2258
|
* leave this as `undefined` if not explicitly declared.
|
|
2648
2259
|
*/
|
|
2649
|
-
event?: string | undefined
|
|
2260
|
+
event?: string | undefined;
|
|
2650
2261
|
/**
|
|
2651
2262
|
* ID of the message, if any was provided by the server. Can be used by clients to keep the
|
|
2652
2263
|
* last received message ID in sync when reconnecting.
|
|
2653
2264
|
*/
|
|
2654
|
-
id?: string | undefined
|
|
2265
|
+
id?: string | undefined;
|
|
2655
2266
|
/**
|
|
2656
2267
|
* The data received for this message
|
|
2657
2268
|
*/
|
|
2658
|
-
data: string
|
|
2269
|
+
data: string;
|
|
2659
2270
|
}
|
|
2660
2271
|
|
|
2661
2272
|
/**
|
|
@@ -2679,8 +2290,11 @@ declare interface EventSourceMessage {
|
|
|
2679
2290
|
*
|
|
2680
2291
|
* @public
|
|
2681
2292
|
*/
|
|
2682
|
-
declare class EventSourceParserStream extends TransformStream<
|
|
2683
|
-
|
|
2293
|
+
declare class EventSourceParserStream extends TransformStream<
|
|
2294
|
+
string,
|
|
2295
|
+
EventSourceMessage
|
|
2296
|
+
> {
|
|
2297
|
+
constructor({ onError, onRetry, onComment }?: StreamOptions);
|
|
2684
2298
|
}
|
|
2685
2299
|
|
|
2686
2300
|
/**
|
|
@@ -2714,18 +2328,6 @@ declare interface ExceptionWithName {
|
|
|
2714
2328
|
}
|
|
2715
2329
|
|
|
2716
2330
|
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
2331
|
execute: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
2730
2332
|
input: INPUT;
|
|
2731
2333
|
options: ToolExecutionOptions;
|
|
@@ -2842,7 +2444,7 @@ export declare function experimental_generateSpeech({ model, text, voice, output
|
|
|
2842
2444
|
* }
|
|
2843
2445
|
* ```
|
|
2844
2446
|
*/
|
|
2845
|
-
providerOptions?:
|
|
2447
|
+
providerOptions?: ProviderOptions;
|
|
2846
2448
|
/**
|
|
2847
2449
|
* Maximum number of retries per speech model call. Set to 0 to disable retries.
|
|
2848
2450
|
*
|
|
@@ -2901,7 +2503,7 @@ export declare function experimental_generateVideo({ model: modelArg, prompt: pr
|
|
|
2901
2503
|
* Additional provider-specific options that are passed through to the provider
|
|
2902
2504
|
* as body parameters.
|
|
2903
2505
|
*/
|
|
2904
|
-
providerOptions?:
|
|
2506
|
+
providerOptions?: ProviderOptions;
|
|
2905
2507
|
/**
|
|
2906
2508
|
* Maximum number of retries per video model call. Set to 0 to disable retries.
|
|
2907
2509
|
*
|
|
@@ -2978,7 +2580,7 @@ export declare function experimental_transcribe({ model, audio, providerOptions,
|
|
|
2978
2580
|
* }
|
|
2979
2581
|
* ```
|
|
2980
2582
|
*/
|
|
2981
|
-
providerOptions?:
|
|
2583
|
+
providerOptions?: ProviderOptions;
|
|
2982
2584
|
/**
|
|
2983
2585
|
* Maximum number of retries per transcript model call. Set to 0 to disable retries.
|
|
2984
2586
|
*
|
|
@@ -3108,26 +2710,11 @@ declare function extractResponseHeaders(response: Response): {
|
|
|
3108
2710
|
[k: string]: string;
|
|
3109
2711
|
};
|
|
3110
2712
|
|
|
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
2713
|
/**
|
|
3122
2714
|
* Fetch function type (standardizes the version of fetch used).
|
|
3123
2715
|
*/
|
|
3124
2716
|
declare type FetchFunction = typeof globalThis.fetch;
|
|
3125
2717
|
|
|
3126
|
-
/**
|
|
3127
|
-
* Fetch function type (standardizes the version of fetch used).
|
|
3128
|
-
*/
|
|
3129
|
-
declare type FetchFunction_2 = typeof globalThis.fetch;
|
|
3130
|
-
|
|
3131
2718
|
/**
|
|
3132
2719
|
* File content part of a prompt. It contains a file.
|
|
3133
2720
|
*/
|
|
@@ -3150,36 +2737,6 @@ export declare interface FilePart {
|
|
|
3150
2737
|
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
3151
2738
|
*/
|
|
3152
2739
|
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
2740
|
/**
|
|
3184
2741
|
* Additional provider-specific metadata. They are passed through
|
|
3185
2742
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -3227,9 +2784,7 @@ export declare type FileUIPart = {
|
|
|
3227
2784
|
*/
|
|
3228
2785
|
export declare type FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
|
|
3229
2786
|
|
|
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>;
|
|
2787
|
+
export declare type FlexibleSchema<SCHEMA = any> = Schema<SCHEMA> | LazySchema<SCHEMA> | ZodSchema<SCHEMA> | StandardSchema<SCHEMA>;
|
|
3233
2788
|
|
|
3234
2789
|
export declare const gateway: GatewayProvider;
|
|
3235
2790
|
|
|
@@ -3240,13 +2795,57 @@ declare interface GatewayCreditsResponse {
|
|
|
3240
2795
|
totalUsed: string;
|
|
3241
2796
|
}
|
|
3242
2797
|
|
|
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 & {});
|
|
2798
|
+
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
2799
|
|
|
3245
2800
|
declare interface GatewayFetchMetadataResponse {
|
|
3246
2801
|
models: GatewayLanguageModelEntry[];
|
|
3247
2802
|
}
|
|
3248
2803
|
|
|
3249
|
-
declare
|
|
2804
|
+
declare interface GatewayGenerationInfo {
|
|
2805
|
+
/** The generation ID */
|
|
2806
|
+
id: string;
|
|
2807
|
+
/** Total cost in USD */
|
|
2808
|
+
totalCost: number;
|
|
2809
|
+
/** Upstream inference cost in USD (BYOK only) */
|
|
2810
|
+
upstreamInferenceCost: number;
|
|
2811
|
+
/** Usage cost in USD (same as totalCost) */
|
|
2812
|
+
usage: number;
|
|
2813
|
+
/** ISO 8601 timestamp when the generation was created */
|
|
2814
|
+
createdAt: string;
|
|
2815
|
+
/** Model identifier */
|
|
2816
|
+
model: string;
|
|
2817
|
+
/** Whether BYOK credentials were used */
|
|
2818
|
+
isByok: boolean;
|
|
2819
|
+
/** Provider that served this generation */
|
|
2820
|
+
providerName: string;
|
|
2821
|
+
/** Whether streaming was used */
|
|
2822
|
+
streamed: boolean;
|
|
2823
|
+
/** Finish reason (e.g. 'stop') */
|
|
2824
|
+
finishReason: string;
|
|
2825
|
+
/** Time to first token in milliseconds */
|
|
2826
|
+
latency: number;
|
|
2827
|
+
/** Total generation time in milliseconds */
|
|
2828
|
+
generationTime: number;
|
|
2829
|
+
/** Number of prompt tokens */
|
|
2830
|
+
promptTokens: number;
|
|
2831
|
+
/** Number of completion tokens */
|
|
2832
|
+
completionTokens: number;
|
|
2833
|
+
/** Reasoning tokens used */
|
|
2834
|
+
reasoningTokens: number;
|
|
2835
|
+
/** Cached tokens used */
|
|
2836
|
+
cachedTokens: number;
|
|
2837
|
+
/** Cache creation input tokens */
|
|
2838
|
+
cacheCreationTokens: number;
|
|
2839
|
+
/** Billable web search calls */
|
|
2840
|
+
billableWebSearchCalls: number;
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2843
|
+
declare interface GatewayGenerationInfoParams {
|
|
2844
|
+
/** The generation ID to look up (format: gen_<ulid>) */
|
|
2845
|
+
id: string;
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
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
2849
|
|
|
3251
2850
|
declare interface GatewayLanguageModelEntry {
|
|
3252
2851
|
/**
|
|
@@ -3292,12 +2891,12 @@ declare interface GatewayLanguageModelEntry {
|
|
|
3292
2891
|
/**
|
|
3293
2892
|
* Optional field to differentiate between model types.
|
|
3294
2893
|
*/
|
|
3295
|
-
modelType?:
|
|
2894
|
+
modelType?: KnownModelType | null;
|
|
3296
2895
|
}
|
|
3297
2896
|
|
|
3298
2897
|
declare type GatewayLanguageModelSpecification = Pick<LanguageModelV3, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
3299
2898
|
|
|
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' | '
|
|
2899
|
+
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' | '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
2900
|
|
|
3302
2901
|
declare interface GatewayProvider extends ProviderV3 {
|
|
3303
2902
|
(modelId: GatewayModelId): LanguageModelV3;
|
|
@@ -3317,6 +2916,16 @@ declare interface GatewayProvider extends ProviderV3 {
|
|
|
3317
2916
|
* Returns credit information for the authenticated user.
|
|
3318
2917
|
*/
|
|
3319
2918
|
getCredits(): Promise<GatewayCreditsResponse>;
|
|
2919
|
+
/**
|
|
2920
|
+
* Returns a spend report with cost, token, and request count data,
|
|
2921
|
+
* aggregated by the specified dimension.
|
|
2922
|
+
*/
|
|
2923
|
+
getSpendReport(params: GatewaySpendReportParams): Promise<GatewaySpendReportResponse>;
|
|
2924
|
+
/**
|
|
2925
|
+
* Returns detailed information about a specific generation by its ID,
|
|
2926
|
+
* including cost, token usage, latency, and provider details.
|
|
2927
|
+
*/
|
|
2928
|
+
getGenerationInfo(params: GatewayGenerationInfoParams): Promise<GatewayGenerationInfo>;
|
|
3320
2929
|
/**
|
|
3321
2930
|
* Creates a model for generating text embeddings.
|
|
3322
2931
|
*/
|
|
@@ -3345,6 +2954,14 @@ declare interface GatewayProvider extends ProviderV3 {
|
|
|
3345
2954
|
* Creates a model for generating videos.
|
|
3346
2955
|
*/
|
|
3347
2956
|
videoModel(modelId: GatewayVideoModelId): VideoModelV3;
|
|
2957
|
+
/**
|
|
2958
|
+
* Creates a model for reranking documents.
|
|
2959
|
+
*/
|
|
2960
|
+
reranking(modelId: GatewayRerankingModelId): RerankingModelV3;
|
|
2961
|
+
/**
|
|
2962
|
+
* Creates a model for reranking documents.
|
|
2963
|
+
*/
|
|
2964
|
+
rerankingModel(modelId: GatewayRerankingModelId): RerankingModelV3;
|
|
3348
2965
|
/**
|
|
3349
2966
|
* Gateway-specific tools executed server-side.
|
|
3350
2967
|
*/
|
|
@@ -3375,6 +2992,66 @@ declare interface GatewayProviderSettings {
|
|
|
3375
2992
|
metadataCacheRefreshMillis?: number;
|
|
3376
2993
|
}
|
|
3377
2994
|
|
|
2995
|
+
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 & {});
|
|
2996
|
+
|
|
2997
|
+
declare interface GatewaySpendReportParams {
|
|
2998
|
+
/** Start date in YYYY-MM-DD format (inclusive) */
|
|
2999
|
+
startDate: string;
|
|
3000
|
+
/** End date in YYYY-MM-DD format (inclusive) */
|
|
3001
|
+
endDate: string;
|
|
3002
|
+
/** Primary aggregation dimension. Defaults to 'day'. */
|
|
3003
|
+
groupBy?: 'day' | 'user' | 'model' | 'tag' | 'provider' | 'credential_type';
|
|
3004
|
+
/** Time granularity when groupBy is 'day'. */
|
|
3005
|
+
datePart?: 'day' | 'hour';
|
|
3006
|
+
/** Filter to a specific user's spend. */
|
|
3007
|
+
userId?: string;
|
|
3008
|
+
/** Filter to a specific model (e.g. 'anthropic/claude-sonnet-4.5'). */
|
|
3009
|
+
model?: string;
|
|
3010
|
+
/** Filter to a specific provider (e.g. 'anthropic'). */
|
|
3011
|
+
provider?: string;
|
|
3012
|
+
/** Filter to BYOK or system credentials. */
|
|
3013
|
+
credentialType?: 'byok' | 'system';
|
|
3014
|
+
/** Filter to requests with these tags. */
|
|
3015
|
+
tags?: string[];
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
declare interface GatewaySpendReportResponse {
|
|
3019
|
+
results: GatewaySpendReportRow[];
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
declare interface GatewaySpendReportRow {
|
|
3023
|
+
/** Date string (present when groupBy is 'day') */
|
|
3024
|
+
day?: string;
|
|
3025
|
+
/** Hour timestamp (present when groupBy is 'day' and datePart is 'hour') */
|
|
3026
|
+
hour?: string;
|
|
3027
|
+
/** User identifier (present when groupBy is 'user') */
|
|
3028
|
+
user?: string;
|
|
3029
|
+
/** Model identifier (present when groupBy is 'model') */
|
|
3030
|
+
model?: string;
|
|
3031
|
+
/** Tag value (present when groupBy is 'tag') */
|
|
3032
|
+
tag?: string;
|
|
3033
|
+
/** Provider name (present when groupBy is 'provider') */
|
|
3034
|
+
provider?: string;
|
|
3035
|
+
/** Credential type (present when groupBy is 'credential_type') */
|
|
3036
|
+
credentialType?: 'byok' | 'system';
|
|
3037
|
+
/** Total cost in USD */
|
|
3038
|
+
totalCost: number;
|
|
3039
|
+
/** Market cost in USD */
|
|
3040
|
+
marketCost?: number;
|
|
3041
|
+
/** Number of input tokens */
|
|
3042
|
+
inputTokens?: number;
|
|
3043
|
+
/** Number of output tokens */
|
|
3044
|
+
outputTokens?: number;
|
|
3045
|
+
/** Number of cached input tokens */
|
|
3046
|
+
cachedInputTokens?: number;
|
|
3047
|
+
/** Number of cache creation input tokens */
|
|
3048
|
+
cacheCreationInputTokens?: number;
|
|
3049
|
+
/** Number of reasoning tokens */
|
|
3050
|
+
reasoningTokens?: number;
|
|
3051
|
+
/** Number of requests */
|
|
3052
|
+
requestCount?: number;
|
|
3053
|
+
}
|
|
3054
|
+
|
|
3378
3055
|
/**
|
|
3379
3056
|
* Gateway-specific provider-defined tools.
|
|
3380
3057
|
*/
|
|
@@ -3398,7 +3075,7 @@ declare const gatewayTools: {
|
|
|
3398
3075
|
perplexitySearch: (config?: PerplexitySearchConfig) => ReturnType<typeof perplexitySearchToolFactory>;
|
|
3399
3076
|
};
|
|
3400
3077
|
|
|
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 & {});
|
|
3078
|
+
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
3079
|
|
|
3403
3080
|
/**
|
|
3404
3081
|
* A generated audio file.
|
|
@@ -3438,12 +3115,6 @@ export { GeneratedFile }
|
|
|
3438
3115
|
*/
|
|
3439
3116
|
export declare const generateId: IdGenerator;
|
|
3440
3117
|
|
|
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
3118
|
/**
|
|
3448
3119
|
* Generates images using an image model.
|
|
3449
3120
|
*
|
|
@@ -3505,7 +3176,7 @@ export declare function generateImage({ model: modelArg, prompt: promptArg, n, m
|
|
|
3505
3176
|
* }
|
|
3506
3177
|
* ```
|
|
3507
3178
|
*/
|
|
3508
|
-
providerOptions?:
|
|
3179
|
+
providerOptions?: ProviderOptions;
|
|
3509
3180
|
/**
|
|
3510
3181
|
* Maximum number of retries per image model call. Set to 0 to disable retries.
|
|
3511
3182
|
*
|
|
@@ -3571,6 +3242,7 @@ export declare interface GenerateImageResult {
|
|
|
3571
3242
|
* @param system - A system message that will be part of the prompt.
|
|
3572
3243
|
* @param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
|
|
3573
3244
|
* @param messages - A list of messages. You can either use `prompt` or `messages` but not both.
|
|
3245
|
+
* @param allowSystemInMessages - Whether system messages are allowed in the `prompt` or `messages` fields. When unset, system messages are allowed with a warning.
|
|
3574
3246
|
*
|
|
3575
3247
|
* @param maxOutputTokens - Maximum number of tokens to generate.
|
|
3576
3248
|
* @param temperature - Temperature setting.
|
|
@@ -3675,7 +3347,7 @@ export declare function generateObject<SCHEMA extends FlexibleSchema<unknown> =
|
|
|
3675
3347
|
* to the provider from the AI SDK and enable provider-specific
|
|
3676
3348
|
* functionality that can be fully encapsulated in the provider.
|
|
3677
3349
|
*/
|
|
3678
|
-
providerOptions?:
|
|
3350
|
+
providerOptions?: ProviderOptions;
|
|
3679
3351
|
/**
|
|
3680
3352
|
* Internal. For test use only. May change without notice.
|
|
3681
3353
|
*/
|
|
@@ -3749,6 +3421,7 @@ export declare interface GenerateObjectResult<OBJECT> {
|
|
|
3749
3421
|
* @param system - A system message that will be part of the prompt.
|
|
3750
3422
|
* @param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
|
|
3751
3423
|
* @param messages - A list of messages. You can either use `prompt` or `messages` but not both.
|
|
3424
|
+
* @param allowSystemInMessages - Whether system messages are allowed in the `prompt` or `messages` fields. When unset, system messages are allowed with a warning.
|
|
3752
3425
|
*
|
|
3753
3426
|
* @param maxOutputTokens - Maximum number of tokens to generate.
|
|
3754
3427
|
* @param temperature - Temperature setting.
|
|
@@ -3790,7 +3463,7 @@ export declare interface GenerateObjectResult<OBJECT> {
|
|
|
3790
3463
|
* @returns
|
|
3791
3464
|
* A result object that contains the generated text, the results of the tool calls, and additional information.
|
|
3792
3465
|
*/
|
|
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 & {
|
|
3466
|
+
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
3467
|
/**
|
|
3795
3468
|
* The language model to use.
|
|
3796
3469
|
*/
|
|
@@ -3819,7 +3492,7 @@ export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Outpu
|
|
|
3819
3492
|
* to the provider from the AI SDK and enable provider-specific
|
|
3820
3493
|
* functionality that can be fully encapsulated in the provider.
|
|
3821
3494
|
*/
|
|
3822
|
-
providerOptions?:
|
|
3495
|
+
providerOptions?: ProviderOptions;
|
|
3823
3496
|
/**
|
|
3824
3497
|
* @deprecated Use `activeTools` instead.
|
|
3825
3498
|
*/
|
|
@@ -4154,8 +3827,6 @@ declare function getErrorMessage(error: unknown | undefined): string;
|
|
|
4154
3827
|
|
|
4155
3828
|
declare function getErrorMessage_2(error: unknown | undefined): string;
|
|
4156
3829
|
|
|
4157
|
-
declare function getErrorMessage_3(error: unknown | undefined): string;
|
|
4158
|
-
|
|
4159
3830
|
declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
4160
3831
|
url: string;
|
|
4161
3832
|
headers?: Record<string, string | undefined>;
|
|
@@ -4169,19 +3840,6 @@ declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedR
|
|
|
4169
3840
|
responseHeaders?: Record<string, string>;
|
|
4170
3841
|
}>;
|
|
4171
3842
|
|
|
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
3843
|
declare type GetMaxImagesPerCallFunction$1 = (options: {
|
|
4186
3844
|
modelId: string;
|
|
4187
3845
|
}) => PromiseLike<number | undefined> | number | undefined;
|
|
@@ -4198,8 +3856,6 @@ declare const getOriginalFetch: () => typeof fetch;
|
|
|
4198
3856
|
|
|
4199
3857
|
declare function getRuntimeEnvironmentUserAgent(globalThisAny?: any): string;
|
|
4200
3858
|
|
|
4201
|
-
declare function getRuntimeEnvironmentUserAgent_2(globalThisAny?: any): string;
|
|
4202
|
-
|
|
4203
3859
|
/**
|
|
4204
3860
|
* Returns the name of the static tool.
|
|
4205
3861
|
*
|
|
@@ -4256,7 +3912,7 @@ export declare abstract class HttpChatTransport<UI_MESSAGE extends UIMessage> im
|
|
|
4256
3912
|
protected credentials: HttpChatTransportInitOptions<UI_MESSAGE>['credentials'];
|
|
4257
3913
|
protected headers: HttpChatTransportInitOptions<UI_MESSAGE>['headers'];
|
|
4258
3914
|
protected body: HttpChatTransportInitOptions<UI_MESSAGE>['body'];
|
|
4259
|
-
protected fetch?:
|
|
3915
|
+
protected fetch?: FetchFunction;
|
|
4260
3916
|
protected prepareSendMessagesRequest?: PrepareSendMessagesRequest<UI_MESSAGE>;
|
|
4261
3917
|
protected prepareReconnectToStreamRequest?: PrepareReconnectToStreamRequest;
|
|
4262
3918
|
constructor({ api, credentials, headers, body, fetch, prepareSendMessagesRequest, prepareReconnectToStreamRequest, }: HttpChatTransportInitOptions<UI_MESSAGE>);
|
|
@@ -4281,11 +3937,11 @@ export declare type HttpChatTransportInitOptions<UI_MESSAGE extends UIMessage> =
|
|
|
4281
3937
|
* Possible values are: 'omit', 'same-origin', 'include'.
|
|
4282
3938
|
* Defaults to 'same-origin'.
|
|
4283
3939
|
*/
|
|
4284
|
-
credentials?:
|
|
3940
|
+
credentials?: Resolvable<RequestCredentials>;
|
|
4285
3941
|
/**
|
|
4286
3942
|
* HTTP headers to be sent with the API request.
|
|
4287
3943
|
*/
|
|
4288
|
-
headers?:
|
|
3944
|
+
headers?: Resolvable<Record<string, string> | Headers>;
|
|
4289
3945
|
/**
|
|
4290
3946
|
* Extra body object to be sent with the API request.
|
|
4291
3947
|
* @example
|
|
@@ -4298,12 +3954,12 @@ export declare type HttpChatTransportInitOptions<UI_MESSAGE extends UIMessage> =
|
|
|
4298
3954
|
* })
|
|
4299
3955
|
* ```
|
|
4300
3956
|
*/
|
|
4301
|
-
body?:
|
|
3957
|
+
body?: Resolvable<object>;
|
|
4302
3958
|
/**
|
|
4303
3959
|
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
4304
3960
|
* or to provide a custom fetch implementation for e.g. testing.
|
|
4305
3961
|
*/
|
|
4306
|
-
fetch?:
|
|
3962
|
+
fetch?: FetchFunction;
|
|
4307
3963
|
/**
|
|
4308
3964
|
* When a function is provided, it will be used
|
|
4309
3965
|
* to prepare the request body for the chat API. This can be useful for
|
|
@@ -4323,11 +3979,6 @@ export declare type HttpChatTransportInitOptions<UI_MESSAGE extends UIMessage> =
|
|
|
4323
3979
|
*/
|
|
4324
3980
|
export declare type IdGenerator = () => string;
|
|
4325
3981
|
|
|
4326
|
-
/**
|
|
4327
|
-
* A function that generates an ID.
|
|
4328
|
-
*/
|
|
4329
|
-
declare type IdGenerator_2 = () => string;
|
|
4330
|
-
|
|
4331
3982
|
/**
|
|
4332
3983
|
* Image model that is used by the AI SDK.
|
|
4333
3984
|
*/
|
|
@@ -4792,32 +4443,6 @@ export declare interface ImagePart {
|
|
|
4792
4443
|
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4793
4444
|
*/
|
|
4794
4445
|
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
4446
|
/**
|
|
4822
4447
|
* Additional provider-specific metadata. They are passed through
|
|
4823
4448
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -4848,9 +4473,7 @@ declare type InferElementOutput<OUTPUT extends Output_2> = OUTPUT extends Output
|
|
|
4848
4473
|
*/
|
|
4849
4474
|
export declare type InferGenerateOutput<OUTPUT extends Output_2> = OUTPUT extends Output_2<infer COMPLETE_OUTPUT, any, any> ? COMPLETE_OUTPUT : never;
|
|
4850
4475
|
|
|
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;
|
|
4476
|
+
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
4477
|
|
|
4855
4478
|
/**
|
|
4856
4479
|
* Infers the partial output type from the output specification.
|
|
@@ -4862,21 +4485,11 @@ export declare type InferStreamOutput<OUTPUT extends Output_2> = OUTPUT extends
|
|
|
4862
4485
|
*/
|
|
4863
4486
|
export declare type InferToolInput<TOOL extends Tool> = TOOL extends Tool<infer INPUT, any> ? INPUT : never;
|
|
4864
4487
|
|
|
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
4488
|
/**
|
|
4871
4489
|
* Infer the output type of a tool.
|
|
4872
4490
|
*/
|
|
4873
4491
|
export declare type InferToolOutput<TOOL extends Tool> = TOOL extends Tool<any, infer OUTPUT> ? OUTPUT : never;
|
|
4874
4492
|
|
|
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
4493
|
export declare type InferUIDataParts<T extends UIDataPartSchemas> = {
|
|
4881
4494
|
[K in keyof T]: InferSchema<T[K]>;
|
|
4882
4495
|
};
|
|
@@ -4888,12 +4501,12 @@ declare type InferUIMessageData<T extends UIMessage> = T extends UIMessage<unkno
|
|
|
4888
4501
|
declare type InferUIMessageMetadata<T extends UIMessage> = T extends UIMessage<infer METADATA> ? METADATA : unknown;
|
|
4889
4502
|
|
|
4890
4503
|
declare type InferUIMessageToolCall<UI_MESSAGE extends UIMessage> = ValueOf<{
|
|
4891
|
-
[NAME in keyof InferUIMessageTools<UI_MESSAGE>]:
|
|
4504
|
+
[NAME in keyof InferUIMessageTools<UI_MESSAGE>]: ToolCall<NAME & string, InferUIMessageTools<UI_MESSAGE>[NAME] extends {
|
|
4892
4505
|
input: infer INPUT;
|
|
4893
4506
|
} ? INPUT : never> & {
|
|
4894
4507
|
dynamic?: false;
|
|
4895
4508
|
};
|
|
4896
|
-
}> | (
|
|
4509
|
+
}> | (ToolCall<string, unknown> & {
|
|
4897
4510
|
dynamic: true;
|
|
4898
4511
|
});
|
|
4899
4512
|
|
|
@@ -4921,13 +4534,6 @@ declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPre
|
|
|
4921
4534
|
schemaSuffix?: string;
|
|
4922
4535
|
}): LanguageModelV3Prompt;
|
|
4923
4536
|
|
|
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
4537
|
export declare class InvalidArgumentError extends AISDKError {
|
|
4932
4538
|
private readonly [symbol$h];
|
|
4933
4539
|
readonly parameter: string;
|
|
@@ -5038,8 +4644,6 @@ export declare class InvalidToolInputError extends AISDKError {
|
|
|
5038
4644
|
|
|
5039
4645
|
declare function isAbortError(error: unknown): error is Error;
|
|
5040
4646
|
|
|
5041
|
-
declare function isAbortError_2(error: unknown): error is Error;
|
|
5042
|
-
|
|
5043
4647
|
/**
|
|
5044
4648
|
* Check if a message part is a data part.
|
|
5045
4649
|
*/
|
|
@@ -5065,14 +4669,7 @@ declare function isJSONObject(value: unknown): value is JSONObject;
|
|
|
5065
4669
|
|
|
5066
4670
|
declare function isJSONValue(value: unknown): value is JSONValue_2;
|
|
5067
4671
|
|
|
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>;
|
|
4672
|
+
export declare function isLoopFinished(): StopCondition<any>;
|
|
5076
4673
|
|
|
5077
4674
|
/**
|
|
5078
4675
|
* Type guard that checks whether a value is not `null` or `undefined`.
|
|
@@ -5081,12 +4678,10 @@ declare function isNonNullable<T>(value: T | undefined | null): value is NonNull
|
|
|
5081
4678
|
* @param value - The value to check.
|
|
5082
4679
|
* @returns `true` if the value is neither `null` nor `undefined`, otherwise `false`.
|
|
5083
4680
|
*/
|
|
5084
|
-
declare function
|
|
4681
|
+
declare function isNonNullable<T>(value: T | undefined | null): value is NonNullable<T>;
|
|
5085
4682
|
|
|
5086
4683
|
declare function isParsableJson(input: string): boolean;
|
|
5087
4684
|
|
|
5088
|
-
declare function isParsableJson_2(input: string): boolean;
|
|
5089
|
-
|
|
5090
4685
|
/**
|
|
5091
4686
|
* Type guard to check if a message part is a reasoning part.
|
|
5092
4687
|
*/
|
|
@@ -5135,23 +4730,6 @@ declare function isUrlSupported({ mediaType, url, supportedUrls, }: {
|
|
|
5135
4730
|
supportedUrls: Record<string, RegExp[]>;
|
|
5136
4731
|
}): boolean;
|
|
5137
4732
|
|
|
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
4733
|
declare type Job = () => Promise<void>;
|
|
5156
4734
|
|
|
5157
4735
|
declare type JSONArray = JSONValue_2[];
|
|
@@ -5177,7 +4755,7 @@ export declare class JSONParseError extends AISDKError {
|
|
|
5177
4755
|
* @param options.validate Optional. A validation function for the schema.
|
|
5178
4756
|
*/
|
|
5179
4757
|
export declare function jsonSchema<OBJECT = unknown>(jsonSchema: JSONSchema7 | PromiseLike<JSONSchema7> | (() => JSONSchema7 | PromiseLike<JSONSchema7>), { validate, }?: {
|
|
5180
|
-
validate?: (value: unknown) =>
|
|
4758
|
+
validate?: (value: unknown) => ValidationResult<OBJECT> | PromiseLike<ValidationResult<OBJECT>>;
|
|
5181
4759
|
}): Schema<OBJECT>;
|
|
5182
4760
|
|
|
5183
4761
|
export declare interface JSONSchema7 {
|
|
@@ -5339,16 +4917,6 @@ declare type JSONSchema7TypeName =
|
|
|
5339
4917
|
*/
|
|
5340
4918
|
declare type JSONSchema7Version = string;
|
|
5341
4919
|
|
|
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
4920
|
/**
|
|
5353
4921
|
* A TransformStream that converts JSON objects to Server-Sent Events (SSE) format.
|
|
5354
4922
|
* Each object is serialized to JSON and wrapped in `data: ...\n\n` format.
|
|
@@ -5366,6 +4934,10 @@ export declare type JSONValue = JSONValue_2;
|
|
|
5366
4934
|
*/
|
|
5367
4935
|
declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
|
|
5368
4936
|
|
|
4937
|
+
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "video"];
|
|
4938
|
+
|
|
4939
|
+
declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
|
|
4940
|
+
|
|
5369
4941
|
/**
|
|
5370
4942
|
* Language model that is used by the AI SDK.
|
|
5371
4943
|
*/
|
|
@@ -7418,19 +6990,7 @@ export declare function lastAssistantMessageIsCompleteWithToolCalls({ messages,
|
|
|
7418
6990
|
messages: UIMessage[];
|
|
7419
6991
|
}): boolean;
|
|
7420
6992
|
|
|
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>;
|
|
6993
|
+
declare type LazySchema<SCHEMA> = () => Schema<SCHEMA>;
|
|
7434
6994
|
|
|
7435
6995
|
/**
|
|
7436
6996
|
* Creates a schema with deferred creation.
|
|
@@ -7440,7 +7000,7 @@ declare type LazySchema_2<SCHEMA> = () => Schema<SCHEMA>;
|
|
|
7440
7000
|
* @param createValidator A function that creates a schema.
|
|
7441
7001
|
* @returns A function that returns a schema.
|
|
7442
7002
|
*/
|
|
7443
|
-
declare function
|
|
7003
|
+
declare function lazySchema<SCHEMA>(createSchema: () => Schema<SCHEMA>): LazySchema<SCHEMA>;
|
|
7444
7004
|
|
|
7445
7005
|
/**
|
|
7446
7006
|
* A pointer from the current {@link Span} to another span in the same trace or
|
|
@@ -7480,13 +7040,6 @@ declare function loadApiKey({ apiKey, environmentVariableName, apiKeyParameterNa
|
|
|
7480
7040
|
description: string;
|
|
7481
7041
|
}): string;
|
|
7482
7042
|
|
|
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
7043
|
export declare class LoadAPIKeyError extends AISDKError {
|
|
7491
7044
|
private readonly [symbol$6];
|
|
7492
7045
|
constructor({ message }: {
|
|
@@ -7507,18 +7060,6 @@ declare function loadOptionalSetting({ settingValue, environmentVariableName, }:
|
|
|
7507
7060
|
environmentVariableName: string;
|
|
7508
7061
|
}): string | undefined;
|
|
7509
7062
|
|
|
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
7063
|
/**
|
|
7523
7064
|
* Loads a `string` setting from the environment or a parameter.
|
|
7524
7065
|
*
|
|
@@ -7535,22 +7076,6 @@ declare function loadSetting({ settingValue, environmentVariableName, settingNam
|
|
|
7535
7076
|
description: string;
|
|
7536
7077
|
}): string;
|
|
7537
7078
|
|
|
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
7079
|
export declare class LoadSettingError extends AISDKError {
|
|
7555
7080
|
private readonly [symbol$5];
|
|
7556
7081
|
constructor({ message }: {
|
|
@@ -7590,8 +7115,6 @@ export { LogWarningsFunction }
|
|
|
7590
7115
|
|
|
7591
7116
|
declare type MaybePromiseLike<T> = T | PromiseLike<T>;
|
|
7592
7117
|
|
|
7593
|
-
declare type MaybePromiseLike_2<T> = T | PromiseLike<T>;
|
|
7594
|
-
|
|
7595
7118
|
/**
|
|
7596
7119
|
* Maps a media type to its corresponding file extension.
|
|
7597
7120
|
* It was originally introduced to set a filename for audio file uploads
|
|
@@ -7603,17 +7126,6 @@ declare type MaybePromiseLike_2<T> = T | PromiseLike<T>;
|
|
|
7603
7126
|
*/
|
|
7604
7127
|
declare function mediaTypeToExtension(mediaType: string): string;
|
|
7605
7128
|
|
|
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
7129
|
export declare class MessageConversionError extends AISDKError {
|
|
7618
7130
|
private readonly [symbol$2_2];
|
|
7619
7131
|
readonly originalMessage: Omit<UIMessage, 'id'>;
|
|
@@ -7639,18 +7151,10 @@ export declare class MissingToolResultsError extends AISDKError {
|
|
|
7639
7151
|
*/
|
|
7640
7152
|
export declare type ModelMessage = SystemModelMessage | UserModelMessage | AssistantModelMessage | ToolModelMessage;
|
|
7641
7153
|
|
|
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
7154
|
export declare const modelMessageSchema: z.ZodType<ModelMessage>;
|
|
7649
7155
|
|
|
7650
7156
|
declare type NeverOptional<N, T> = 0 extends 1 & N ? Partial<T> : [N] extends [never] ? Partial<Record<keyof T, undefined>> : T;
|
|
7651
7157
|
|
|
7652
|
-
declare type NeverOptional_2<N, T> = 0 extends 1 & N ? Partial<T> : [N] extends [never] ? Partial<Record<keyof T, undefined>> : T;
|
|
7653
|
-
|
|
7654
7158
|
/**
|
|
7655
7159
|
* Thrown when the AI provider fails to generate any content.
|
|
7656
7160
|
*/
|
|
@@ -7743,15 +7247,6 @@ export declare class NoOutputGeneratedError extends AISDKError {
|
|
|
7743
7247
|
*/
|
|
7744
7248
|
declare function normalizeHeaders(headers: HeadersInit | Record<string, string | undefined> | Array<[string, string | undefined]> | undefined): Record<string, string>;
|
|
7745
7249
|
|
|
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
7250
|
/**
|
|
7756
7251
|
* Error that is thrown when no speech audio was generated.
|
|
7757
7252
|
*/
|
|
@@ -7778,7 +7273,7 @@ export declare class NoSuchModelError extends AISDKError {
|
|
|
7778
7273
|
}
|
|
7779
7274
|
|
|
7780
7275
|
export declare class NoSuchProviderError extends NoSuchModelError {
|
|
7781
|
-
private readonly [
|
|
7276
|
+
private readonly [symbol_3];
|
|
7782
7277
|
readonly providerId: string;
|
|
7783
7278
|
readonly availableProviders: string[];
|
|
7784
7279
|
constructor({ modelId, modelType, providerId, availableProviders, message, }: {
|
|
@@ -7931,7 +7426,7 @@ export declare interface OnStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT ex
|
|
|
7931
7426
|
/** Additional HTTP headers sent with the request. */
|
|
7932
7427
|
readonly headers: Record<string, string | undefined> | undefined;
|
|
7933
7428
|
/** Additional provider-specific options. */
|
|
7934
|
-
readonly providerOptions:
|
|
7429
|
+
readonly providerOptions: ProviderOptions | undefined;
|
|
7935
7430
|
/**
|
|
7936
7431
|
* Condition(s) for stopping the generation.
|
|
7937
7432
|
* When the condition is an array, any of the conditions can be met to stop.
|
|
@@ -7997,7 +7492,7 @@ export declare interface OnStepStartEvent<TOOLS extends ToolSet = ToolSet, OUTPU
|
|
|
7997
7492
|
/** Array of results from previous steps (empty for first step). */
|
|
7998
7493
|
readonly steps: ReadonlyArray<StepResult<TOOLS>>;
|
|
7999
7494
|
/** Additional provider-specific options for this step. */
|
|
8000
|
-
readonly providerOptions:
|
|
7495
|
+
readonly providerOptions: ProviderOptions | undefined;
|
|
8001
7496
|
/**
|
|
8002
7497
|
* Timeout configuration for the generation.
|
|
8003
7498
|
* Can be a number (milliseconds) or an object with totalMs, stepMs, chunkMs.
|
|
@@ -8297,30 +7792,6 @@ declare function parseJSON(options: {
|
|
|
8297
7792
|
* @returns {Promise<T>} - The parsed object.
|
|
8298
7793
|
*/
|
|
8299
7794
|
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
7795
|
text: string;
|
|
8325
7796
|
schema: FlexibleSchema<T>;
|
|
8326
7797
|
}): Promise<T>;
|
|
@@ -8331,14 +7802,6 @@ declare function parseJSON_2<T>(options: {
|
|
|
8331
7802
|
export declare function parseJsonEventStream<T>({ stream, schema, }: {
|
|
8332
7803
|
stream: ReadableStream<Uint8Array>;
|
|
8333
7804
|
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
7805
|
}): ReadableStream<ParseResult<T>>;
|
|
8343
7806
|
|
|
8344
7807
|
export declare function parsePartialJson(jsonText: string | undefined): Promise<{
|
|
@@ -8347,12 +7810,6 @@ export declare function parsePartialJson(jsonText: string | undefined): Promise<
|
|
|
8347
7810
|
}>;
|
|
8348
7811
|
|
|
8349
7812
|
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
7813
|
provider: string;
|
|
8357
7814
|
providerOptions: Record<string, unknown> | undefined;
|
|
8358
7815
|
schema: FlexibleSchema<OPTIONS>;
|
|
@@ -8368,16 +7825,6 @@ declare type ParseResult<T> = {
|
|
|
8368
7825
|
rawValue: unknown;
|
|
8369
7826
|
};
|
|
8370
7827
|
|
|
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
7828
|
declare type PartialMap<KeyType, ValueType> = {} & Map<DeepPartialInternal<KeyType>, DeepPartialInternal<ValueType>>;
|
|
8382
7829
|
|
|
8383
7830
|
declare type PartialObject<ObjectType extends object> = {
|
|
@@ -8598,20 +8045,6 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
|
|
|
8598
8045
|
responseHeaders?: Record<string, string>;
|
|
8599
8046
|
}>;
|
|
8600
8047
|
|
|
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
8048
|
declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
|
|
8616
8049
|
url: string;
|
|
8617
8050
|
headers?: Record<string, string | undefined>;
|
|
@@ -8626,20 +8059,6 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
|
|
|
8626
8059
|
responseHeaders?: Record<string, string>;
|
|
8627
8060
|
}>;
|
|
8628
8061
|
|
|
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
8062
|
declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
8644
8063
|
url: string;
|
|
8645
8064
|
headers?: Record<string, string | undefined>;
|
|
@@ -8657,23 +8076,6 @@ declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, fa
|
|
|
8657
8076
|
responseHeaders?: Record<string, string>;
|
|
8658
8077
|
}>;
|
|
8659
8078
|
|
|
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
8079
|
export declare type PrepareReconnectToStreamRequest = (options: {
|
|
8678
8080
|
id: string;
|
|
8679
8081
|
requestMetadata: unknown;
|
|
@@ -8790,7 +8192,7 @@ export declare type PrepareStepResult<TOOLS extends Record<string, Tool> = Recor
|
|
|
8790
8192
|
* Can be used to pass provider-specific configuration such as
|
|
8791
8193
|
* container IDs for Anthropic's code execution.
|
|
8792
8194
|
*/
|
|
8793
|
-
providerOptions?:
|
|
8195
|
+
providerOptions?: ProviderOptions;
|
|
8794
8196
|
} | undefined;
|
|
8795
8197
|
|
|
8796
8198
|
/**
|
|
@@ -8802,6 +8204,15 @@ export declare type Prompt = {
|
|
|
8802
8204
|
* System message to include in the prompt. Can be used with `prompt` or `messages`.
|
|
8803
8205
|
*/
|
|
8804
8206
|
system?: string | SystemModelMessage | Array<SystemModelMessage>;
|
|
8207
|
+
/**
|
|
8208
|
+
* Whether system messages are allowed in the `prompt` or `messages` fields.
|
|
8209
|
+
*
|
|
8210
|
+
* When disabled, system messages must be provided through the `system`
|
|
8211
|
+
* option. When unset, system messages are allowed with a warning.
|
|
8212
|
+
*
|
|
8213
|
+
* @default undefined
|
|
8214
|
+
*/
|
|
8215
|
+
allowSystemInMessages?: boolean;
|
|
8805
8216
|
} & ({
|
|
8806
8217
|
/**
|
|
8807
8218
|
* A prompt. It can be either a text prompt or a list of messages.
|
|
@@ -8884,14 +8295,15 @@ export declare type Provider = {
|
|
|
8884
8295
|
* This is needed to enable provider-specific functionality that can be
|
|
8885
8296
|
* fully encapsulated in the provider.
|
|
8886
8297
|
*/
|
|
8887
|
-
export declare type ProviderMetadata = SharedV3ProviderMetadata;
|
|
8298
|
+
export declare type ProviderMetadata = SharedV3ProviderMetadata;
|
|
8299
|
+
|
|
8888
8300
|
/**
|
|
8889
8301
|
* Additional provider-specific options.
|
|
8890
8302
|
*
|
|
8891
8303
|
* They are passed through to the provider from the AI SDK and enable
|
|
8892
8304
|
* provider-specific functionality that can be fully encapsulated in the provider.
|
|
8893
8305
|
*/
|
|
8894
|
-
declare type
|
|
8306
|
+
declare type ProviderOptions = SharedV3ProviderOptions;
|
|
8895
8307
|
|
|
8896
8308
|
export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV3> = Record<string, ProviderV3>, SEPARATOR extends string = ':'> {
|
|
8897
8309
|
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV3;
|
|
@@ -8909,15 +8321,6 @@ export declare interface ProviderRegistryProvider<PROVIDERS extends Record<strin
|
|
|
8909
8321
|
}
|
|
8910
8322
|
|
|
8911
8323
|
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
8324
|
execute?: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
8922
8325
|
needsApproval?: Tool<INPUT, OUTPUT>['needsApproval'];
|
|
8923
8326
|
toModelOutput?: Tool<INPUT, OUTPUT>['toModelOutput'];
|
|
@@ -8927,15 +8330,6 @@ declare type ProviderToolFactory_2<INPUT, ARGS extends object> = <OUTPUT>(option
|
|
|
8927
8330
|
}) => Tool<INPUT, OUTPUT>;
|
|
8928
8331
|
|
|
8929
8332
|
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
8333
|
execute?: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
8940
8334
|
needsApproval?: Tool<INPUT, OUTPUT>['needsApproval'];
|
|
8941
8335
|
toModelOutput?: Tool<INPUT, OUTPUT>['toModelOutput'];
|
|
@@ -9118,25 +8512,6 @@ declare function readResponseWithSizeLimit({ response, url, maxBytes, }: {
|
|
|
9118
8512
|
maxBytes?: number;
|
|
9119
8513
|
}): Promise<Uint8Array>;
|
|
9120
8514
|
|
|
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
8515
|
/**
|
|
9141
8516
|
* Transforms a stream of `UIMessageChunk`s into an `AsyncIterableStream` of `UIMessage`s.
|
|
9142
8517
|
*
|
|
@@ -9189,23 +8564,6 @@ declare interface ReasoningPart {
|
|
|
9189
8564
|
providerOptions?: ProviderOptions;
|
|
9190
8565
|
}
|
|
9191
8566
|
|
|
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
8567
|
/**
|
|
9210
8568
|
* A reasoning part of a message.
|
|
9211
8569
|
*/
|
|
@@ -9237,13 +8595,6 @@ export declare function registerTelemetryIntegration(integration: TelemetryInteg
|
|
|
9237
8595
|
*/
|
|
9238
8596
|
declare function removeUndefinedEntries<T>(record: Record<string, T | undefined>): Record<string, T>;
|
|
9239
8597
|
|
|
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
8598
|
/**
|
|
9248
8599
|
* A function that attempts to repair the raw output of the model
|
|
9249
8600
|
* to enable JSON parsing.
|
|
@@ -9271,7 +8622,7 @@ export declare type RepairTextFunction = (options: {
|
|
|
9271
8622
|
*
|
|
9272
8623
|
* @returns A result object that contains the reranked documents, the reranked indices, and additional information.
|
|
9273
8624
|
*/
|
|
9274
|
-
export declare function rerank<VALUE extends JSONObject | string>({ model, documents, query, topN, maxRetries: maxRetriesArg, abortSignal, headers, providerOptions, experimental_telemetry: telemetry, }: {
|
|
8625
|
+
export declare function rerank<VALUE extends JSONObject | string>({ model: modelArg, documents, query, topN, maxRetries: maxRetriesArg, abortSignal, headers, providerOptions, experimental_telemetry: telemetry, }: {
|
|
9275
8626
|
/**
|
|
9276
8627
|
* The reranking model to use.
|
|
9277
8628
|
*/
|
|
@@ -9312,13 +8663,13 @@ export declare function rerank<VALUE extends JSONObject | string>({ model, docum
|
|
|
9312
8663
|
* to the provider from the AI SDK and enable provider-specific
|
|
9313
8664
|
* functionality that can be fully encapsulated in the provider.
|
|
9314
8665
|
*/
|
|
9315
|
-
providerOptions?:
|
|
8666
|
+
providerOptions?: ProviderOptions;
|
|
9316
8667
|
}): Promise<RerankResult<VALUE>>;
|
|
9317
8668
|
|
|
9318
8669
|
/**
|
|
9319
8670
|
* Reranking model that is used by the AI SDK.
|
|
9320
8671
|
*/
|
|
9321
|
-
export declare type RerankingModel = RerankingModelV3;
|
|
8672
|
+
export declare type RerankingModel = string | RerankingModelV3;
|
|
9322
8673
|
|
|
9323
8674
|
/**
|
|
9324
8675
|
* Specification for a reranking model that implements the reranking model interface version 3.
|
|
@@ -9492,20 +8843,12 @@ export declare interface RerankResult<VALUE> {
|
|
|
9492
8843
|
|
|
9493
8844
|
declare type Resolvable<T> = MaybePromiseLike<T> | (() => MaybePromiseLike<T>);
|
|
9494
8845
|
|
|
9495
|
-
declare type Resolvable_2<T> = MaybePromiseLike_2<T> | (() => MaybePromiseLike_2<T>);
|
|
9496
|
-
|
|
9497
8846
|
/**
|
|
9498
8847
|
* Resolves a value that could be a raw value, a Promise, a function returning a value,
|
|
9499
8848
|
* or a function returning a Promise.
|
|
9500
8849
|
*/
|
|
9501
8850
|
declare function resolve<T>(value: Resolvable<T>): Promise<T>;
|
|
9502
8851
|
|
|
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
8852
|
declare type ResponseHandler<RETURN_TYPE> = (options: {
|
|
9510
8853
|
url: string;
|
|
9511
8854
|
requestBodyValues: unknown;
|
|
@@ -9516,16 +8859,6 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
|
|
|
9516
8859
|
responseHeaders?: Record<string, string>;
|
|
9517
8860
|
}>;
|
|
9518
8861
|
|
|
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
8862
|
/**
|
|
9530
8863
|
* A message that was generated during the generation process.
|
|
9531
8864
|
* It can be either an assistant message or a tool message.
|
|
@@ -9567,33 +8900,9 @@ declare function safeParseJSON(options: {
|
|
|
9567
8900
|
* @returns An object with either a `success` flag and the parsed and typed data, or a `success` flag and an error object.
|
|
9568
8901
|
*/
|
|
9569
8902
|
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
8903
|
text: string;
|
|
9595
8904
|
schema: FlexibleSchema<T>;
|
|
9596
|
-
}): Promise<
|
|
8905
|
+
}): Promise<ParseResult<T>>;
|
|
9597
8906
|
|
|
9598
8907
|
/**
|
|
9599
8908
|
* Safely validates the types of an unknown object using a schema and
|
|
@@ -9607,7 +8916,7 @@ declare function safeParseJSON_2<T>(options: {
|
|
|
9607
8916
|
*/
|
|
9608
8917
|
declare function safeValidateTypes<OBJECT>({ value, schema, context, }: {
|
|
9609
8918
|
value: unknown;
|
|
9610
|
-
schema:
|
|
8919
|
+
schema: FlexibleSchema<OBJECT>;
|
|
9611
8920
|
context?: TypeValidationContext;
|
|
9612
8921
|
}): Promise<{
|
|
9613
8922
|
success: true;
|
|
@@ -9620,33 +8929,9 @@ declare function safeValidateTypes<OBJECT>({ value, schema, context, }: {
|
|
|
9620
8929
|
}>;
|
|
9621
8930
|
|
|
9622
8931
|
/**
|
|
9623
|
-
*
|
|
9624
|
-
*
|
|
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>;
|
|
9635
|
-
context?: TypeValidationContext;
|
|
9636
|
-
}): Promise<{
|
|
9637
|
-
success: true;
|
|
9638
|
-
value: OBJECT;
|
|
9639
|
-
rawValue: unknown;
|
|
9640
|
-
} | {
|
|
9641
|
-
success: false;
|
|
9642
|
-
error: TypeValidationError;
|
|
9643
|
-
rawValue: unknown;
|
|
9644
|
-
}>;
|
|
9645
|
-
|
|
9646
|
-
/**
|
|
9647
|
-
* Validates a list of UI messages like `validateUIMessages`,
|
|
9648
|
-
* but instead of throwing it returns `{ success: true, data }`
|
|
9649
|
-
* or `{ success: false, error }`.
|
|
8932
|
+
* Validates a list of UI messages like `validateUIMessages`,
|
|
8933
|
+
* but instead of throwing it returns `{ success: true, data }`
|
|
8934
|
+
* or `{ success: false, error }`.
|
|
9650
8935
|
*/
|
|
9651
8936
|
export declare function safeValidateUIMessages<UI_MESSAGE extends UIMessage>({ messages, metadataSchema, dataSchemas, tools, }: {
|
|
9652
8937
|
messages: unknown;
|
|
@@ -9668,26 +8953,6 @@ export declare type SafeValidateUIMessagesResult<UI_MESSAGE extends UIMessage> =
|
|
|
9668
8953
|
};
|
|
9669
8954
|
|
|
9670
8955
|
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
8956
|
/**
|
|
9692
8957
|
* Used to mark schemas so we can support both Zod and custom schemas.
|
|
9693
8958
|
*/
|
|
@@ -9712,11 +8977,6 @@ declare type Schema_2<OBJECT = unknown> = {
|
|
|
9712
8977
|
*/
|
|
9713
8978
|
declare const schemaSymbol: unique symbol;
|
|
9714
8979
|
|
|
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
8980
|
export declare class SerialJobExecutor {
|
|
9721
8981
|
private queue;
|
|
9722
8982
|
private isProcessing;
|
|
@@ -10623,8 +9883,6 @@ declare namespace StandardJSONSchemaV1 {
|
|
|
10623
9883
|
|
|
10624
9884
|
declare type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & StandardJSONSchemaV1<unknown, SCHEMA>;
|
|
10625
9885
|
|
|
10626
|
-
declare type StandardSchema_2<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & StandardJSONSchemaV1<unknown, SCHEMA>;
|
|
10627
|
-
|
|
10628
9886
|
/** The Standard Schema interface. */
|
|
10629
9887
|
declare interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
10630
9888
|
/** The Standard Schema properties. */
|
|
@@ -10725,6 +9983,7 @@ export declare type StaticToolError<TOOLS extends ToolSet> = ValueOf<{
|
|
|
10725
9983
|
error: unknown;
|
|
10726
9984
|
providerExecuted?: boolean;
|
|
10727
9985
|
providerMetadata?: ProviderMetadata;
|
|
9986
|
+
toolMetadata?: JSONObject;
|
|
10728
9987
|
dynamic?: false | undefined;
|
|
10729
9988
|
title?: string;
|
|
10730
9989
|
};
|
|
@@ -10752,6 +10011,7 @@ export declare type StaticToolResult<TOOLS extends ToolSet> = ValueOf<{
|
|
|
10752
10011
|
output: InferToolOutput<TOOLS[NAME]>;
|
|
10753
10012
|
providerExecuted?: boolean;
|
|
10754
10013
|
providerMetadata?: ProviderMetadata;
|
|
10014
|
+
toolMetadata?: JSONObject;
|
|
10755
10015
|
dynamic?: false | undefined;
|
|
10756
10016
|
preliminary?: boolean;
|
|
10757
10017
|
title?: string;
|
|
@@ -10802,7 +10062,7 @@ export declare type StepResult<TOOLS extends ToolSet> = {
|
|
|
10802
10062
|
/**
|
|
10803
10063
|
* The reasoning that was generated during the generation.
|
|
10804
10064
|
*/
|
|
10805
|
-
readonly reasoning: Array<
|
|
10065
|
+
readonly reasoning: Array<ReasoningPart>;
|
|
10806
10066
|
/**
|
|
10807
10067
|
* The reasoning text that was generated during the generation.
|
|
10808
10068
|
*/
|
|
@@ -10903,6 +10163,7 @@ export declare type StopCondition<TOOLS extends ToolSet> = (options: {
|
|
|
10903
10163
|
* @param system - A system message that will be part of the prompt.
|
|
10904
10164
|
* @param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
|
|
10905
10165
|
* @param messages - A list of messages. You can either use `prompt` or `messages` but not both.
|
|
10166
|
+
* @param allowSystemInMessages - Whether system messages are allowed in the `prompt` or `messages` fields. When unset, system messages are allowed with a warning.
|
|
10906
10167
|
*
|
|
10907
10168
|
* @param maxOutputTokens - Maximum number of tokens to generate.
|
|
10908
10169
|
* @param temperature - Temperature setting.
|
|
@@ -11004,7 +10265,7 @@ export declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = Fl
|
|
|
11004
10265
|
* to the provider from the AI SDK and enable provider-specific
|
|
11005
10266
|
* functionality that can be fully encapsulated in the provider.
|
|
11006
10267
|
*/
|
|
11007
|
-
providerOptions?:
|
|
10268
|
+
providerOptions?: ProviderOptions;
|
|
11008
10269
|
/**
|
|
11009
10270
|
* Callback that is invoked when an error occurs during streaming.
|
|
11010
10271
|
* You can use it to log errors.
|
|
@@ -11160,19 +10421,19 @@ declare interface StreamOptions {
|
|
|
11160
10421
|
*
|
|
11161
10422
|
* @defaultValue `undefined`
|
|
11162
10423
|
*/
|
|
11163
|
-
onError?: (
|
|
10424
|
+
onError?: ("terminate" | ((error: Error) => void)) | undefined;
|
|
11164
10425
|
/**
|
|
11165
10426
|
* Callback for when a reconnection interval is sent from the server.
|
|
11166
10427
|
*
|
|
11167
10428
|
* @param retry - The number of milliseconds to wait before reconnecting.
|
|
11168
10429
|
*/
|
|
11169
|
-
onRetry?: ((retry: number) => void) | undefined
|
|
10430
|
+
onRetry?: ((retry: number) => void) | undefined;
|
|
11170
10431
|
/**
|
|
11171
10432
|
* Callback for when a comment is encountered in the stream.
|
|
11172
10433
|
*
|
|
11173
10434
|
* @param comment - The comment encountered in the stream.
|
|
11174
10435
|
*/
|
|
11175
|
-
onComment?: ((comment: string) => void) | undefined
|
|
10436
|
+
onComment?: ((comment: string) => void) | undefined;
|
|
11176
10437
|
}
|
|
11177
10438
|
|
|
11178
10439
|
/**
|
|
@@ -11186,6 +10447,7 @@ declare interface StreamOptions {
|
|
|
11186
10447
|
* @param system - A system message that will be part of the prompt.
|
|
11187
10448
|
* @param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
|
|
11188
10449
|
* @param messages - A list of messages. You can either use `prompt` or `messages` but not both.
|
|
10450
|
+
* @param allowSystemInMessages - Whether system messages are allowed in the `prompt` or `messages` fields. When unset, system messages are allowed with a warning.
|
|
11189
10451
|
*
|
|
11190
10452
|
* @param maxOutputTokens - Maximum number of tokens to generate.
|
|
11191
10453
|
* @param temperature - Temperature setting.
|
|
@@ -11221,7 +10483,7 @@ declare interface StreamOptions {
|
|
|
11221
10483
|
* @returns
|
|
11222
10484
|
* A result object for accessing different stream types and additional information.
|
|
11223
10485
|
*/
|
|
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 & {
|
|
10486
|
+
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
10487
|
/**
|
|
11226
10488
|
* The language model to use.
|
|
11227
10489
|
*/
|
|
@@ -11250,7 +10512,7 @@ export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_
|
|
|
11250
10512
|
* to the provider from the AI SDK and enable provider-specific
|
|
11251
10513
|
* functionality that can be fully encapsulated in the provider.
|
|
11252
10514
|
*/
|
|
11253
|
-
providerOptions?:
|
|
10515
|
+
providerOptions?: ProviderOptions;
|
|
11254
10516
|
/**
|
|
11255
10517
|
* @deprecated Use `activeTools` instead.
|
|
11256
10518
|
*/
|
|
@@ -11696,16 +10958,6 @@ export declare type StreamTextTransform<TOOLS extends ToolSet> = (options: {
|
|
|
11696
10958
|
*/
|
|
11697
10959
|
declare function stripFileExtension(filename: string): string;
|
|
11698
10960
|
|
|
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
10961
|
declare const symbol$1: unique symbol;
|
|
11710
10962
|
|
|
11711
10963
|
declare const symbol$1_2: unique symbol;
|
|
@@ -11776,8 +11028,6 @@ declare const symbol_2: unique symbol;
|
|
|
11776
11028
|
|
|
11777
11029
|
declare const symbol_3: unique symbol;
|
|
11778
11030
|
|
|
11779
|
-
declare const symbol_4: unique symbol;
|
|
11780
|
-
|
|
11781
11031
|
/**
|
|
11782
11032
|
* A system message. It can contain system information.
|
|
11783
11033
|
*
|
|
@@ -11786,24 +11036,6 @@ declare const symbol_4: unique symbol;
|
|
|
11786
11036
|
* and because not all providers support several system messages.
|
|
11787
11037
|
*/
|
|
11788
11038
|
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
11039
|
role: 'system';
|
|
11808
11040
|
content: string;
|
|
11809
11041
|
/**
|
|
@@ -11876,23 +11108,6 @@ export declare type TelemetrySettings = {
|
|
|
11876
11108
|
* Text content part of a prompt. It contains a string of text.
|
|
11877
11109
|
*/
|
|
11878
11110
|
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
11111
|
type: 'text';
|
|
11897
11112
|
/**
|
|
11898
11113
|
* The text content.
|
|
@@ -11942,6 +11157,7 @@ export declare type TextStreamPart<TOOLS extends ToolSet> = {
|
|
|
11942
11157
|
id: string;
|
|
11943
11158
|
toolName: string;
|
|
11944
11159
|
providerMetadata?: ProviderMetadata;
|
|
11160
|
+
toolMetadata?: JSONObject;
|
|
11945
11161
|
providerExecuted?: boolean;
|
|
11946
11162
|
dynamic?: boolean;
|
|
11947
11163
|
title?: string;
|
|
@@ -12060,7 +11276,17 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
12060
11276
|
* to the provider from the AI SDK and enable provider-specific
|
|
12061
11277
|
* functionality that can be fully encapsulated in the provider.
|
|
12062
11278
|
*/
|
|
12063
|
-
providerOptions?:
|
|
11279
|
+
providerOptions?: ProviderOptions;
|
|
11280
|
+
/**
|
|
11281
|
+
* Optional metadata about the tool itself (e.g. its source).
|
|
11282
|
+
*
|
|
11283
|
+
* Unlike `providerOptions`, this metadata is not sent to the language
|
|
11284
|
+
* model. Instead, it is propagated onto the resulting tool call's
|
|
11285
|
+
* `toolMetadata` so consumers can read it from tool call / result parts
|
|
11286
|
+
* and UI message parts. This is useful for sources of dynamic tools (e.g.
|
|
11287
|
+
* an MCP server) to identify themselves.
|
|
11288
|
+
*/
|
|
11289
|
+
metadata?: JSONObject;
|
|
12064
11290
|
/**
|
|
12065
11291
|
* The schema of the input that the tool expects.
|
|
12066
11292
|
* The language model will use this to generate the input.
|
|
@@ -12079,7 +11305,7 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
12079
11305
|
/**
|
|
12080
11306
|
* Whether the tool needs approval before it can be executed.
|
|
12081
11307
|
*/
|
|
12082
|
-
needsApproval?: boolean |
|
|
11308
|
+
needsApproval?: boolean | ToolNeedsApprovalFunction<[INPUT] extends [never] ? unknown : INPUT>;
|
|
12083
11309
|
/**
|
|
12084
11310
|
* Strict mode setting for the tool.
|
|
12085
11311
|
*
|
|
@@ -12107,7 +11333,7 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
12107
11333
|
onInputAvailable?: (options: {
|
|
12108
11334
|
input: [INPUT] extends [never] ? unknown : INPUT;
|
|
12109
11335
|
} & ToolExecutionOptions) => void | PromiseLike<void>;
|
|
12110
|
-
} &
|
|
11336
|
+
} & ToolOutputProperties<INPUT, OUTPUT> & {
|
|
12111
11337
|
/**
|
|
12112
11338
|
* Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
12113
11339
|
*
|
|
@@ -12126,7 +11352,7 @@ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTP
|
|
|
12126
11352
|
* The output of the tool call.
|
|
12127
11353
|
*/
|
|
12128
11354
|
output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>;
|
|
12129
|
-
}) =>
|
|
11355
|
+
}) => ToolResultOutput | PromiseLike<ToolResultOutput>;
|
|
12130
11356
|
} & ({
|
|
12131
11357
|
/**
|
|
12132
11358
|
* Tool with user-defined input and output schemas.
|
|
@@ -12178,146 +11404,6 @@ export declare function tool<OUTPUT>(tool: Tool<never, OUTPUT>): Tool<never, OUT
|
|
|
12178
11404
|
|
|
12179
11405
|
export declare function tool(tool: Tool<never, never>): Tool<never, never>;
|
|
12180
11406
|
|
|
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
11407
|
/**
|
|
12322
11408
|
* Tool approval request prompt part.
|
|
12323
11409
|
*/
|
|
@@ -12333,21 +11419,6 @@ export declare type ToolApprovalRequest = {
|
|
|
12333
11419
|
toolCallId: string;
|
|
12334
11420
|
};
|
|
12335
11421
|
|
|
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
11422
|
/**
|
|
12352
11423
|
* Output part that indicates that a tool approval request has been made.
|
|
12353
11424
|
*
|
|
@@ -12389,30 +11460,6 @@ export declare type ToolApprovalResponse = {
|
|
|
12389
11460
|
providerExecuted?: boolean;
|
|
12390
11461
|
};
|
|
12391
11462
|
|
|
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
11463
|
/**
|
|
12417
11464
|
* Typed tool call that is returned by generateText and streamText.
|
|
12418
11465
|
* It contains the tool call ID, the tool name, and the tool arguments.
|
|
@@ -12441,34 +11488,6 @@ declare interface ToolCall<NAME extends string, INPUT> {
|
|
|
12441
11488
|
dynamic?: boolean;
|
|
12442
11489
|
}
|
|
12443
11490
|
|
|
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
11491
|
export declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
12473
11492
|
private readonly [symbol$e];
|
|
12474
11493
|
readonly toolCallId: string;
|
|
@@ -12485,44 +11504,10 @@ export declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
|
12485
11504
|
*/
|
|
12486
11505
|
export declare type ToolCallOptions = ToolExecutionOptions;
|
|
12487
11506
|
|
|
12488
|
-
/**
|
|
12489
|
-
* @deprecated Use ToolExecutionOptions instead.
|
|
12490
|
-
*/
|
|
12491
|
-
declare type ToolCallOptions_2 = ToolExecutionOptions_2;
|
|
12492
|
-
|
|
12493
11507
|
/**
|
|
12494
11508
|
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
12495
11509
|
*/
|
|
12496
11510
|
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
11511
|
type: 'tool-call';
|
|
12527
11512
|
/**
|
|
12528
11513
|
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
@@ -12601,15 +11586,8 @@ export declare type ToolChoice<TOOLS extends Record<string, unknown>> = 'auto' |
|
|
|
12601
11586
|
*/
|
|
12602
11587
|
export declare type ToolContent = Array<ToolResultPart | ToolApprovalResponse>;
|
|
12603
11588
|
|
|
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
11589
|
export declare type ToolExecuteFunction<INPUT, OUTPUT> = (input: INPUT, options: ToolExecutionOptions) => AsyncIterable<OUTPUT> | PromiseLike<OUTPUT> | OUTPUT;
|
|
12610
11590
|
|
|
12611
|
-
declare type ToolExecuteFunction_2<INPUT, OUTPUT> = (input: INPUT, options: ToolExecutionOptions_2) => AsyncIterable<OUTPUT> | PromiseLike<OUTPUT> | OUTPUT;
|
|
12612
|
-
|
|
12613
11591
|
/**
|
|
12614
11592
|
* Additional options that are sent into each tool call.
|
|
12615
11593
|
*/
|
|
@@ -12642,38 +11620,6 @@ export declare interface ToolExecutionOptions {
|
|
|
12642
11620
|
experimental_context?: unknown;
|
|
12643
11621
|
}
|
|
12644
11622
|
|
|
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
11623
|
/**
|
|
12678
11624
|
* A tool loop agent is an agent that runs tools in a loop. In each step,
|
|
12679
11625
|
* it calls the LLM, and if there are tool calls, it executes the tools
|
|
@@ -12698,31 +11644,23 @@ declare class ToolLoopAgent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OU
|
|
|
12698
11644
|
*/
|
|
12699
11645
|
get tools(): TOOLS;
|
|
12700
11646
|
private prepareCall;
|
|
12701
|
-
private
|
|
11647
|
+
private mergeOnStepFinishCallbacks;
|
|
12702
11648
|
/**
|
|
12703
11649
|
* Generates an output from the agent (non-streaming).
|
|
12704
11650
|
*/
|
|
12705
|
-
generate({ abortSignal, timeout,
|
|
11651
|
+
generate({ abortSignal, timeout, onStepFinish, ...options }: AgentCallParameters<CALL_OPTIONS, TOOLS>): Promise<GenerateTextResult<TOOLS, OUTPUT>>;
|
|
12706
11652
|
/**
|
|
12707
11653
|
* Streams an output from the agent (streaming).
|
|
12708
11654
|
*/
|
|
12709
|
-
stream({ abortSignal, timeout, experimental_transform,
|
|
11655
|
+
stream({ abortSignal, timeout, experimental_transform, onStepFinish, ...options }: AgentStreamParameters<CALL_OPTIONS, TOOLS>): Promise<StreamTextResult<TOOLS, OUTPUT>>;
|
|
12710
11656
|
}
|
|
12711
11657
|
export { ToolLoopAgent as Experimental_Agent }
|
|
12712
11658
|
export { ToolLoopAgent }
|
|
12713
11659
|
|
|
12714
11660
|
export declare type ToolLoopAgentOnFinishCallback<TOOLS extends ToolSet = {}> = (event: OnFinishEvent<TOOLS>) => PromiseLike<void> | void;
|
|
12715
11661
|
|
|
12716
|
-
export declare type ToolLoopAgentOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output_2 = Output_2> = (event: OnStartEvent<TOOLS, OUTPUT>) => PromiseLike<void> | void;
|
|
12717
|
-
|
|
12718
11662
|
export declare type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}> = (stepResult: OnStepFinishEvent<TOOLS>) => Promise<void> | void;
|
|
12719
11663
|
|
|
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
11664
|
/**
|
|
12727
11665
|
* Configuration options for an agent.
|
|
12728
11666
|
*/
|
|
@@ -12777,22 +11715,6 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
12777
11715
|
* A function that attempts to repair a tool call that failed to parse.
|
|
12778
11716
|
*/
|
|
12779
11717
|
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
11718
|
/**
|
|
12797
11719
|
* Callback that is called when each step (LLM call) is finished, including intermediate steps.
|
|
12798
11720
|
*/
|
|
@@ -12806,7 +11728,7 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
12806
11728
|
* to the provider from the AI SDK and enable provider-specific
|
|
12807
11729
|
* functionality that can be fully encapsulated in the provider.
|
|
12808
11730
|
*/
|
|
12809
|
-
providerOptions?:
|
|
11731
|
+
providerOptions?: ProviderOptions;
|
|
12810
11732
|
/**
|
|
12811
11733
|
* Context that is passed into tool calls.
|
|
12812
11734
|
*
|
|
@@ -12830,7 +11752,7 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
12830
11752
|
*
|
|
12831
11753
|
* You can use this to have templates based on call options.
|
|
12832
11754
|
*/
|
|
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'>) =>
|
|
11755
|
+
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
11756
|
};
|
|
12835
11757
|
export { ToolLoopAgentSettings as Experimental_AgentSettings }
|
|
12836
11758
|
export { ToolLoopAgentSettings }
|
|
@@ -12841,20 +11763,6 @@ export { ToolLoopAgentSettings }
|
|
|
12841
11763
|
export declare type ToolModelMessage = {
|
|
12842
11764
|
role: 'tool';
|
|
12843
11765
|
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
11766
|
/**
|
|
12859
11767
|
* Additional provider-specific metadata. They are passed through
|
|
12860
11768
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -12887,53 +11795,10 @@ declare interface ToolNameMapping {
|
|
|
12887
11795
|
toCustomToolName: (providerToolName: string) => string;
|
|
12888
11796
|
}
|
|
12889
11797
|
|
|
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
11798
|
/**
|
|
12913
11799
|
* Function that is called to determine if the tool needs approval before it can be executed.
|
|
12914
11800
|
*/
|
|
12915
11801
|
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
11802
|
/**
|
|
12938
11803
|
* The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
|
|
12939
11804
|
*/
|
|
@@ -12952,21 +11817,6 @@ declare type ToolNeedsApprovalFunction_2<INPUT> = (input: INPUT, options: {
|
|
|
12952
11817
|
}) => boolean | PromiseLike<boolean>;
|
|
12953
11818
|
|
|
12954
11819
|
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
11820
|
/**
|
|
12971
11821
|
* An async function that is called with the arguments from the tool call and produces a result.
|
|
12972
11822
|
* If not provided, the tool will not be executed automatically.
|
|
@@ -12978,45 +11828,14 @@ declare type ToolOutputProperties_2<INPUT, OUTPUT> = NeverOptional_2<OUTPUT, {
|
|
|
12978
11828
|
outputSchema?: FlexibleSchema<OUTPUT>;
|
|
12979
11829
|
} | {
|
|
12980
11830
|
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
|
-
}
|
|
11831
|
+
execute?: never;
|
|
11832
|
+
}>;
|
|
13014
11833
|
|
|
13015
11834
|
/**
|
|
13016
11835
|
* Typed tool result that is returned by `generateText` and `streamText`.
|
|
13017
11836
|
* It contains the tool call ID, the tool name, the tool arguments, and the tool result.
|
|
13018
11837
|
*/
|
|
13019
|
-
declare interface
|
|
11838
|
+
declare interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
13020
11839
|
/**
|
|
13021
11840
|
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
13022
11841
|
*/
|
|
@@ -13215,207 +12034,10 @@ declare type ToolResultOutput = {
|
|
|
13215
12034
|
}>;
|
|
13216
12035
|
};
|
|
13217
12036
|
|
|
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
12037
|
/**
|
|
13391
12038
|
* Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
13392
12039
|
*/
|
|
13393
12040
|
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
12041
|
type: 'tool-result';
|
|
13420
12042
|
/**
|
|
13421
12043
|
* ID of the tool call that this result is associated with.
|
|
@@ -14022,6 +12644,7 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
14022
12644
|
input: unknown;
|
|
14023
12645
|
providerExecuted?: boolean;
|
|
14024
12646
|
providerMetadata?: ProviderMetadata;
|
|
12647
|
+
toolMetadata?: JSONObject;
|
|
14025
12648
|
dynamic?: boolean;
|
|
14026
12649
|
title?: string;
|
|
14027
12650
|
} | {
|
|
@@ -14031,6 +12654,7 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
14031
12654
|
input: unknown;
|
|
14032
12655
|
providerExecuted?: boolean;
|
|
14033
12656
|
providerMetadata?: ProviderMetadata;
|
|
12657
|
+
toolMetadata?: JSONObject;
|
|
14034
12658
|
dynamic?: boolean;
|
|
14035
12659
|
errorText: string;
|
|
14036
12660
|
title?: string;
|
|
@@ -14043,6 +12667,8 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
14043
12667
|
toolCallId: string;
|
|
14044
12668
|
output: unknown;
|
|
14045
12669
|
providerExecuted?: boolean;
|
|
12670
|
+
providerMetadata?: ProviderMetadata;
|
|
12671
|
+
toolMetadata?: JSONObject;
|
|
14046
12672
|
dynamic?: boolean;
|
|
14047
12673
|
preliminary?: boolean;
|
|
14048
12674
|
} | {
|
|
@@ -14050,6 +12676,8 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
14050
12676
|
toolCallId: string;
|
|
14051
12677
|
errorText: string;
|
|
14052
12678
|
providerExecuted?: boolean;
|
|
12679
|
+
providerMetadata?: ProviderMetadata;
|
|
12680
|
+
toolMetadata?: JSONObject;
|
|
14053
12681
|
dynamic?: boolean;
|
|
14054
12682
|
} | {
|
|
14055
12683
|
type: 'tool-output-denied';
|
|
@@ -14060,6 +12688,7 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
14060
12688
|
toolName: string;
|
|
14061
12689
|
providerExecuted?: boolean;
|
|
14062
12690
|
providerMetadata?: ProviderMetadata;
|
|
12691
|
+
toolMetadata?: JSONObject;
|
|
14063
12692
|
dynamic?: boolean;
|
|
14064
12693
|
title?: string;
|
|
14065
12694
|
} | {
|
|
@@ -14104,7 +12733,7 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
14104
12733
|
messageMetadata: METADATA;
|
|
14105
12734
|
};
|
|
14106
12735
|
|
|
14107
|
-
export declare const uiMessageChunkSchema:
|
|
12736
|
+
export declare const uiMessageChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
14108
12737
|
type: "text-start";
|
|
14109
12738
|
id: string;
|
|
14110
12739
|
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
@@ -14126,6 +12755,7 @@ export declare const uiMessageChunkSchema: _ai_sdk_provider_utils_2.LazySchema<{
|
|
|
14126
12755
|
toolName: string;
|
|
14127
12756
|
providerExecuted?: boolean | undefined;
|
|
14128
12757
|
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12758
|
+
toolMetadata?: JSONObject | undefined;
|
|
14129
12759
|
dynamic?: boolean | undefined;
|
|
14130
12760
|
title?: string | undefined;
|
|
14131
12761
|
} | {
|
|
@@ -14139,6 +12769,7 @@ export declare const uiMessageChunkSchema: _ai_sdk_provider_utils_2.LazySchema<{
|
|
|
14139
12769
|
input: unknown;
|
|
14140
12770
|
providerExecuted?: boolean | undefined;
|
|
14141
12771
|
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12772
|
+
toolMetadata?: JSONObject | undefined;
|
|
14142
12773
|
dynamic?: boolean | undefined;
|
|
14143
12774
|
title?: string | undefined;
|
|
14144
12775
|
} | {
|
|
@@ -14149,6 +12780,7 @@ export declare const uiMessageChunkSchema: _ai_sdk_provider_utils_2.LazySchema<{
|
|
|
14149
12780
|
errorText: string;
|
|
14150
12781
|
providerExecuted?: boolean | undefined;
|
|
14151
12782
|
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12783
|
+
toolMetadata?: JSONObject | undefined;
|
|
14152
12784
|
dynamic?: boolean | undefined;
|
|
14153
12785
|
title?: string | undefined;
|
|
14154
12786
|
} | {
|
|
@@ -14160,6 +12792,8 @@ export declare const uiMessageChunkSchema: _ai_sdk_provider_utils_2.LazySchema<{
|
|
|
14160
12792
|
toolCallId: string;
|
|
14161
12793
|
output: unknown;
|
|
14162
12794
|
providerExecuted?: boolean | undefined;
|
|
12795
|
+
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12796
|
+
toolMetadata?: JSONObject | undefined;
|
|
14163
12797
|
dynamic?: boolean | undefined;
|
|
14164
12798
|
preliminary?: boolean | undefined;
|
|
14165
12799
|
} | {
|
|
@@ -14167,6 +12801,8 @@ export declare const uiMessageChunkSchema: _ai_sdk_provider_utils_2.LazySchema<{
|
|
|
14167
12801
|
toolCallId: string;
|
|
14168
12802
|
errorText: string;
|
|
14169
12803
|
providerExecuted?: boolean | undefined;
|
|
12804
|
+
providerMetadata?: _ai_sdk_provider.SharedV3ProviderMetadata | undefined;
|
|
12805
|
+
toolMetadata?: JSONObject | undefined;
|
|
14170
12806
|
dynamic?: boolean | undefined;
|
|
14171
12807
|
} | {
|
|
14172
12808
|
type: "tool-output-denied";
|
|
@@ -14405,6 +13041,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14405
13041
|
*/
|
|
14406
13042
|
toolCallId: string;
|
|
14407
13043
|
title?: string;
|
|
13044
|
+
toolMetadata?: JSONObject;
|
|
14408
13045
|
/**
|
|
14409
13046
|
* Whether the tool call was executed by the provider.
|
|
14410
13047
|
*/
|
|
@@ -14451,6 +13088,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14451
13088
|
output: asUITool<TOOL>['output'];
|
|
14452
13089
|
errorText?: never;
|
|
14453
13090
|
callProviderMetadata?: ProviderMetadata;
|
|
13091
|
+
resultProviderMetadata?: ProviderMetadata;
|
|
14454
13092
|
preliminary?: boolean;
|
|
14455
13093
|
approval?: {
|
|
14456
13094
|
id: string;
|
|
@@ -14464,6 +13102,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14464
13102
|
output?: never;
|
|
14465
13103
|
errorText: string;
|
|
14466
13104
|
callProviderMetadata?: ProviderMetadata;
|
|
13105
|
+
resultProviderMetadata?: ProviderMetadata;
|
|
14467
13106
|
approval?: {
|
|
14468
13107
|
id: string;
|
|
14469
13108
|
approved: true;
|
|
@@ -14485,7 +13124,7 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14485
13124
|
export declare type UITools = Record<string, UITool>;
|
|
14486
13125
|
|
|
14487
13126
|
export declare class UnsupportedFunctionalityError extends AISDKError {
|
|
14488
|
-
private readonly [
|
|
13127
|
+
private readonly [symbol];
|
|
14489
13128
|
readonly functionality: string;
|
|
14490
13129
|
constructor({ functionality, message, }: {
|
|
14491
13130
|
functionality: string;
|
|
@@ -14567,7 +13206,7 @@ export declare type UseCompletionOptions = {
|
|
|
14567
13206
|
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
14568
13207
|
* or to provide a custom fetch implementation for e.g. testing.
|
|
14569
13208
|
*/
|
|
14570
|
-
fetch?:
|
|
13209
|
+
fetch?: FetchFunction;
|
|
14571
13210
|
};
|
|
14572
13211
|
|
|
14573
13212
|
/**
|
|
@@ -14575,31 +13214,12 @@ export declare type UseCompletionOptions = {
|
|
|
14575
13214
|
*/
|
|
14576
13215
|
export declare type UserContent = string | Array<TextPart | ImagePart | FilePart>;
|
|
14577
13216
|
|
|
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
13217
|
/**
|
|
14584
13218
|
* A user message. It can contain text or a combination of text and images.
|
|
14585
13219
|
*/
|
|
14586
13220
|
export declare type UserModelMessage = {
|
|
14587
13221
|
role: 'user';
|
|
14588
13222
|
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
13223
|
/**
|
|
14604
13224
|
* Additional provider-specific metadata. They are passed through
|
|
14605
13225
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -14619,15 +13239,6 @@ export declare const userModelMessageSchema: z.ZodType<UserModelMessage>;
|
|
|
14619
13239
|
*/
|
|
14620
13240
|
declare function validateDownloadUrl(url: string): void;
|
|
14621
13241
|
|
|
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
13242
|
/**
|
|
14632
13243
|
* Validates the types of an unknown object using a schema and
|
|
14633
13244
|
* return a strongly-typed object.
|
|
@@ -14639,22 +13250,6 @@ declare function validateDownloadUrl_2(url: string): void;
|
|
|
14639
13250
|
* @returns {Promise<T>} - The typed object.
|
|
14640
13251
|
*/
|
|
14641
13252
|
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
13253
|
value: unknown;
|
|
14659
13254
|
schema: FlexibleSchema<OBJECT>;
|
|
14660
13255
|
context?: TypeValidationContext;
|
|
@@ -14686,14 +13281,6 @@ declare type ValidationResult<OBJECT> = {
|
|
|
14686
13281
|
error: Error;
|
|
14687
13282
|
};
|
|
14688
13283
|
|
|
14689
|
-
declare type ValidationResult_2<OBJECT> = {
|
|
14690
|
-
success: true;
|
|
14691
|
-
value: OBJECT;
|
|
14692
|
-
} | {
|
|
14693
|
-
success: false;
|
|
14694
|
-
error: Error;
|
|
14695
|
-
};
|
|
14696
|
-
|
|
14697
13284
|
/**
|
|
14698
13285
|
* Create a union of the given object's values, and optionally specify which keys to get the values from.
|
|
14699
13286
|
*
|
|
@@ -14738,8 +13325,6 @@ declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof Obje
|
|
|
14738
13325
|
|
|
14739
13326
|
declare const VERSION: string;
|
|
14740
13327
|
|
|
14741
|
-
declare const VERSION_2: string;
|
|
14742
|
-
|
|
14743
13328
|
/**
|
|
14744
13329
|
* A video model can be a string (model ID) or a Experimental_VideoModelV3 object.
|
|
14745
13330
|
*/
|
|
@@ -14993,8 +13578,6 @@ export declare type Warning = SharedV3Warning;
|
|
|
14993
13578
|
|
|
14994
13579
|
declare function withoutTrailingSlash(url: string | undefined): string | undefined;
|
|
14995
13580
|
|
|
14996
|
-
declare function withoutTrailingSlash_2(url: string | undefined): string | undefined;
|
|
14997
|
-
|
|
14998
13581
|
/**
|
|
14999
13582
|
* Appends suffix parts to the `user-agent` header.
|
|
15000
13583
|
* If a `user-agent` header already exists, the suffix parts are appended to it.
|
|
@@ -15007,18 +13590,6 @@ declare function withoutTrailingSlash_2(url: string | undefined): string | undef
|
|
|
15007
13590
|
*/
|
|
15008
13591
|
declare function withUserAgentSuffix(headers: HeadersInit | Record<string, string | undefined> | undefined, ...userAgentSuffixParts: string[]): Record<string, string>;
|
|
15009
13592
|
|
|
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
13593
|
/**
|
|
15023
13594
|
* Wraps an EmbeddingModelV3 instance with middleware functionality.
|
|
15024
13595
|
* This function allows you to apply middleware to transform parameters,
|
|
@@ -15106,20 +13677,6 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
|
|
|
15106
13677
|
useReferences?: boolean;
|
|
15107
13678
|
}): Schema<OBJECT>;
|
|
15108
13679
|
|
|
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
13680
|
export { }
|
|
15122
|
-
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider,
|
|
15123
|
-
export { schemaSymbol,
|
|
15124
|
-
|
|
15125
|
-
export type ProviderOptions = NonNullable<EmbeddingModelV3CallOptions['providerOptions']>;
|
|
13681
|
+
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, 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, SharedV3ProviderMetadata as SharedV3ProviderMetadata, 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 };
|
|
13682
|
+
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 };
|