@mastra/ai-sdk 1.11.1 → 1.11.2
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/dist/_types/@ai-sdk_provider/dist/index.d.ts +12 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +206 -873
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +851 -1176
- package/dist/_types/@internal_ai-v7/dist/index.d.ts +1567 -3724
- package/dist/index.cjs +3904 -7477
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3751 -7324
- package/dist/index.js.map +1 -1
- package/dist/transformers.d.ts +2 -0
- package/dist/transformers.d.ts.map +1 -1
- package/package.json +17 -18
|
@@ -17,8 +17,13 @@ export declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
17
17
|
private onFinish?;
|
|
18
18
|
private onData?;
|
|
19
19
|
private sendAutomaticallyWhen?;
|
|
20
|
+
private pendingApprovalMessageId;
|
|
20
21
|
private activeResponse;
|
|
22
|
+
private activeResumeRequest;
|
|
23
|
+
private resumableStreamState;
|
|
21
24
|
private jobExecutor;
|
|
25
|
+
private activeStopCount;
|
|
26
|
+
private stopGeneration;
|
|
22
27
|
constructor({ generateId, id, transport, messageMetadataSchema, dataPartSchemas, state, onError, onToolCall, onFinish, onData, sendAutomaticallyWhen, }: Omit<ChatInit<UI_MESSAGE>, 'messages'> & {
|
|
23
28
|
state: ChatState<UI_MESSAGE>;
|
|
24
29
|
});
|
|
@@ -81,11 +86,15 @@ export declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
81
86
|
/** @deprecated Use addToolOutput */
|
|
82
87
|
addToolResult: ChatAddToolOutputFunction<UI_MESSAGE>;
|
|
83
88
|
/**
|
|
84
|
-
* Abort the current request
|
|
89
|
+
* Abort the current request, keep the generated tokens if any, and wait for
|
|
90
|
+
* the request pipeline to finish.
|
|
85
91
|
*/
|
|
86
92
|
stop: () => Promise<void>;
|
|
87
93
|
private shouldSendAutomatically;
|
|
94
|
+
private runAutomaticRequest;
|
|
95
|
+
private makeRequestForToolApproval;
|
|
88
96
|
private makeRequest;
|
|
97
|
+
private makeRequestImpl;
|
|
89
98
|
}
|
|
90
99
|
|
|
91
100
|
/**
|
|
@@ -138,7 +147,7 @@ export declare function addToolInputExamplesMiddleware({ prefix, format, remove,
|
|
|
138
147
|
* You can implement your own Agent by implementing the `Agent` interface,
|
|
139
148
|
* or use the `ToolLoopAgent` class.
|
|
140
149
|
*/
|
|
141
|
-
export declare interface Agent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends
|
|
150
|
+
export declare interface Agent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends OutputInterface = never> {
|
|
142
151
|
/**
|
|
143
152
|
* The specification version of the agent interface. This will enable
|
|
144
153
|
* us to evolve the agent interface and retain backwards compatibility.
|
|
@@ -308,6 +317,7 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
308
317
|
dynamicTool,
|
|
309
318
|
executeTool,
|
|
310
319
|
extractResponseHeaders,
|
|
320
|
+
fetchWithValidatedEndpoint,
|
|
311
321
|
fetchWithValidatedRedirects,
|
|
312
322
|
generateId,
|
|
313
323
|
getErrorMessage,
|
|
@@ -385,38 +395,6 @@ export declare class AISDKError extends Error {
|
|
|
385
395
|
protected static hasMarker(error: unknown, marker: string): boolean;
|
|
386
396
|
}
|
|
387
397
|
|
|
388
|
-
/**
|
|
389
|
-
* Custom error class for AI SDK related errors.
|
|
390
|
-
* @extends Error
|
|
391
|
-
*/
|
|
392
|
-
declare class AISDKError_2 extends Error {
|
|
393
|
-
private readonly [symbol$d_2];
|
|
394
|
-
/**
|
|
395
|
-
* The underlying cause of the error, if any.
|
|
396
|
-
*/
|
|
397
|
-
readonly cause?: unknown;
|
|
398
|
-
/**
|
|
399
|
-
* Creates an AI SDK Error.
|
|
400
|
-
*
|
|
401
|
-
* @param {Object} params - The parameters for creating the error.
|
|
402
|
-
* @param {string} params.name - The name of the error.
|
|
403
|
-
* @param {string} params.message - The error message.
|
|
404
|
-
* @param {unknown} [params.cause] - The underlying cause of the error.
|
|
405
|
-
*/
|
|
406
|
-
constructor({ name, message, cause, }: {
|
|
407
|
-
name: string;
|
|
408
|
-
message: string;
|
|
409
|
-
cause?: unknown;
|
|
410
|
-
});
|
|
411
|
-
/**
|
|
412
|
-
* Checks if the given error is an AI SDK Error.
|
|
413
|
-
* @param {unknown} error - The error to check.
|
|
414
|
-
* @returns {boolean} True if the error is an AI SDK Error, false otherwise.
|
|
415
|
-
*/
|
|
416
|
-
static isInstance(error: unknown): error is AISDKError_2;
|
|
417
|
-
protected static hasMarker(error: unknown, marker: string): boolean;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
398
|
export declare class APICallError extends AISDKError {
|
|
421
399
|
private readonly [symbol$c];
|
|
422
400
|
readonly url: string;
|
|
@@ -441,30 +419,6 @@ export declare class APICallError extends AISDKError {
|
|
|
441
419
|
static isInstance(error: unknown): error is APICallError;
|
|
442
420
|
}
|
|
443
421
|
|
|
444
|
-
declare class APICallError_2 extends AISDKError_2 {
|
|
445
|
-
private readonly [symbol$c_2];
|
|
446
|
-
readonly url: string;
|
|
447
|
-
readonly requestBodyValues: unknown;
|
|
448
|
-
readonly statusCode?: number;
|
|
449
|
-
readonly responseHeaders?: Record<string, string>;
|
|
450
|
-
readonly responseBody?: string;
|
|
451
|
-
readonly isRetryable: boolean;
|
|
452
|
-
readonly data?: unknown;
|
|
453
|
-
constructor({ message, url, requestBodyValues, statusCode, responseHeaders, responseBody, cause, isRetryable, // server error
|
|
454
|
-
data, }: {
|
|
455
|
-
message: string;
|
|
456
|
-
url: string;
|
|
457
|
-
requestBodyValues: unknown;
|
|
458
|
-
statusCode?: number;
|
|
459
|
-
responseHeaders?: Record<string, string>;
|
|
460
|
-
responseBody?: string;
|
|
461
|
-
cause?: unknown;
|
|
462
|
-
isRetryable?: boolean;
|
|
463
|
-
data?: unknown;
|
|
464
|
-
});
|
|
465
|
-
static isInstance(error: unknown): error is APICallError_2;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
422
|
export declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
|
|
469
423
|
|
|
470
424
|
/**
|
|
@@ -532,6 +486,124 @@ declare type BaseToolCall = {
|
|
|
532
486
|
*/
|
|
533
487
|
export declare function bindTelemetryIntegration(integration: TelemetryIntegration): TelemetryIntegration;
|
|
534
488
|
|
|
489
|
+
declare interface BrowserbaseFetchConfig {
|
|
490
|
+
/** Whether to follow HTTP redirects (default: false). */
|
|
491
|
+
allowRedirects?: boolean;
|
|
492
|
+
/** Whether to bypass TLS certificate verification (default: false). */
|
|
493
|
+
allowInsecureSsl?: boolean;
|
|
494
|
+
/** Whether to route the request through Browserbase proxies (default: false). */
|
|
495
|
+
proxies?: boolean;
|
|
496
|
+
/** Output format for the response content (default: raw). */
|
|
497
|
+
format?: BrowserbaseFetchFormat;
|
|
498
|
+
/**
|
|
499
|
+
* JSON Schema describing the desired response content. Only used when format
|
|
500
|
+
* is json.
|
|
501
|
+
*/
|
|
502
|
+
schema?: Record<string, unknown>;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
declare interface BrowserbaseFetchError {
|
|
506
|
+
error: 'api_error' | 'configuration_error' | 'execution_error' | 'invalid_input' | 'rate_limit' | 'timeout' | 'unknown';
|
|
507
|
+
statusCode?: number;
|
|
508
|
+
message: string;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
declare type BrowserbaseFetchFormat = 'raw' | 'json' | 'markdown';
|
|
512
|
+
|
|
513
|
+
declare interface BrowserbaseFetchInput {
|
|
514
|
+
/** URL of the page to fetch. */
|
|
515
|
+
url: string;
|
|
516
|
+
/** Whether to follow HTTP redirects. */
|
|
517
|
+
allow_redirects?: boolean;
|
|
518
|
+
/** Whether to bypass TLS certificate verification. */
|
|
519
|
+
allow_insecure_ssl?: boolean;
|
|
520
|
+
/** Whether to route the request through Browserbase proxies. */
|
|
521
|
+
proxies?: boolean;
|
|
522
|
+
/** Output format for the response content. */
|
|
523
|
+
format?: BrowserbaseFetchFormat;
|
|
524
|
+
/**
|
|
525
|
+
* JSON Schema describing the desired response content. Only used when format
|
|
526
|
+
* is json.
|
|
527
|
+
*/
|
|
528
|
+
schema?: Record<string, unknown>;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
declare type BrowserbaseFetchOutput = BrowserbaseFetchError | BrowserbaseFetchResponse;
|
|
532
|
+
|
|
533
|
+
declare interface BrowserbaseFetchResponse {
|
|
534
|
+
/** Unique identifier for the fetch request. */
|
|
535
|
+
id: string;
|
|
536
|
+
/**
|
|
537
|
+
* Response body. Raw and markdown responses return strings; JSON extraction
|
|
538
|
+
* returns an object matching the requested schema.
|
|
539
|
+
*/
|
|
540
|
+
content: string | Record<string, unknown>;
|
|
541
|
+
/** MIME type of the response. */
|
|
542
|
+
contentType: string;
|
|
543
|
+
/** Character encoding of the response. */
|
|
544
|
+
encoding: string;
|
|
545
|
+
/** Response headers from the fetched page. */
|
|
546
|
+
headers: Record<string, string>;
|
|
547
|
+
/** HTTP status code returned by the fetched page. */
|
|
548
|
+
statusCode: number;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
declare const browserbaseFetchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<BrowserbaseFetchInput, BrowserbaseFetchOutput, BrowserbaseFetchConfig>;
|
|
552
|
+
|
|
553
|
+
declare interface BrowserbaseSearchConfig {
|
|
554
|
+
/**
|
|
555
|
+
* Default maximum number of results to return (1-25, default: 10).
|
|
556
|
+
*/
|
|
557
|
+
numResults?: number;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
declare interface BrowserbaseSearchError {
|
|
561
|
+
error: 'api_error' | 'configuration_error' | 'execution_error' | 'invalid_input' | 'rate_limit' | 'timeout' | 'unknown';
|
|
562
|
+
statusCode?: number;
|
|
563
|
+
message: string;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
declare interface BrowserbaseSearchInput {
|
|
567
|
+
/**
|
|
568
|
+
* Web search query (1-200 characters).
|
|
569
|
+
*/
|
|
570
|
+
query: string;
|
|
571
|
+
/**
|
|
572
|
+
* Maximum number of results to return (1-25, default: 10).
|
|
573
|
+
*/
|
|
574
|
+
num_results?: number;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
declare type BrowserbaseSearchOutput = BrowserbaseSearchError | BrowserbaseSearchResponse;
|
|
578
|
+
|
|
579
|
+
declare interface BrowserbaseSearchResponse {
|
|
580
|
+
/** The search query that was executed. */
|
|
581
|
+
query: string;
|
|
582
|
+
/** Unique identifier for the request. */
|
|
583
|
+
requestId: string;
|
|
584
|
+
/** Search results. */
|
|
585
|
+
results: BrowserbaseSearchResult[];
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
declare interface BrowserbaseSearchResult {
|
|
589
|
+
/** Unique identifier for the result. */
|
|
590
|
+
id: string;
|
|
591
|
+
/** Title of the search result. */
|
|
592
|
+
title: string;
|
|
593
|
+
/** URL of the search result. */
|
|
594
|
+
url: string;
|
|
595
|
+
/** Author of the content, when available. */
|
|
596
|
+
author?: string;
|
|
597
|
+
/** Favicon URL, when available. */
|
|
598
|
+
favicon?: string;
|
|
599
|
+
/** Image URL, when available. */
|
|
600
|
+
image?: string;
|
|
601
|
+
/** Publication date in ISO 8601 format, when available. */
|
|
602
|
+
publishedDate?: string;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
declare const browserbaseSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<BrowserbaseSearchInput, BrowserbaseSearchOutput, BrowserbaseSearchConfig>;
|
|
606
|
+
|
|
535
607
|
/**
|
|
536
608
|
* Common model information used across callback events.
|
|
537
609
|
*/
|
|
@@ -810,6 +882,12 @@ export declare type ChatStatus = 'submitted' | 'streaming' | 'ready' | 'error';
|
|
|
810
882
|
* @template UI_MESSAGE - The UI message type extending UIMessage
|
|
811
883
|
*/
|
|
812
884
|
export declare interface ChatTransport<UI_MESSAGE extends UIMessage> {
|
|
885
|
+
/**
|
|
886
|
+
* Whether reconnecting returns the complete response from its beginning.
|
|
887
|
+
* Complete replays must reset the streaming message state before processing
|
|
888
|
+
* the first start chunk.
|
|
889
|
+
*/
|
|
890
|
+
readonly resumeStreamIsReplay?: boolean;
|
|
813
891
|
/**
|
|
814
892
|
* Sends messages to the chat API endpoint and returns a streaming response.
|
|
815
893
|
*
|
|
@@ -858,6 +936,7 @@ export declare interface ChatTransport<UI_MESSAGE extends UIMessage> {
|
|
|
858
936
|
*
|
|
859
937
|
* @param options - Configuration object containing:
|
|
860
938
|
* @param options.chatId - Unique identifier for the chat session to reconnect to
|
|
939
|
+
* @param options.abortSignal - Signal to abort the reconnection request if needed
|
|
861
940
|
* @param options.headers - Additional HTTP headers to include in the reconnection request
|
|
862
941
|
* @param options.body - Additional JSON properties to include in the request body
|
|
863
942
|
* @param options.metadata - Custom metadata to attach to the request
|
|
@@ -871,6 +950,8 @@ export declare interface ChatTransport<UI_MESSAGE extends UIMessage> {
|
|
|
871
950
|
reconnectToStream: (options: {
|
|
872
951
|
/** Unique identifier for the chat session to reconnect to */
|
|
873
952
|
chatId: string;
|
|
953
|
+
/** Signal to abort the reconnection request if needed */
|
|
954
|
+
abortSignal?: AbortSignal;
|
|
874
955
|
} & ChatRequestOptions) => Promise<ReadableStream<UIMessageChunk> | null>;
|
|
875
956
|
}
|
|
876
957
|
|
|
@@ -908,9 +989,10 @@ export declare type CompletionRequestOptions = {
|
|
|
908
989
|
* @param options.onError - Optional callback to handle errors that occur during consumption.
|
|
909
990
|
* @returns A promise that resolves when the stream is fully consumed.
|
|
910
991
|
*/
|
|
911
|
-
export declare function consumeStream({ stream, onError, }: {
|
|
992
|
+
export declare function consumeStream({ stream, onError, abortSignal, }: {
|
|
912
993
|
stream: ReadableStream;
|
|
913
994
|
onError?: (error: unknown) => void;
|
|
995
|
+
abortSignal?: AbortSignal;
|
|
914
996
|
}): Promise<void>;
|
|
915
997
|
|
|
916
998
|
declare type ConsumeStreamOptions = {
|
|
@@ -988,7 +1070,7 @@ export declare function convertFileListToFileUIParts(files: FileList | undefined
|
|
|
988
1070
|
* If the file is base64 data, it returns a data URI with the base64 data.
|
|
989
1071
|
* If the file is a Uint8Array, it converts it to base64 and returns a data URI.
|
|
990
1072
|
*/
|
|
991
|
-
declare function convertImageModelFileToDataUri(file:
|
|
1073
|
+
declare function convertImageModelFileToDataUri(file: ImageModelV3File): string;
|
|
992
1074
|
|
|
993
1075
|
declare function convertToBase64(value: string | Uint8Array): string;
|
|
994
1076
|
|
|
@@ -1063,7 +1145,7 @@ export declare function cosineSimilarity(vector1: number[], vector2: number[]):
|
|
|
1063
1145
|
* Runs the agent and stream the output as a UI message stream.
|
|
1064
1146
|
*
|
|
1065
1147
|
* @param agent - The agent to run.
|
|
1066
|
-
* @param uiMessages - The input UI messages.
|
|
1148
|
+
* @param uiMessages - The input UI messages. Defaults to originalMessages.
|
|
1067
1149
|
* @param abortSignal - The abort signal. Optional.
|
|
1068
1150
|
* @param timeout - Timeout in milliseconds. Optional.
|
|
1069
1151
|
* @param options - The options for the agent.
|
|
@@ -1072,9 +1154,9 @@ export declare function cosineSimilarity(vector1: number[], vector2: number[]):
|
|
|
1072
1154
|
*
|
|
1073
1155
|
* @returns The UI message stream.
|
|
1074
1156
|
*/
|
|
1075
|
-
export declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends
|
|
1157
|
+
export declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends OutputInterface = never, MESSAGE_METADATA = unknown>({ agent, uiMessages, options, abortSignal, timeout, experimental_transform, onStepFinish, ...uiMessageStreamOptions }: {
|
|
1076
1158
|
agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
|
|
1077
|
-
uiMessages
|
|
1159
|
+
uiMessages?: unknown[];
|
|
1078
1160
|
abortSignal?: AbortSignal;
|
|
1079
1161
|
timeout?: TimeoutConfiguration;
|
|
1080
1162
|
options?: CALL_OPTIONS;
|
|
@@ -1086,7 +1168,7 @@ export declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends
|
|
|
1086
1168
|
* Runs the agent and returns a response object with a UI message stream.
|
|
1087
1169
|
*
|
|
1088
1170
|
* @param agent - The agent to run.
|
|
1089
|
-
* @param uiMessages - The input UI messages.
|
|
1171
|
+
* @param uiMessages - The input UI messages. Defaults to originalMessages.
|
|
1090
1172
|
* @param abortSignal - Abort signal. Optional.
|
|
1091
1173
|
* @param timeout - Timeout in milliseconds. Optional.
|
|
1092
1174
|
* @param options - The options for the agent. Optional.
|
|
@@ -1095,13 +1177,14 @@ export declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends
|
|
|
1095
1177
|
* @param headers - Additional headers for the response. Optional.
|
|
1096
1178
|
* @param status - The status code for the response. Optional.
|
|
1097
1179
|
* @param statusText - The status text for the response. Optional.
|
|
1180
|
+
* @param keepAliveMs - Optional interval for sending SSE keep-alive comments.
|
|
1098
1181
|
* @param consumeSseStream - Whether to consume the SSE stream. Optional.
|
|
1099
1182
|
*
|
|
1100
1183
|
* @returns The response object.
|
|
1101
1184
|
*/
|
|
1102
|
-
export declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends
|
|
1185
|
+
export declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends OutputInterface = never, MESSAGE_METADATA = unknown>({ headers, status, statusText, keepAliveMs, consumeSseStream, ...options }: {
|
|
1103
1186
|
agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
|
|
1104
|
-
uiMessages
|
|
1187
|
+
uiMessages?: unknown[];
|
|
1105
1188
|
abortSignal?: AbortSignal;
|
|
1106
1189
|
timeout?: TimeoutConfiguration;
|
|
1107
1190
|
options?: CALL_OPTIONS;
|
|
@@ -1156,7 +1239,7 @@ declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage,
|
|
|
1156
1239
|
errorSchema: FlexibleSchema<T>;
|
|
1157
1240
|
errorToMessage: (error: T) => string;
|
|
1158
1241
|
isRetryable?: (response: Response, error?: T) => boolean;
|
|
1159
|
-
}) => ResponseHandler<
|
|
1242
|
+
}) => ResponseHandler<APICallError>;
|
|
1160
1243
|
|
|
1161
1244
|
declare const createJsonResponseHandler: <T>(responseSchema: FlexibleSchema<T>) => ResponseHandler<T>;
|
|
1162
1245
|
|
|
@@ -1201,7 +1284,7 @@ declare function createProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS e
|
|
|
1201
1284
|
supportsDeferredResults?: boolean;
|
|
1202
1285
|
}): ProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS>;
|
|
1203
1286
|
|
|
1204
|
-
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<
|
|
1287
|
+
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
|
|
1205
1288
|
|
|
1206
1289
|
/**
|
|
1207
1290
|
* Creates a Response object from a text stream.
|
|
@@ -1227,7 +1310,7 @@ declare function createToolNameMapping({ tools, providerToolNames, resolveProvid
|
|
|
1227
1310
|
/**
|
|
1228
1311
|
* Tools that were passed to the language model.
|
|
1229
1312
|
*/
|
|
1230
|
-
tools: Array<
|
|
1313
|
+
tools: Array<LanguageModelV3FunctionTool | LanguageModelV3ProviderTool> | undefined;
|
|
1231
1314
|
/**
|
|
1232
1315
|
* Maps the provider tool ids to the provider tool names.
|
|
1233
1316
|
*/
|
|
@@ -1236,7 +1319,7 @@ declare function createToolNameMapping({ tools, providerToolNames, resolveProvid
|
|
|
1236
1319
|
* Optional resolver for provider tool names that cannot be represented as
|
|
1237
1320
|
* static id -> name mappings (e.g. dynamic provider names).
|
|
1238
1321
|
*/
|
|
1239
|
-
resolveProviderToolName?: (tool:
|
|
1322
|
+
resolveProviderToolName?: (tool: LanguageModelV3ProviderTool) => string | undefined;
|
|
1240
1323
|
}): ToolNameMapping;
|
|
1241
1324
|
|
|
1242
1325
|
export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESSAGE, 'id' | 'role'> & {
|
|
@@ -1260,7 +1343,7 @@ export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESS
|
|
|
1260
1343
|
export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ execute, onError, // prevent leaking server error details to the client by default
|
|
1261
1344
|
originalMessages, onStepFinish, onFinish, generateId, }: {
|
|
1262
1345
|
execute: (options: {
|
|
1263
|
-
writer:
|
|
1346
|
+
writer: UIMessageStreamWriterWithOutcome<UI_MESSAGE>;
|
|
1264
1347
|
}) => Promise<void> | void;
|
|
1265
1348
|
onError?: (error: unknown) => string;
|
|
1266
1349
|
/**
|
|
@@ -1284,11 +1367,12 @@ export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ ex
|
|
|
1284
1367
|
* @param options.statusText - The HTTP status text for the response.
|
|
1285
1368
|
* @param options.headers - Additional HTTP headers to include in the response.
|
|
1286
1369
|
* @param options.stream - The UI message chunk stream to send.
|
|
1370
|
+
* @param options.keepAliveMs - Optional interval for sending SSE keep-alive comments.
|
|
1287
1371
|
* @param options.consumeSseStream - Optional callback to consume a copy of the SSE stream independently.
|
|
1288
1372
|
*
|
|
1289
1373
|
* @returns A `Response` object with the UI message stream as the body.
|
|
1290
1374
|
*/
|
|
1291
|
-
export declare function createUIMessageStreamResponse({ status, statusText, headers, stream, consumeSseStream, }: UIMessageStreamResponseInit & {
|
|
1375
|
+
export declare function createUIMessageStreamResponse({ status, statusText, headers, stream, keepAliveMs, consumeSseStream, }: UIMessageStreamResponseInit & {
|
|
1292
1376
|
stream: ReadableStream<UIMessageChunk>;
|
|
1293
1377
|
}): Response;
|
|
1294
1378
|
|
|
@@ -1373,7 +1457,15 @@ declare type DeepPartialInternal<T> = T extends null | undefined | string | numb
|
|
|
1373
1457
|
declare const DEFAULT_MAX_DOWNLOAD_SIZE: number;
|
|
1374
1458
|
|
|
1375
1459
|
export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends HttpChatTransport<UI_MESSAGE> {
|
|
1376
|
-
|
|
1460
|
+
readonly resumeStreamIsReplay: boolean;
|
|
1461
|
+
constructor({ resumeStreamIsReplay, ...options }?: HttpChatTransportInitOptions<UI_MESSAGE> & {
|
|
1462
|
+
/**
|
|
1463
|
+
* Whether resumed streams replay the response from the beginning.
|
|
1464
|
+
* Defaults to true. Set to false for endpoints that only continue the
|
|
1465
|
+
* interrupted response, even when they emit a start chunk.
|
|
1466
|
+
*/
|
|
1467
|
+
resumeStreamIsReplay?: boolean;
|
|
1468
|
+
});
|
|
1377
1469
|
protected processResponseStream(stream: ReadableStream<Uint8Array<ArrayBufferLike>>): ReadableStream<UIMessageChunk>;
|
|
1378
1470
|
}
|
|
1379
1471
|
|
|
@@ -1467,7 +1559,7 @@ declare class DelayedPromise<T> {
|
|
|
1467
1559
|
* });
|
|
1468
1560
|
* ```
|
|
1469
1561
|
*/
|
|
1470
|
-
export declare class DirectChatTransport<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends
|
|
1562
|
+
export declare class DirectChatTransport<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends OutputInterface = never, UI_MESSAGE extends UIMessage<unknown, never, InferUITools<TOOLS>> = UIMessage<unknown, never, InferUITools<TOOLS>>> implements ChatTransport<UI_MESSAGE> {
|
|
1471
1563
|
private readonly agent;
|
|
1472
1564
|
private readonly agentOptions;
|
|
1473
1565
|
private readonly uiMessageStreamOptions;
|
|
@@ -1485,7 +1577,7 @@ export declare class DirectChatTransport<CALL_OPTIONS = never, TOOLS extends Too
|
|
|
1485
1577
|
/**
|
|
1486
1578
|
* Options for the `DirectChatTransport` class.
|
|
1487
1579
|
*/
|
|
1488
|
-
export declare type DirectChatTransportOptions<CALL_OPTIONS, TOOLS extends ToolSet, OUTPUT extends
|
|
1580
|
+
export declare type DirectChatTransportOptions<CALL_OPTIONS, TOOLS extends ToolSet, OUTPUT extends OutputInterface, UI_MESSAGE extends UIMessage<unknown, never, InferUITools<TOOLS>>> = {
|
|
1489
1581
|
/**
|
|
1490
1582
|
* The agent to use for generating responses.
|
|
1491
1583
|
*/
|
|
@@ -1512,7 +1604,7 @@ declare function downloadBlob(url: string, options?: {
|
|
|
1512
1604
|
abortSignal?: AbortSignal;
|
|
1513
1605
|
}): Promise<Blob>;
|
|
1514
1606
|
|
|
1515
|
-
export declare class DownloadError extends
|
|
1607
|
+
export declare class DownloadError extends AISDKError {
|
|
1516
1608
|
private readonly [symbol_2];
|
|
1517
1609
|
readonly url: string;
|
|
1518
1610
|
readonly statusCode?: number;
|
|
@@ -1534,7 +1626,7 @@ export declare function dynamicTool(tool: {
|
|
|
1534
1626
|
description?: string;
|
|
1535
1627
|
title?: string;
|
|
1536
1628
|
providerOptions?: ProviderOptions;
|
|
1537
|
-
metadata?:
|
|
1629
|
+
metadata?: JSONObject;
|
|
1538
1630
|
inputSchema: FlexibleSchema<unknown>;
|
|
1539
1631
|
execute: ToolExecuteFunction<unknown, unknown>;
|
|
1540
1632
|
/**
|
|
@@ -1609,6 +1701,13 @@ export declare type DynamicToolResult = {
|
|
|
1609
1701
|
|
|
1610
1702
|
export declare type DynamicToolUIPart = {
|
|
1611
1703
|
type: 'dynamic-tool';
|
|
1704
|
+
/**
|
|
1705
|
+
* `false` when a static tool part was normalized to a dynamic tool part
|
|
1706
|
+
* because its current tool schema was unavailable or incompatible.
|
|
1707
|
+
*
|
|
1708
|
+
* This preserves its static origin across persistence boundaries.
|
|
1709
|
+
*/
|
|
1710
|
+
dynamic?: false;
|
|
1612
1711
|
/**
|
|
1613
1712
|
* Name of the tool that is being called.
|
|
1614
1713
|
*/
|
|
@@ -1626,6 +1725,15 @@ export declare type DynamicToolUIPart = {
|
|
|
1626
1725
|
} & ({
|
|
1627
1726
|
state: 'input-streaming';
|
|
1628
1727
|
input?: unknown;
|
|
1728
|
+
/**
|
|
1729
|
+
* The raw tool input text received so far.
|
|
1730
|
+
*
|
|
1731
|
+
* This is used to continue input streaming when a message is persisted
|
|
1732
|
+
* and later resumed.
|
|
1733
|
+
*/
|
|
1734
|
+
rawInput?: string;
|
|
1735
|
+
/** Encoding of `rawInput`. Defaults to JSON when omitted. */
|
|
1736
|
+
inputEncoding?: 'json' | 'text';
|
|
1629
1737
|
output?: never;
|
|
1630
1738
|
errorText?: never;
|
|
1631
1739
|
callProviderMetadata?: ProviderMetadata;
|
|
@@ -1646,8 +1754,10 @@ export declare type DynamicToolUIPart = {
|
|
|
1646
1754
|
approval: {
|
|
1647
1755
|
id: string;
|
|
1648
1756
|
approved?: never;
|
|
1757
|
+
descriptor?: unknown;
|
|
1649
1758
|
reason?: never;
|
|
1650
1759
|
signature?: string;
|
|
1760
|
+
inputSchemaInput?: unknown;
|
|
1651
1761
|
};
|
|
1652
1762
|
} | {
|
|
1653
1763
|
state: 'approval-responded';
|
|
@@ -1658,8 +1768,10 @@ export declare type DynamicToolUIPart = {
|
|
|
1658
1768
|
approval: {
|
|
1659
1769
|
id: string;
|
|
1660
1770
|
approved: boolean;
|
|
1771
|
+
descriptor?: unknown;
|
|
1661
1772
|
reason?: string;
|
|
1662
1773
|
signature?: string;
|
|
1774
|
+
inputSchemaInput?: unknown;
|
|
1663
1775
|
};
|
|
1664
1776
|
} | {
|
|
1665
1777
|
state: 'output-available';
|
|
@@ -1672,8 +1784,10 @@ export declare type DynamicToolUIPart = {
|
|
|
1672
1784
|
approval?: {
|
|
1673
1785
|
id: string;
|
|
1674
1786
|
approved: true;
|
|
1787
|
+
descriptor?: unknown;
|
|
1675
1788
|
reason?: string;
|
|
1676
1789
|
signature?: string;
|
|
1790
|
+
inputSchemaInput?: unknown;
|
|
1677
1791
|
};
|
|
1678
1792
|
} | {
|
|
1679
1793
|
state: 'output-error';
|
|
@@ -1685,8 +1799,10 @@ export declare type DynamicToolUIPart = {
|
|
|
1685
1799
|
approval?: {
|
|
1686
1800
|
id: string;
|
|
1687
1801
|
approved: true;
|
|
1802
|
+
descriptor?: unknown;
|
|
1688
1803
|
reason?: string;
|
|
1689
1804
|
signature?: string;
|
|
1805
|
+
inputSchemaInput?: unknown;
|
|
1690
1806
|
};
|
|
1691
1807
|
} | {
|
|
1692
1808
|
state: 'output-denied';
|
|
@@ -1697,8 +1813,10 @@ export declare type DynamicToolUIPart = {
|
|
|
1697
1813
|
approval: {
|
|
1698
1814
|
id: string;
|
|
1699
1815
|
approved: false;
|
|
1816
|
+
descriptor?: unknown;
|
|
1700
1817
|
reason?: string;
|
|
1701
1818
|
signature?: string;
|
|
1819
|
+
inputSchemaInput?: unknown;
|
|
1702
1820
|
};
|
|
1703
1821
|
});
|
|
1704
1822
|
|
|
@@ -1786,11 +1904,11 @@ export declare type EmbeddingModel = string | EmbeddingModelV3 | EmbeddingModelV
|
|
|
1786
1904
|
export declare type EmbeddingModelMiddleware = EmbeddingModelV3Middleware;
|
|
1787
1905
|
|
|
1788
1906
|
declare type EmbeddingModelProviderOptionsTransformer = (options: {
|
|
1789
|
-
providerOptions:
|
|
1907
|
+
providerOptions: SharedV3ProviderOptions | undefined;
|
|
1790
1908
|
values: Array<string>;
|
|
1791
1909
|
startIndex: number;
|
|
1792
1910
|
endIndex: number;
|
|
1793
|
-
}) =>
|
|
1911
|
+
}) => SharedV3ProviderOptions | undefined | PromiseLike<SharedV3ProviderOptions | undefined>;
|
|
1794
1912
|
|
|
1795
1913
|
/**
|
|
1796
1914
|
* Represents the number of tokens used in an embedding.
|
|
@@ -2080,8 +2198,9 @@ declare type EmbeddingModelV3Result = {
|
|
|
2080
2198
|
* Embed several values using an embedding model. The type of the value is defined
|
|
2081
2199
|
* by the embedding model.
|
|
2082
2200
|
*
|
|
2083
|
-
* `embedMany` automatically splits large requests into smaller chunks
|
|
2084
|
-
* has a limit on
|
|
2201
|
+
* `embedMany` automatically splits large requests into smaller chunks when the
|
|
2202
|
+
* model has a limit on either the number of embeddings or the UTF-8 input bytes
|
|
2203
|
+
* that can be processed in a single call.
|
|
2085
2204
|
*
|
|
2086
2205
|
* @param model - The embedding model to use.
|
|
2087
2206
|
* @param values - The values that should be embedded.
|
|
@@ -2230,6 +2349,12 @@ export declare class EmptyResponseBodyError extends AISDKError {
|
|
|
2230
2349
|
static isInstance(error: unknown): error is EmptyResponseBodyError;
|
|
2231
2350
|
}
|
|
2232
2351
|
|
|
2352
|
+
declare type EnforcedToolChoice = Extract<LanguageModelV3ToolChoice, {
|
|
2353
|
+
type: 'required';
|
|
2354
|
+
} | {
|
|
2355
|
+
type: 'tool';
|
|
2356
|
+
}>;
|
|
2357
|
+
|
|
2233
2358
|
declare type EnrichedStreamPart<TOOLS extends ToolSet, PARTIAL_OUTPUT> = {
|
|
2234
2359
|
part: TextStreamPart<TOOLS>;
|
|
2235
2360
|
partialOutput: PARTIAL_OUTPUT | undefined;
|
|
@@ -2611,9 +2736,10 @@ export declare function experimental_generateVideo({ model: modelArg, prompt: pr
|
|
|
2611
2736
|
*/
|
|
2612
2737
|
maxVideosPerCall?: number;
|
|
2613
2738
|
/**
|
|
2614
|
-
* Aspect ratio of the videos to generate. Must have the format
|
|
2739
|
+
* Aspect ratio of the videos to generate. Must have the format
|
|
2740
|
+
* `{width}:{height}`, or `'adaptive'` to inherit the ratio from the input media.
|
|
2615
2741
|
*/
|
|
2616
|
-
aspectRatio?: `${number}:${number}
|
|
2742
|
+
aspectRatio?: `${number}:${number}` | 'adaptive';
|
|
2617
2743
|
/**
|
|
2618
2744
|
* Resolution of the videos to generate. Must have the format `{width}x{height}`.
|
|
2619
2745
|
*/
|
|
@@ -2881,38 +3007,82 @@ declare function extractResponseHeaders(response: Response): {
|
|
|
2881
3007
|
declare type FetchFunction = typeof globalThis.fetch;
|
|
2882
3008
|
|
|
2883
3009
|
/**
|
|
2884
|
-
* Fetches
|
|
3010
|
+
* Fetches one validated URL without following redirects.
|
|
3011
|
+
*
|
|
3012
|
+
* On Node.js, the default fetch validates and pins DNS results at connect time.
|
|
3013
|
+
* An injected fetch is responsible for equivalent connect-time validation.
|
|
3014
|
+
* Redirects are rejected by default. Callers using `redirect: 'manual'` must
|
|
3015
|
+
* validate the Location target before issuing another request.
|
|
3016
|
+
*/
|
|
3017
|
+
declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, trustedOrigin, redirect, }: {
|
|
3018
|
+
url: string | URL;
|
|
3019
|
+
init?: RequestInit;
|
|
3020
|
+
fetch?: FetchFunction;
|
|
3021
|
+
/**
|
|
3022
|
+
* A developer-configured origin that may legitimately resolve to a private
|
|
3023
|
+
* address. This must never be derived from untrusted response data.
|
|
3024
|
+
*/
|
|
3025
|
+
trustedOrigin?: string;
|
|
3026
|
+
redirect?: 'error' | 'manual';
|
|
3027
|
+
}): Promise<Response>;
|
|
3028
|
+
|
|
3029
|
+
/**
|
|
3030
|
+
* Fetches a URL while enforcing the download guard on every hop.
|
|
2885
3031
|
*
|
|
2886
3032
|
* Redirects are followed manually (`redirect: 'manual'`) so each hop is
|
|
2887
3033
|
* validated with {@link validateDownloadUrl} *before* it is requested. Relying
|
|
2888
3034
|
* on the default `redirect: 'follow'` would issue the request to a redirect
|
|
2889
3035
|
* target (e.g. an internal address) before we ever see its URL, defeating the
|
|
2890
|
-
*
|
|
3036
|
+
* guard.
|
|
3037
|
+
*
|
|
3038
|
+
* Request headers are also protected: {@link sanitizeRequestHeaders} strips
|
|
3039
|
+
* proxy/metadata/cookie/hop-by-hop headers before the first request, and all
|
|
3040
|
+
* caller headers except `User-Agent` are dropped on a cross-origin redirect.
|
|
3041
|
+
* Credentials and custom headers are preserved on the first hop for backwards
|
|
3042
|
+
* compatibility. The caller must ensure that the initial URL may receive them.
|
|
3043
|
+
* The fetch spec only strips `Authorization` on cross-origin redirects because
|
|
3044
|
+
* in a browser, CORS preflighting protects custom headers; there is no CORS on
|
|
3045
|
+
* the server, so provider API keys carried in custom headers (e.g. `x-key`)
|
|
3046
|
+
* must be dropped here as well.
|
|
2891
3047
|
*
|
|
2892
3048
|
* A `redirect: 'manual'` request yields an unreadable opaque response in the
|
|
2893
3049
|
* browser (and in other spec-compliant fetch implementations), so the redirect
|
|
2894
3050
|
* target cannot be validated here. In a real browser this is safe to follow
|
|
2895
|
-
* natively because
|
|
2896
|
-
* cannot reach a server's internal network or
|
|
2897
|
-
* runtime we cannot validate the hop, so we fail
|
|
2898
|
-
* blindly and bypass the
|
|
3051
|
+
* natively because reaching an internal network is not possible (fetch is
|
|
3052
|
+
* constrained by CORS and cannot reach a server's internal network or
|
|
3053
|
+
* cloud-metadata). On any other runtime we cannot validate the hop, so we fail
|
|
3054
|
+
* closed rather than follow it blindly and bypass the guard.
|
|
3055
|
+
*
|
|
3056
|
+
* A hop that is same-origin with `trustedOrigin` (the developer-configured
|
|
3057
|
+
* provider endpoint) skips target validation: that origin is exactly what an
|
|
3058
|
+
* unvalidated, config-derived request would fetch anyway, and validating it
|
|
3059
|
+
* would break legitimate self-hosted / localhost deployments whose response
|
|
3060
|
+
* URLs point back at the configured host. Hops on any other origin are always
|
|
3061
|
+
* validated.
|
|
2899
3062
|
*
|
|
2900
3063
|
* The returned response is the final (non-redirect) response. The caller is
|
|
2901
3064
|
* responsible for checking `response.ok` and reading the body.
|
|
2902
3065
|
*
|
|
2903
3066
|
* On Node.js, the default fetch resolves every hostname through a validating
|
|
2904
3067
|
* lookup hook and passes those exact addresses to the connector, preventing
|
|
2905
|
-
* hostname-to-private-IP and DNS-rebinding bypasses.
|
|
3068
|
+
* hostname-to-private-IP and DNS-rebinding bypasses. An injected fetch is
|
|
3069
|
+
* responsible for equivalent connect-time validation. Other runtimes should
|
|
2906
3070
|
* constrain egress at the network layer when handling untrusted URLs.
|
|
2907
3071
|
*
|
|
2908
3072
|
* @throws DownloadError if a hop is unsafe, the redirect limit is exceeded, or
|
|
2909
3073
|
* a redirect cannot be validated on a non-browser runtime.
|
|
2910
3074
|
*/
|
|
2911
|
-
declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, }: {
|
|
3075
|
+
declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, fetch: customFetch, trustedOrigin, }: {
|
|
2912
3076
|
url: string;
|
|
2913
3077
|
headers?: HeadersInit;
|
|
2914
3078
|
abortSignal?: AbortSignal;
|
|
2915
3079
|
maxRedirects?: number;
|
|
3080
|
+
fetch?: FetchFunction;
|
|
3081
|
+
/**
|
|
3082
|
+
* A developer-configured origin (e.g. the provider's `baseURL`) whose hops
|
|
3083
|
+
* skip target validation. Must never be derived from response data.
|
|
3084
|
+
*/
|
|
3085
|
+
trustedOrigin?: string;
|
|
2916
3086
|
}): Promise<Response>;
|
|
2917
3087
|
|
|
2918
3088
|
/**
|
|
@@ -2995,7 +3165,7 @@ declare interface GatewayCreditsResponse {
|
|
|
2995
3165
|
totalUsed: string;
|
|
2996
3166
|
}
|
|
2997
3167
|
|
|
2998
|
-
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 & {});
|
|
3168
|
+
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' | 'cohere/embed-v5.0-fast' | 'cohere/embed-v5.0-pro' | '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' | 'perplexity/pplx-embed-v1-0.6b' | 'perplexity/pplx-embed-v1-4b' | '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 & {});
|
|
2999
3169
|
|
|
3000
3170
|
declare interface GatewayFetchMetadataResponse {
|
|
3001
3171
|
models: GatewayLanguageModelEntry[];
|
|
@@ -3045,7 +3215,7 @@ declare interface GatewayGenerationInfoParams {
|
|
|
3045
3215
|
id: string;
|
|
3046
3216
|
}
|
|
3047
3217
|
|
|
3048
|
-
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' | 'bytedance/seedream-5.0-pro' | '
|
|
3218
|
+
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-3-image' | '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' | 'bytedance/seedream-5.0-pro' | 'meta/muse-image-1.0' | 'microsoft/mai-image-2.6' | 'microsoft/mai-image-2.6-flash' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'openai/gpt-image-2.5-flare' | 'openai/gpt-image-2.5-sunburst' | 'prodia/flux-fast-schnell' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'recraft/recraft-v4.1' | 'recraft/recraft-v4.1-flash' | 'recraft/recraft-v4.1-pro' | 'recraft/recraft-v4.1-utility' | 'recraft/recraft-v4.1-utility-pro' | 'spacexai/grok-imagine-image' | 'spacexai/grok-imagine-image-2.0' | 'topaz/wonder-3.5' | (string & {});
|
|
3049
3219
|
|
|
3050
3220
|
declare interface GatewayLanguageModelEntry {
|
|
3051
3221
|
/**
|
|
@@ -3096,7 +3266,7 @@ declare interface GatewayLanguageModelEntry {
|
|
|
3096
3266
|
|
|
3097
3267
|
declare type GatewayLanguageModelSpecification = Pick<LanguageModelV3, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
3098
3268
|
|
|
3099
|
-
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/
|
|
3269
|
+
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-flash' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'alibaba/qwen3.8-2.4t-a95b' | 'alibaba/qwen3.8-27b' | 'alibaba/qwen3.8-flash' | 'alibaba/qwen3.8-max' | 'alibaba/qwen3.8-max-0902' | 'alibaba/qwen3.8-max-prime' | 'alibaba/qwen3.8-omni-flash' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-fable-5' | 'anthropic/claude-fable-5-batch' | 'anthropic/claude-fable-5.1' | 'anthropic/claude-fable-5.1-batch' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-haiku-4.5-batch' | 'anthropic/claude-haiku-5.5' | 'anthropic/claude-haiku-5.5-batch' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.5-batch' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.6-batch' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.7-batch' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-opus-4.8-batch' | 'anthropic/claude-opus-4.8-fast' | 'anthropic/claude-opus-5' | 'anthropic/claude-opus-5-batch' | 'anthropic/claude-opus-5-fast' | 'anthropic/claude-opus-5.5' | 'anthropic/claude-opus-5.5-batch' | 'anthropic/claude-opus-5.5-fast' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.5-batch' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-4.6-batch' | 'anthropic/claude-sonnet-5' | 'anthropic/claude-sonnet-5-batch' | 'anthropic/claude-sonnet-5.5' | 'anthropic/claude-sonnet-5.5-batch' | 'arcee-ai/trinity-large-thinking' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'bytedance/seed-2.1-turbo' | 'callstack/apex' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-flash-0731' | 'deepseek/deepseek-v4-flash-vision-exp' | 'deepseek/deepseek-v4-pro' | 'deepseek/deepseek-v4-pro-0813' | 'deepseek/deepseek-v4.1-flash' | 'deepseek/deepseek-v4.1-flash-fast' | 'fireworks/ember-1' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-batch' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-flash-lite-batch' | 'google/gemini-2.5-pro' | 'google/gemini-2.5-pro-batch' | 'google/gemini-3-flash' | 'google/gemini-3-flash-batch' | 'google/gemini-3-pro-image' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-batch' | 'google/gemini-3.1-flash-lite-image' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.1-pro-preview-batch' | 'google/gemini-3.5-flash' | 'google/gemini-3.5-flash-batch' | 'google/gemini-3.5-flash-lite' | 'google/gemini-3.5-flash-lite-batch' | 'google/gemini-3.6-flash' | 'google/gemini-3.6-flash-batch' | 'google/gemini-3.7-flash' | 'google/gemini-3.7-flash-batch' | 'google/gemini-3.8-flash' | 'google/gemini-4-argon' | 'google/gemini-nano-banana-2.1' | 'google/gemini-omni-flash-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-2.5' | 'inception/mercury-coder-small' | 'inclusionai/ling-3.0-flash' | 'inclusionai/ling-3.0-flash-fin' | 'inclusionai/ling-3.0-flash-sante' | 'inclusionai/ling-3.0-flash-vl' | 'inclusionai/ling-3.1-flash' | 'inference-net/schematron-v2-small' | 'inference-net/schematron-v2-turbo' | 'interfaze/interfaze-beta' | 'liquid/lfm2.5-24b-a2b' | 'meituan/longcat-2.5-preview' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'meta/muse-glimmer-30b' | 'meta/muse-spark-1.1' | 'meta/muse-spark-1.2' | 'meta/muse-spark-1.2-contributor' | 'meta/muse-spark-1.3' | 'meta/muse-spark-1.3-contributor' | 'meta/muse-spark-open' | 'meta/muse-wonder-1.0' | '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' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-large-4' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mixedbread/toast-1' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.7-code' | 'moonshotai/kimi-k2.7-code-highspeed' | 'moonshotai/kimi-k3' | 'moonshotai/kimi-k3-fast' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-3.5-lightning' | 'nvidia/nemotron-3.5-lightning-free' | 'nvidia/nemotron-3.5-super-vl' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-batch' | 'openai/gpt-4.1-fast' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-mini-batch' | 'openai/gpt-4.1-mini-fast' | 'openai/gpt-4.1-nano' | 'openai/gpt-4.1-nano-batch' | 'openai/gpt-4.1-nano-fast' | 'openai/gpt-4o' | 'openai/gpt-4o-batch' | 'openai/gpt-4o-fast' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-batch' | 'openai/gpt-4o-mini-fast' | 'openai/gpt-5' | 'openai/gpt-5-batch' | 'openai/gpt-5-codex' | 'openai/gpt-5-fast' | 'openai/gpt-5-mini' | 'openai/gpt-5-mini-batch' | 'openai/gpt-5-mini-fast' | 'openai/gpt-5-nano' | 'openai/gpt-5-nano-batch' | 'openai/gpt-5-pro' | 'openai/gpt-5-pro-batch' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.1-thinking-fast' | 'openai/gpt-5.2' | 'openai/gpt-5.2-batch' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-fast' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.3-codex-fast' | 'openai/gpt-5.4' | 'openai/gpt-5.4-batch' | 'openai/gpt-5.4-fast' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-mini-batch' | 'openai/gpt-5.4-mini-fast' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-nano-batch' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-batch' | 'openai/gpt-5.5-fast' | 'openai/gpt-5.5-pro' | 'openai/gpt-5.5-pro-batch' | 'openai/gpt-5.6-luna' | 'openai/gpt-5.6-luna-batch' | 'openai/gpt-5.6-luna-fast' | 'openai/gpt-5.6-sol' | 'openai/gpt-5.6-sol-batch' | 'openai/gpt-5.6-sol-fast' | 'openai/gpt-5.6-terra' | 'openai/gpt-5.6-terra-batch' | 'openai/gpt-5.6-terra-fast' | 'openai/gpt-6-astra' | 'openai/gpt-6-astra-batch' | 'openai/gpt-6-astra-fast' | 'openai/gpt-6-luna' | 'openai/gpt-6-luna-batch' | 'openai/gpt-6-luna-fast' | 'openai/gpt-6-sol' | 'openai/gpt-6-sol-batch' | 'openai/gpt-6-sol-fast' | 'openai/gpt-6.1-sol' | 'openai/gpt-6.1-sol-batch' | 'openai/gpt-6.1-sol-fast' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-120b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-fast' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'openai/o4-mini-fast' | 'perplexity/sonar' | 'poolside/laguna-s-2.1' | 'poolside/laguna-s-2.1-free' | 'quiverai/arrow-2' | 'quiverai/arrow-2-telos' | 'reflection/beam' | 'reflection/beam-free' | 'sakana/fugu-max' | 'sakana/fugu-ultra' | 'sakana/fugu-ultra-v2' | 'sakana/namazu' | 'spacexai/grok-4.1-fast-non-reasoning' | 'spacexai/grok-4.1-fast-reasoning' | 'spacexai/grok-4.20-multi-agent' | 'spacexai/grok-4.20-multi-agent-batch' | 'spacexai/grok-4.20-multi-agent-beta' | 'spacexai/grok-4.20-non-reasoning' | 'spacexai/grok-4.20-non-reasoning-batch' | 'spacexai/grok-4.20-non-reasoning-beta' | 'spacexai/grok-4.20-reasoning' | 'spacexai/grok-4.20-reasoning-batch' | 'spacexai/grok-4.20-reasoning-beta' | 'spacexai/grok-4.3' | 'spacexai/grok-4.3-batch' | 'spacexai/grok-4.5' | 'spacexai/grok-4.6' | 'spacexai/grok-4.7' | 'spacexai/grok-build-0.1' | 'stealth/cat-jam' | 'stealth/glyph-cluster' | 'stepfun/step-3.7-flash' | 'stepfun/step-5-preview' | 'tencent/hy-mt2-lite' | 'tencent/hy-mt2-plus' | 'tencent/hy-mt2-pro' | 'tencent/hy3' | 'tencent/hy4-preview' | 'thinkingmachines/inkling' | 'thinkingmachines/inkling-small' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'xiaomi/mimo-v2.6-flash' | 'xiaomi/mimo-v2.6-pro' | 'xiaomi/mimo-v2.6-pro-ultraspeed' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | '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-5.2' | 'zai/glm-5.2-fast' | 'zai/glm-5.3' | 'zai/glm-5.3-fast' | 'zai/glm-5.3-flash' | 'zai/glm-5.3-flashx' | 'zai/glm-5v-turbo' | (string & {});
|
|
3100
3270
|
|
|
3101
3271
|
declare interface GatewayProvider extends ProviderV3 {
|
|
3102
3272
|
(modelId: GatewayModelId): LanguageModelV3;
|
|
@@ -3208,9 +3378,9 @@ declare interface GatewayProviderSettings {
|
|
|
3208
3378
|
metadataCacheRefreshMillis?: number;
|
|
3209
3379
|
}
|
|
3210
3380
|
|
|
3211
|
-
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 & {});
|
|
3381
|
+
declare type GatewayRerankingModelId = 'cohere/rerank-v3.5' | 'cohere/rerank-v4-fast' | 'cohere/rerank-v4-pro' | 'voyage/rerank-2.5' | 'voyage/rerank-2.5-lite' | 'voyage/rerank-3' | 'voyage/rerank-3-lite' | (string & {});
|
|
3212
3382
|
|
|
3213
|
-
declare type GatewaySpeechModelId = 'openai/tts-1' | 'openai/tts-1-hd' | '
|
|
3383
|
+
declare type GatewaySpeechModelId = 'fish-audio/drama-3' | 'fish-audio/s1' | 'fish-audio/s2-pro' | 'fish-audio/s2.1-pro' | 'google/gemini-3.8-flash-lite-tts' | 'google/gemini-3.8-flash-tts' | 'microsoft/mai-voice-2' | 'microsoft/mai-voice-2-flash' | 'microsoft/mai-voice-2.1' | 'microsoft/mai-voice-2.1-flash' | 'openai/tts-1' | 'openai/tts-1-hd' | 'spacexai/grok-tts' | (string & {});
|
|
3214
3384
|
|
|
3215
3385
|
declare interface GatewaySpendReportParams {
|
|
3216
3386
|
/** Start date in YYYY-MM-DD format (inclusive) */
|
|
@@ -3274,6 +3444,20 @@ declare interface GatewaySpendReportRow {
|
|
|
3274
3444
|
* Gateway-specific provider-defined tools.
|
|
3275
3445
|
*/
|
|
3276
3446
|
declare const gatewayTools: {
|
|
3447
|
+
/**
|
|
3448
|
+
* Fetch page content using Browserbase's lightweight Fetch API.
|
|
3449
|
+
*
|
|
3450
|
+
* Supports raw, Markdown, and schema-driven JSON output as well as redirects,
|
|
3451
|
+
* proxy routing, and TLS controls.
|
|
3452
|
+
*/
|
|
3453
|
+
browserbaseFetch: (config?: BrowserbaseFetchConfig) => ReturnType<typeof browserbaseFetchToolFactory>;
|
|
3454
|
+
/**
|
|
3455
|
+
* Search the web using Browserbase's Search API for fast, structured results.
|
|
3456
|
+
*
|
|
3457
|
+
* Returns titles, URLs, and available publication metadata without requiring
|
|
3458
|
+
* a browser session.
|
|
3459
|
+
*/
|
|
3460
|
+
browserbaseSearch: (config?: BrowserbaseSearchConfig) => ReturnType<typeof browserbaseSearchToolFactory>;
|
|
3277
3461
|
/**
|
|
3278
3462
|
* Search the web using Exa for current information and token-efficient
|
|
3279
3463
|
* excerpts optimized for agent workflows.
|
|
@@ -3299,11 +3483,20 @@ declare const gatewayTools: {
|
|
|
3299
3483
|
* domain, language, date range, and recency filters.
|
|
3300
3484
|
*/
|
|
3301
3485
|
perplexitySearch: (config?: PerplexitySearchConfig) => ReturnType<typeof perplexitySearchToolFactory>;
|
|
3486
|
+
/**
|
|
3487
|
+
* Search the web and Tako's curated knowledge graph in one call for
|
|
3488
|
+
* token-efficient web excerpts and structured data results grounded in
|
|
3489
|
+
* premium sources, each with an embed-ready visualization.
|
|
3490
|
+
*
|
|
3491
|
+
* Supports effort, per-source web and data controls, localization, and inline
|
|
3492
|
+
* contents for agents that need to reason over underlying data.
|
|
3493
|
+
*/
|
|
3494
|
+
takoSearch: (config?: TakoSearchConfig) => ReturnType<typeof takoSearchToolFactory>;
|
|
3302
3495
|
};
|
|
3303
3496
|
|
|
3304
|
-
declare type GatewayTranscriptionModelId = 'openai/gpt-4o-mini-transcribe' | 'openai/gpt-4o-transcribe' | 'openai/gpt-realtime-whisper' | 'openai/whisper-1' | '
|
|
3497
|
+
declare type GatewayTranscriptionModelId = 'fish-audio/transcribe-1' | 'google/gemini-3.5-transcribe' | 'google/gemini-3.5-transcribe-live' | 'microsoft/mai-transcribe-2' | 'microsoft/mai-transcribe-2-streaming' | 'openai/gpt-4o-mini-transcribe' | 'openai/gpt-4o-transcribe' | 'openai/gpt-realtime-whisper' | 'openai/whisper-1' | 'spacexai/grok-stt' | (string & {});
|
|
3305
3498
|
|
|
3306
|
-
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' | 'alibaba/wan-v2.7-r2v' | 'alibaba/wan-v2.7-t2v' | 'bytedance/seedance-2.0' | 'bytedance/seedance-2.0-fast' | '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-motion-control' | 'klingai/kling-v3.0-t2v' | '
|
|
3499
|
+
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' | 'alibaba/wan-v2.7-r2v' | 'alibaba/wan-v2.7-t2v' | 'alibaba/wan-v3.0-video' | 'alibaba/wan-v3.0-video-prime' | 'bfl/flux-3-video' | 'bytedance/seedance-2.0' | 'bytedance/seedance-2.0-fast' | 'bytedance/seedance-2.0-mini' | 'bytedance/seedance-2.5' | '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' | 'google/veo-3.1-lite-generate-001' | 'heygen/heygen-video-1' | '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-motion-control' | 'klingai/kling-v3.0-t2v' | 'minimax/minimax-h3' | 'minimax/minimax-h3-max' | 'spacexai/grok-imagine-video' | 'spacexai/grok-imagine-video-1.5' | 'spacexai/grok-imagine-video-1.5-lite' | 'topaz/proteus' | 'topaz/starlight-precise-2.6' | (string & {});
|
|
3307
3500
|
|
|
3308
3501
|
/**
|
|
3309
3502
|
* A generated audio file.
|
|
@@ -3355,7 +3548,7 @@ export declare const generateId: IdGenerator;
|
|
|
3355
3548
|
* @param seed - Seed for the image generation.
|
|
3356
3549
|
* @param providerOptions - Additional provider-specific options that are passed through to the provider
|
|
3357
3550
|
* as body parameters.
|
|
3358
|
-
* @param maxRetries - Maximum number of retries. Set to 0 to disable retries. Default: 2.
|
|
3551
|
+
* @param maxRetries - Maximum number of retries per image model call, including retries after unclassified empty responses. Empty responses marked as not retryable by the provider are not retried. Set to 0 to disable retries. Default: 2.
|
|
3359
3552
|
* @param abortSignal - An optional abort signal that can be used to cancel the call.
|
|
3360
3553
|
* @param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
|
|
3361
3554
|
*
|
|
@@ -3406,7 +3599,9 @@ export declare function generateImage({ model: modelArg, prompt: promptArg, n, m
|
|
|
3406
3599
|
*/
|
|
3407
3600
|
providerOptions?: ProviderOptions;
|
|
3408
3601
|
/**
|
|
3409
|
-
* Maximum number of retries per image model call
|
|
3602
|
+
* Maximum number of retries per image model call, including retries after
|
|
3603
|
+
* unclassified empty responses. Empty responses marked as not retryable by
|
|
3604
|
+
* the provider are not retried. Set to 0 to disable retries.
|
|
3410
3605
|
*
|
|
3411
3606
|
* @default 2
|
|
3412
3607
|
*/
|
|
@@ -3691,7 +3886,7 @@ export declare interface GenerateObjectResult<OBJECT> {
|
|
|
3691
3886
|
* @returns
|
|
3692
3887
|
* A result object that contains the generated text, the results of the tool calls, and additional information.
|
|
3693
3888
|
*/
|
|
3694
|
-
export declare function generateText<TOOLS extends ToolSet, OUTPUT extends
|
|
3889
|
+
export declare function generateText<TOOLS extends ToolSet, OUTPUT extends OutputInterface = OutputInterface<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_toolApprovalSecret, experimental_include: include, _internal: { generateId }, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
|
|
3695
3890
|
/**
|
|
3696
3891
|
* The language model to use.
|
|
3697
3892
|
*/
|
|
@@ -3856,7 +4051,7 @@ export declare type GenerateTextOnFinishCallback<TOOLS extends ToolSet> = (event
|
|
|
3856
4051
|
*
|
|
3857
4052
|
* @param event - The event object containing generation configuration.
|
|
3858
4053
|
*/
|
|
3859
|
-
export declare type GenerateTextOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends
|
|
4054
|
+
export declare type GenerateTextOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface> = (event: OnStartEvent<TOOLS, OUTPUT, GenerateTextIncludeSettings>) => PromiseLike<void> | void;
|
|
3860
4055
|
|
|
3861
4056
|
/**
|
|
3862
4057
|
* Callback that is set using the `onStepFinish` option.
|
|
@@ -3877,7 +4072,7 @@ export declare type GenerateTextOnStepFinishCallback<TOOLS extends ToolSet> = (e
|
|
|
3877
4072
|
*
|
|
3878
4073
|
* @param event - The event object containing step configuration.
|
|
3879
4074
|
*/
|
|
3880
|
-
export declare type GenerateTextOnStepStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends
|
|
4075
|
+
export declare type GenerateTextOnStepStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface> = (event: OnStepStartEvent<TOOLS, OUTPUT, GenerateTextIncludeSettings>) => PromiseLike<void> | void;
|
|
3881
4076
|
|
|
3882
4077
|
/**
|
|
3883
4078
|
* Callback that is set using the `experimental_onToolCallFinish` option.
|
|
@@ -3907,7 +4102,7 @@ export declare type GenerateTextOnToolCallStartCallback<TOOLS extends ToolSet =
|
|
|
3907
4102
|
* The result of a `generateText` call.
|
|
3908
4103
|
* It contains the generated text, the tool calls that were made during the generation, and the results of the tool calls.
|
|
3909
4104
|
*/
|
|
3910
|
-
export declare interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT extends
|
|
4105
|
+
export declare interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT extends OutputInterface> {
|
|
3911
4106
|
/**
|
|
3912
4107
|
* The content that was generated in the last step.
|
|
3913
4108
|
*/
|
|
@@ -4025,7 +4220,8 @@ export declare interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT extend
|
|
|
4025
4220
|
* The generated output according to the `output` specification.
|
|
4026
4221
|
*
|
|
4027
4222
|
* @throws {NoOutputGeneratedError} When no output is available, for example
|
|
4028
|
-
* when the final step
|
|
4223
|
+
* when the final step finishes with a `tool-calls` reason, or when it
|
|
4224
|
+
* contains no text and does not finish with a `stop` reason.
|
|
4029
4225
|
*/
|
|
4030
4226
|
readonly output: InferGenerateOutput<OUTPUT>;
|
|
4031
4227
|
}
|
|
@@ -4065,13 +4261,44 @@ export declare interface GenerateVideoResult {
|
|
|
4065
4261
|
|
|
4066
4262
|
declare function getErrorMessage(error: unknown | undefined): string;
|
|
4067
4263
|
|
|
4068
|
-
declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
4264
|
+
declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, validateUrl, credentialedOrigin, trustedOrigin, }: {
|
|
4069
4265
|
url: string;
|
|
4070
4266
|
headers?: Record<string, string | undefined>;
|
|
4071
4267
|
failedResponseHandler: ResponseHandler<Error>;
|
|
4072
4268
|
successfulResponseHandler: ResponseHandler<T>;
|
|
4073
4269
|
abortSignal?: AbortSignal;
|
|
4074
4270
|
fetch?: FetchFunction;
|
|
4271
|
+
/**
|
|
4272
|
+
* Set `true` when `url` is untrusted (e.g. taken from a provider response
|
|
4273
|
+
* body): it is routed through {@link fetchWithValidatedRedirects}, which
|
|
4274
|
+
* rejects private/loopback/link-local targets and re-validates redirect
|
|
4275
|
+
* hops; blocked URLs throw `DownloadError`. Set `false` only for URLs built
|
|
4276
|
+
* from a developer-configured endpoint.
|
|
4277
|
+
*
|
|
4278
|
+
* Optional for backwards compatibility with existing callers; omitting it
|
|
4279
|
+
* behaves like `false` (no validation).
|
|
4280
|
+
*/
|
|
4281
|
+
validateUrl?: boolean;
|
|
4282
|
+
/**
|
|
4283
|
+
* When set, `headers` are sent only if `url` is same-origin with this origin
|
|
4284
|
+
* (the user-agent suffix is always kept). Pass the provider's configured
|
|
4285
|
+
* base URL alongside `validateUrl: true` so credentials never ride a request
|
|
4286
|
+
* to a response-supplied host on a different origin (e.g. a CDN). Redirects
|
|
4287
|
+
* that later cross origin drop all caller headers regardless (see
|
|
4288
|
+
* {@link fetchWithValidatedRedirects}).
|
|
4289
|
+
*/
|
|
4290
|
+
credentialedOrigin?: string;
|
|
4291
|
+
/**
|
|
4292
|
+
* A developer-configured origin (e.g. the provider's `baseURL`) that is
|
|
4293
|
+
* exempt from URL validation when `validateUrl` is `true`. A response URL
|
|
4294
|
+
* (or redirect hop) that is same-origin with it is fetched without target
|
|
4295
|
+
* validation — it points at exactly the host a config-derived
|
|
4296
|
+
* `validateUrl: false` request would fetch anyway, so blocking it would
|
|
4297
|
+
* only break legitimate self-hosted / localhost deployments whose response
|
|
4298
|
+
* URLs point back at the configured host. Hops on any other origin are
|
|
4299
|
+
* still validated. Must never be derived from response data.
|
|
4300
|
+
*/
|
|
4301
|
+
trustedOrigin?: string;
|
|
4075
4302
|
}) => Promise<{
|
|
4076
4303
|
value: T;
|
|
4077
4304
|
rawValue?: unknown;
|
|
@@ -4438,6 +4665,11 @@ declare type ImageModelV3 = {
|
|
|
4438
4665
|
* be returned as binary data.
|
|
4439
4666
|
*/
|
|
4440
4667
|
images: Array<string> | Array<Uint8Array>;
|
|
4668
|
+
/**
|
|
4669
|
+
* Whether an unsuccessful result, such as an empty image result, can be
|
|
4670
|
+
* retried. When omitted, the result is unclassified.
|
|
4671
|
+
*/
|
|
4672
|
+
isRetryable?: boolean;
|
|
4441
4673
|
/**
|
|
4442
4674
|
* Warnings for the call, e.g. unsupported features.
|
|
4443
4675
|
*/
|
|
@@ -4583,42 +4815,6 @@ declare type ImageModelV3File = {
|
|
|
4583
4815
|
providerOptions?: SharedV3ProviderMetadata;
|
|
4584
4816
|
};
|
|
4585
4817
|
|
|
4586
|
-
/**
|
|
4587
|
-
* An image file that can be used for image editing or variation generation.
|
|
4588
|
-
*/
|
|
4589
|
-
declare type ImageModelV3File_2 = {
|
|
4590
|
-
type: 'file';
|
|
4591
|
-
/**
|
|
4592
|
-
* The IANA media type of the file, e.g. `image/png`. Any string is supported.
|
|
4593
|
-
*
|
|
4594
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4595
|
-
*/
|
|
4596
|
-
mediaType: string;
|
|
4597
|
-
/**
|
|
4598
|
-
* Generated file data as base64 encoded strings or binary data.
|
|
4599
|
-
*
|
|
4600
|
-
* The file data should be returned without any unnecessary conversion.
|
|
4601
|
-
* If the API returns base64 encoded strings, the file data should be returned
|
|
4602
|
-
* as base64 encoded strings. If the API returns binary data, the file data should
|
|
4603
|
-
* be returned as binary data.
|
|
4604
|
-
*/
|
|
4605
|
-
data: string | Uint8Array;
|
|
4606
|
-
/**
|
|
4607
|
-
* Optional provider-specific metadata for the file part.
|
|
4608
|
-
*/
|
|
4609
|
-
providerOptions?: SharedV3ProviderMetadata_2;
|
|
4610
|
-
} | {
|
|
4611
|
-
type: 'url';
|
|
4612
|
-
/**
|
|
4613
|
-
* The URL of the image file.
|
|
4614
|
-
*/
|
|
4615
|
-
url: string;
|
|
4616
|
-
/**
|
|
4617
|
-
* Optional provider-specific metadata for the file part.
|
|
4618
|
-
*/
|
|
4619
|
-
providerOptions?: SharedV3ProviderMetadata_2;
|
|
4620
|
-
};
|
|
4621
|
-
|
|
4622
4818
|
/**
|
|
4623
4819
|
* Middleware for ImageModelV3.
|
|
4624
4820
|
* This type defines the structure for middleware that can be used to modify
|
|
@@ -4740,19 +4936,19 @@ export { InferAgentUIMessage }
|
|
|
4740
4936
|
/**
|
|
4741
4937
|
* Infers the element type from an array output specification.
|
|
4742
4938
|
*/
|
|
4743
|
-
declare type InferElementOutput<OUTPUT extends
|
|
4939
|
+
declare type InferElementOutput<OUTPUT extends OutputInterface> = OUTPUT extends OutputInterface<any, any, infer ELEMENT> ? ELEMENT : never;
|
|
4744
4940
|
|
|
4745
4941
|
/**
|
|
4746
4942
|
* Infers the complete output type from the output specification.
|
|
4747
4943
|
*/
|
|
4748
|
-
export declare type InferGenerateOutput<OUTPUT extends
|
|
4944
|
+
export declare type InferGenerateOutput<OUTPUT extends OutputInterface> = OUTPUT extends OutputInterface<infer COMPLETE_OUTPUT, any, any> ? COMPLETE_OUTPUT : never;
|
|
4749
4945
|
|
|
4750
4946
|
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;
|
|
4751
4947
|
|
|
4752
4948
|
/**
|
|
4753
4949
|
* Infers the partial output type from the output specification.
|
|
4754
4950
|
*/
|
|
4755
|
-
export declare type InferStreamOutput<OUTPUT extends
|
|
4951
|
+
export declare type InferStreamOutput<OUTPUT extends OutputInterface> = OUTPUT extends OutputInterface<any, infer PARTIAL_OUTPUT, any> ? PARTIAL_OUTPUT : never;
|
|
4756
4952
|
|
|
4757
4953
|
/**
|
|
4758
4954
|
* Infer the input type of a tool.
|
|
@@ -4802,14 +4998,14 @@ export declare type InferUITools<TOOLS extends ToolSet> = {
|
|
|
4802
4998
|
};
|
|
4803
4999
|
|
|
4804
5000
|
declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPrefix, schemaSuffix, }: {
|
|
4805
|
-
messages:
|
|
5001
|
+
messages: LanguageModelV3Prompt;
|
|
4806
5002
|
schema?: JSONSchema7;
|
|
4807
5003
|
schemaPrefix?: string;
|
|
4808
5004
|
schemaSuffix?: string;
|
|
4809
|
-
}):
|
|
5005
|
+
}): LanguageModelV3Prompt;
|
|
4810
5006
|
|
|
4811
5007
|
export declare class InvalidArgumentError extends AISDKError {
|
|
4812
|
-
private readonly [symbol$
|
|
5008
|
+
private readonly [symbol$j];
|
|
4813
5009
|
readonly parameter: string;
|
|
4814
5010
|
readonly value: unknown;
|
|
4815
5011
|
constructor({ parameter, value, message, }: {
|
|
@@ -4871,7 +5067,7 @@ export declare class InvalidResponseDataError extends AISDKError {
|
|
|
4871
5067
|
}
|
|
4872
5068
|
|
|
4873
5069
|
export declare class InvalidStreamPartError extends AISDKError {
|
|
4874
|
-
private readonly [symbol$
|
|
5070
|
+
private readonly [symbol$i];
|
|
4875
5071
|
readonly chunk: SingleRequestTextStreamPart<any>;
|
|
4876
5072
|
constructor({ chunk, message, }: {
|
|
4877
5073
|
chunk: SingleRequestTextStreamPart<any>;
|
|
@@ -4881,7 +5077,7 @@ export declare class InvalidStreamPartError extends AISDKError {
|
|
|
4881
5077
|
}
|
|
4882
5078
|
|
|
4883
5079
|
export declare class InvalidToolApprovalError extends AISDKError {
|
|
4884
|
-
private readonly [symbol$
|
|
5080
|
+
private readonly [symbol$h];
|
|
4885
5081
|
readonly approvalId: string;
|
|
4886
5082
|
constructor({ approvalId }: {
|
|
4887
5083
|
approvalId: string;
|
|
@@ -4890,7 +5086,7 @@ export declare class InvalidToolApprovalError extends AISDKError {
|
|
|
4890
5086
|
}
|
|
4891
5087
|
|
|
4892
5088
|
export declare class InvalidToolApprovalSignatureError extends AISDKError {
|
|
4893
|
-
private readonly [symbol$
|
|
5089
|
+
private readonly [symbol$g];
|
|
4894
5090
|
readonly approvalId: string;
|
|
4895
5091
|
readonly toolCallId: string;
|
|
4896
5092
|
constructor({ approvalId, toolCallId, reason, }: {
|
|
@@ -4902,7 +5098,7 @@ export declare class InvalidToolApprovalSignatureError extends AISDKError {
|
|
|
4902
5098
|
}
|
|
4903
5099
|
|
|
4904
5100
|
export declare class InvalidToolInputError extends AISDKError {
|
|
4905
|
-
private readonly [symbol$
|
|
5101
|
+
private readonly [symbol$l];
|
|
4906
5102
|
readonly toolName: string;
|
|
4907
5103
|
readonly toolInput: string;
|
|
4908
5104
|
constructor({ toolInput, toolName, cause, message, }: {
|
|
@@ -5031,16 +5227,10 @@ declare type Job = () => Promise<void>;
|
|
|
5031
5227
|
|
|
5032
5228
|
declare type JSONArray = JSONValue_2[];
|
|
5033
5229
|
|
|
5034
|
-
declare type JSONArray_2 = JSONValue_3[];
|
|
5035
|
-
|
|
5036
5230
|
declare type JSONObject = {
|
|
5037
5231
|
[key: string]: JSONValue_2 | undefined;
|
|
5038
5232
|
};
|
|
5039
5233
|
|
|
5040
|
-
declare type JSONObject_2 = {
|
|
5041
|
-
[key: string]: JSONValue_3 | undefined;
|
|
5042
|
-
};
|
|
5043
|
-
|
|
5044
5234
|
export declare class JSONParseError extends AISDKError {
|
|
5045
5235
|
private readonly [symbol$7];
|
|
5046
5236
|
readonly text: string;
|
|
@@ -5051,16 +5241,6 @@ export declare class JSONParseError extends AISDKError {
|
|
|
5051
5241
|
static isInstance(error: unknown): error is JSONParseError;
|
|
5052
5242
|
}
|
|
5053
5243
|
|
|
5054
|
-
declare class JSONParseError_2 extends AISDKError_2 {
|
|
5055
|
-
private readonly [symbol$7_2];
|
|
5056
|
-
readonly text: string;
|
|
5057
|
-
constructor({ text, cause }: {
|
|
5058
|
-
text: string;
|
|
5059
|
-
cause: unknown;
|
|
5060
|
-
});
|
|
5061
|
-
static isInstance(error: unknown): error is JSONParseError_2;
|
|
5062
|
-
}
|
|
5063
|
-
|
|
5064
5244
|
/**
|
|
5065
5245
|
* Create a schema using a JSON Schema.
|
|
5066
5246
|
*
|
|
@@ -5090,12 +5270,6 @@ export declare type JSONValue = JSONValue_2;
|
|
|
5090
5270
|
*/
|
|
5091
5271
|
declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
|
|
5092
5272
|
|
|
5093
|
-
/**
|
|
5094
|
-
* A JSON value can be a string, number, boolean, object, array, or null.
|
|
5095
|
-
* JSON values can be serialized and deserialized by the JSON.stringify and JSON.parse methods.
|
|
5096
|
-
*/
|
|
5097
|
-
declare type JSONValue_3 = null | string | number | boolean | JSONObject_2 | JSONArray_2;
|
|
5098
|
-
|
|
5099
5273
|
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "speech", "transcription", "video"];
|
|
5100
5274
|
|
|
5101
5275
|
declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
|
|
@@ -6118,11 +6292,6 @@ declare type LanguageModelV3Content = LanguageModelV3Text | LanguageModelV3Reaso
|
|
|
6118
6292
|
*/
|
|
6119
6293
|
declare type LanguageModelV3DataContent = Uint8Array | string | URL;
|
|
6120
6294
|
|
|
6121
|
-
/**
|
|
6122
|
-
* Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
6123
|
-
*/
|
|
6124
|
-
declare type LanguageModelV3DataContent_2 = Uint8Array | string | URL;
|
|
6125
|
-
|
|
6126
6295
|
/**
|
|
6127
6296
|
* A file that has been generated by the model.
|
|
6128
6297
|
* Generated files as base64 encoded strings or binary data.
|
|
@@ -6151,34 +6320,6 @@ declare type LanguageModelV3File = {
|
|
|
6151
6320
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
6152
6321
|
};
|
|
6153
6322
|
|
|
6154
|
-
/**
|
|
6155
|
-
* A file that has been generated by the model.
|
|
6156
|
-
* Generated files as base64 encoded strings or binary data.
|
|
6157
|
-
* The files should be returned without any unnecessary conversion.
|
|
6158
|
-
*/
|
|
6159
|
-
declare type LanguageModelV3File_2 = {
|
|
6160
|
-
type: 'file';
|
|
6161
|
-
/**
|
|
6162
|
-
* The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
|
|
6163
|
-
*
|
|
6164
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
6165
|
-
*/
|
|
6166
|
-
mediaType: string;
|
|
6167
|
-
/**
|
|
6168
|
-
* Generated file data as base64 encoded strings or binary data.
|
|
6169
|
-
*
|
|
6170
|
-
* The file data should be returned without any unnecessary conversion.
|
|
6171
|
-
* If the API returns base64 encoded strings, the file data should be returned
|
|
6172
|
-
* as base64 encoded strings. If the API returns binary data, the file data should
|
|
6173
|
-
* be returned as binary data.
|
|
6174
|
-
*/
|
|
6175
|
-
data: string | Uint8Array;
|
|
6176
|
-
/**
|
|
6177
|
-
* Optional provider-specific metadata for the file part.
|
|
6178
|
-
*/
|
|
6179
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6180
|
-
};
|
|
6181
|
-
|
|
6182
6323
|
/**
|
|
6183
6324
|
* File content part of a prompt. It contains a file.
|
|
6184
6325
|
*/
|
|
@@ -6192,6 +6333,13 @@ declare interface LanguageModelV3FilePart {
|
|
|
6192
6333
|
* File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
6193
6334
|
*/
|
|
6194
6335
|
data: LanguageModelV3DataContent;
|
|
6336
|
+
/**
|
|
6337
|
+
* The original URL string before it was parsed into a URL.
|
|
6338
|
+
*
|
|
6339
|
+
* This is available when parsing changes the string and a provider needs to
|
|
6340
|
+
* preserve an opaque non-HTTP URI exactly.
|
|
6341
|
+
*/
|
|
6342
|
+
originalUrl?: string;
|
|
6195
6343
|
/**
|
|
6196
6344
|
* IANA media type of the file.
|
|
6197
6345
|
*
|
|
@@ -6209,76 +6357,13 @@ declare interface LanguageModelV3FilePart {
|
|
|
6209
6357
|
}
|
|
6210
6358
|
|
|
6211
6359
|
/**
|
|
6212
|
-
*
|
|
6360
|
+
* Reason why a language model finished generating a response.
|
|
6361
|
+
*
|
|
6362
|
+
* Contains both a unified finish reason and a raw finish reason from the provider.
|
|
6363
|
+
* The unified finish reason is used to provide a consistent finish reason across different providers.
|
|
6364
|
+
* The raw finish reason is used to provide the original finish reason from the provider.
|
|
6213
6365
|
*/
|
|
6214
|
-
declare
|
|
6215
|
-
type: 'file';
|
|
6216
|
-
/**
|
|
6217
|
-
* Optional filename of the file.
|
|
6218
|
-
*/
|
|
6219
|
-
filename?: string;
|
|
6220
|
-
/**
|
|
6221
|
-
* File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
6222
|
-
*/
|
|
6223
|
-
data: LanguageModelV3DataContent_2;
|
|
6224
|
-
/**
|
|
6225
|
-
* The original URL string before it was parsed into a URL.
|
|
6226
|
-
*
|
|
6227
|
-
* This is available when parsing changes the string and a provider needs to
|
|
6228
|
-
* preserve an opaque non-HTTP URI exactly.
|
|
6229
|
-
*/
|
|
6230
|
-
originalUrl?: string;
|
|
6231
|
-
/**
|
|
6232
|
-
* IANA media type of the file.
|
|
6233
|
-
*
|
|
6234
|
-
* Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
|
|
6235
|
-
*
|
|
6236
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
6237
|
-
*/
|
|
6238
|
-
mediaType: string;
|
|
6239
|
-
/**
|
|
6240
|
-
* Additional provider-specific options. They are passed through
|
|
6241
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
6242
|
-
* functionality that can be fully encapsulated in the provider.
|
|
6243
|
-
*/
|
|
6244
|
-
providerOptions?: SharedV3ProviderOptions_2;
|
|
6245
|
-
}
|
|
6246
|
-
|
|
6247
|
-
/**
|
|
6248
|
-
* Reason why a language model finished generating a response.
|
|
6249
|
-
*
|
|
6250
|
-
* Contains both a unified finish reason and a raw finish reason from the provider.
|
|
6251
|
-
* The unified finish reason is used to provide a consistent finish reason across different providers.
|
|
6252
|
-
* The raw finish reason is used to provide the original finish reason from the provider.
|
|
6253
|
-
*/
|
|
6254
|
-
declare type LanguageModelV3FinishReason = {
|
|
6255
|
-
/**
|
|
6256
|
-
* Unified finish reason. This enables using the same finish reason across different providers.
|
|
6257
|
-
*
|
|
6258
|
-
* Can be one of the following:
|
|
6259
|
-
* - `stop`: model generated stop sequence
|
|
6260
|
-
* - `length`: model generated maximum number of tokens
|
|
6261
|
-
* - `content-filter`: content filter violation stopped the model
|
|
6262
|
-
* - `tool-calls`: model triggered tool calls
|
|
6263
|
-
* - `error`: model stopped because of an error
|
|
6264
|
-
* - `other`: model stopped for other reasons
|
|
6265
|
-
*/
|
|
6266
|
-
unified: 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
|
|
6267
|
-
/**
|
|
6268
|
-
* Raw finish reason from the provider.
|
|
6269
|
-
* This is the original finish reason from the provider.
|
|
6270
|
-
*/
|
|
6271
|
-
raw: string | undefined;
|
|
6272
|
-
};
|
|
6273
|
-
|
|
6274
|
-
/**
|
|
6275
|
-
* Reason why a language model finished generating a response.
|
|
6276
|
-
*
|
|
6277
|
-
* Contains both a unified finish reason and a raw finish reason from the provider.
|
|
6278
|
-
* The unified finish reason is used to provide a consistent finish reason across different providers.
|
|
6279
|
-
* The raw finish reason is used to provide the original finish reason from the provider.
|
|
6280
|
-
*/
|
|
6281
|
-
declare type LanguageModelV3FinishReason_2 = {
|
|
6366
|
+
declare type LanguageModelV3FinishReason = {
|
|
6282
6367
|
/**
|
|
6283
6368
|
* Unified finish reason. This enables using the same finish reason across different providers.
|
|
6284
6369
|
*
|
|
@@ -6344,52 +6429,6 @@ declare type LanguageModelV3FunctionTool = {
|
|
|
6344
6429
|
providerOptions?: SharedV3ProviderOptions;
|
|
6345
6430
|
};
|
|
6346
6431
|
|
|
6347
|
-
/**
|
|
6348
|
-
* A tool has a name, a description, and a set of parameters.
|
|
6349
|
-
*
|
|
6350
|
-
* Note: this is **not** the user-facing tool definition. The AI SDK methods will
|
|
6351
|
-
* map the user-facing tool definitions to this format.
|
|
6352
|
-
*/
|
|
6353
|
-
declare type LanguageModelV3FunctionTool_2 = {
|
|
6354
|
-
/**
|
|
6355
|
-
* The type of the tool (always 'function').
|
|
6356
|
-
*/
|
|
6357
|
-
type: 'function';
|
|
6358
|
-
/**
|
|
6359
|
-
* The name of the tool. Unique within this model call.
|
|
6360
|
-
*/
|
|
6361
|
-
name: string;
|
|
6362
|
-
/**
|
|
6363
|
-
* A description of the tool. The language model uses this to understand the
|
|
6364
|
-
* tool's purpose and to provide better completion suggestions.
|
|
6365
|
-
*/
|
|
6366
|
-
description?: string;
|
|
6367
|
-
/**
|
|
6368
|
-
* The parameters that the tool expects. The language model uses this to
|
|
6369
|
-
* understand the tool's input requirements and to provide matching suggestions.
|
|
6370
|
-
*/
|
|
6371
|
-
inputSchema: JSONSchema7;
|
|
6372
|
-
/**
|
|
6373
|
-
* An optional list of input examples that show the language
|
|
6374
|
-
* model what the input should look like.
|
|
6375
|
-
*/
|
|
6376
|
-
inputExamples?: Array<{
|
|
6377
|
-
input: JSONObject_2;
|
|
6378
|
-
}>;
|
|
6379
|
-
/**
|
|
6380
|
-
* Strict mode setting for the tool.
|
|
6381
|
-
*
|
|
6382
|
-
* Providers that support strict mode will use this setting to determine
|
|
6383
|
-
* how the input should be generated. Strict mode will always produce
|
|
6384
|
-
* valid inputs, but it might limit what input schemas are supported.
|
|
6385
|
-
*/
|
|
6386
|
-
strict?: boolean;
|
|
6387
|
-
/**
|
|
6388
|
-
* The provider-specific options for the tool.
|
|
6389
|
-
*/
|
|
6390
|
-
providerOptions?: SharedV3ProviderOptions_2;
|
|
6391
|
-
};
|
|
6392
|
-
|
|
6393
6432
|
/**
|
|
6394
6433
|
* The result of a language model doGenerate call.
|
|
6395
6434
|
*/
|
|
@@ -6461,27 +6500,6 @@ declare type LanguageModelV3Message = ({
|
|
|
6461
6500
|
providerOptions?: SharedV3ProviderOptions;
|
|
6462
6501
|
};
|
|
6463
6502
|
|
|
6464
|
-
declare type LanguageModelV3Message_2 = ({
|
|
6465
|
-
role: 'system';
|
|
6466
|
-
content: string;
|
|
6467
|
-
} | {
|
|
6468
|
-
role: 'user';
|
|
6469
|
-
content: Array<LanguageModelV3TextPart_2 | LanguageModelV3FilePart_2>;
|
|
6470
|
-
} | {
|
|
6471
|
-
role: 'assistant';
|
|
6472
|
-
content: Array<LanguageModelV3TextPart_2 | LanguageModelV3FilePart_2 | LanguageModelV3ReasoningPart_2 | LanguageModelV3ToolCallPart_2 | LanguageModelV3ToolResultPart_2>;
|
|
6473
|
-
} | {
|
|
6474
|
-
role: 'tool';
|
|
6475
|
-
content: Array<LanguageModelV3ToolResultPart_2 | LanguageModelV3ToolApprovalResponsePart_2>;
|
|
6476
|
-
}) & {
|
|
6477
|
-
/**
|
|
6478
|
-
* Additional provider-specific options. They are passed through
|
|
6479
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
6480
|
-
* functionality that can be fully encapsulated in the provider.
|
|
6481
|
-
*/
|
|
6482
|
-
providerOptions?: SharedV3ProviderOptions_2;
|
|
6483
|
-
};
|
|
6484
|
-
|
|
6485
6503
|
/**
|
|
6486
6504
|
* Experimental middleware for LanguageModelV3.
|
|
6487
6505
|
* This type defines the structure for middleware that can be used to modify
|
|
@@ -6571,17 +6589,6 @@ declare type LanguageModelV3Middleware = {
|
|
|
6571
6589
|
*/
|
|
6572
6590
|
declare type LanguageModelV3Prompt = Array<LanguageModelV3Message>;
|
|
6573
6591
|
|
|
6574
|
-
/**
|
|
6575
|
-
* A prompt is a list of messages.
|
|
6576
|
-
*
|
|
6577
|
-
* Note: Not all models and prompt formats support multi-modal inputs and
|
|
6578
|
-
* tool calls. The validation happens at runtime.
|
|
6579
|
-
*
|
|
6580
|
-
* Note: This is not a user-facing prompt. The AI SDK methods will map the
|
|
6581
|
-
* user-facing prompt types such as chat or instruction prompts to this format.
|
|
6582
|
-
*/
|
|
6583
|
-
declare type LanguageModelV3Prompt_2 = Array<LanguageModelV3Message_2>;
|
|
6584
|
-
|
|
6585
6592
|
/**
|
|
6586
6593
|
* The configuration of a provider tool.
|
|
6587
6594
|
*
|
|
@@ -6608,32 +6615,6 @@ declare type LanguageModelV3ProviderTool = {
|
|
|
6608
6615
|
args: Record<string, unknown>;
|
|
6609
6616
|
};
|
|
6610
6617
|
|
|
6611
|
-
/**
|
|
6612
|
-
* The configuration of a provider tool.
|
|
6613
|
-
*
|
|
6614
|
-
* Provider tools are tools that are specific to a certain provider.
|
|
6615
|
-
* The input and output schemas are defined be the provider, and
|
|
6616
|
-
* some of the tools are also executed on the provider systems.
|
|
6617
|
-
*/
|
|
6618
|
-
declare type LanguageModelV3ProviderTool_2 = {
|
|
6619
|
-
/**
|
|
6620
|
-
* The type of the tool (always 'provider').
|
|
6621
|
-
*/
|
|
6622
|
-
type: 'provider';
|
|
6623
|
-
/**
|
|
6624
|
-
* The ID of the tool. Should follow the format `<provider-id>.<unique-tool-name>`.
|
|
6625
|
-
*/
|
|
6626
|
-
id: `${string}.${string}`;
|
|
6627
|
-
/**
|
|
6628
|
-
* The name of the tool. Unique within this model call.
|
|
6629
|
-
*/
|
|
6630
|
-
name: string;
|
|
6631
|
-
/**
|
|
6632
|
-
* The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
|
|
6633
|
-
*/
|
|
6634
|
-
args: Record<string, unknown>;
|
|
6635
|
-
};
|
|
6636
|
-
|
|
6637
6618
|
/**
|
|
6638
6619
|
* Reasoning that the model has generated.
|
|
6639
6620
|
*/
|
|
@@ -6663,23 +6644,6 @@ declare interface LanguageModelV3ReasoningPart {
|
|
|
6663
6644
|
providerOptions?: SharedV3ProviderOptions;
|
|
6664
6645
|
}
|
|
6665
6646
|
|
|
6666
|
-
/**
|
|
6667
|
-
* Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
6668
|
-
*/
|
|
6669
|
-
declare interface LanguageModelV3ReasoningPart_2 {
|
|
6670
|
-
type: 'reasoning';
|
|
6671
|
-
/**
|
|
6672
|
-
* The reasoning text.
|
|
6673
|
-
*/
|
|
6674
|
-
text: string;
|
|
6675
|
-
/**
|
|
6676
|
-
* Additional provider-specific options. They are passed through
|
|
6677
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
6678
|
-
* functionality that can be fully encapsulated in the provider.
|
|
6679
|
-
*/
|
|
6680
|
-
providerOptions?: SharedV3ProviderOptions_2;
|
|
6681
|
-
}
|
|
6682
|
-
|
|
6683
6647
|
declare interface LanguageModelV3ResponseMetadata {
|
|
6684
6648
|
/**
|
|
6685
6649
|
* ID for the generated response, if the provider sends one.
|
|
@@ -6695,21 +6659,6 @@ declare interface LanguageModelV3ResponseMetadata {
|
|
|
6695
6659
|
modelId?: string;
|
|
6696
6660
|
}
|
|
6697
6661
|
|
|
6698
|
-
declare interface LanguageModelV3ResponseMetadata_2 {
|
|
6699
|
-
/**
|
|
6700
|
-
* ID for the generated response, if the provider sends one.
|
|
6701
|
-
*/
|
|
6702
|
-
id?: string;
|
|
6703
|
-
/**
|
|
6704
|
-
* Timestamp for the start of the generated response, if the provider sends one.
|
|
6705
|
-
*/
|
|
6706
|
-
timestamp?: Date;
|
|
6707
|
-
/**
|
|
6708
|
-
* The ID of the response model that was used to generate the response, if the provider sends one.
|
|
6709
|
-
*/
|
|
6710
|
-
modelId?: string;
|
|
6711
|
-
}
|
|
6712
|
-
|
|
6713
6662
|
/**
|
|
6714
6663
|
* A source that has been used as input to generate the response.
|
|
6715
6664
|
*/
|
|
@@ -6763,59 +6712,6 @@ declare type LanguageModelV3Source = {
|
|
|
6763
6712
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
6764
6713
|
};
|
|
6765
6714
|
|
|
6766
|
-
/**
|
|
6767
|
-
* A source that has been used as input to generate the response.
|
|
6768
|
-
*/
|
|
6769
|
-
declare type LanguageModelV3Source_2 = {
|
|
6770
|
-
type: 'source';
|
|
6771
|
-
/**
|
|
6772
|
-
* The type of source - URL sources reference web content.
|
|
6773
|
-
*/
|
|
6774
|
-
sourceType: 'url';
|
|
6775
|
-
/**
|
|
6776
|
-
* The ID of the source.
|
|
6777
|
-
*/
|
|
6778
|
-
id: string;
|
|
6779
|
-
/**
|
|
6780
|
-
* The URL of the source.
|
|
6781
|
-
*/
|
|
6782
|
-
url: string;
|
|
6783
|
-
/**
|
|
6784
|
-
* The title of the source.
|
|
6785
|
-
*/
|
|
6786
|
-
title?: string;
|
|
6787
|
-
/**
|
|
6788
|
-
* Additional provider metadata for the source.
|
|
6789
|
-
*/
|
|
6790
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6791
|
-
} | {
|
|
6792
|
-
type: 'source';
|
|
6793
|
-
/**
|
|
6794
|
-
* The type of source - document sources reference files/documents.
|
|
6795
|
-
*/
|
|
6796
|
-
sourceType: 'document';
|
|
6797
|
-
/**
|
|
6798
|
-
* The ID of the source.
|
|
6799
|
-
*/
|
|
6800
|
-
id: string;
|
|
6801
|
-
/**
|
|
6802
|
-
* IANA media type of the document (e.g., 'application/pdf').
|
|
6803
|
-
*/
|
|
6804
|
-
mediaType: string;
|
|
6805
|
-
/**
|
|
6806
|
-
* The title of the document.
|
|
6807
|
-
*/
|
|
6808
|
-
title: string;
|
|
6809
|
-
/**
|
|
6810
|
-
* Optional filename of the document.
|
|
6811
|
-
*/
|
|
6812
|
-
filename?: string;
|
|
6813
|
-
/**
|
|
6814
|
-
* Additional provider metadata for the source.
|
|
6815
|
-
*/
|
|
6816
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6817
|
-
};
|
|
6818
|
-
|
|
6819
6715
|
declare type LanguageModelV3StreamPart = {
|
|
6820
6716
|
type: 'text-start';
|
|
6821
6717
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
@@ -6846,6 +6742,12 @@ declare type LanguageModelV3StreamPart = {
|
|
|
6846
6742
|
type: 'tool-input-start';
|
|
6847
6743
|
id: string;
|
|
6848
6744
|
toolName: string;
|
|
6745
|
+
/**
|
|
6746
|
+
* Encoding of the input deltas. Defaults to JSON when omitted.
|
|
6747
|
+
* Text deltas concatenate to a raw string. The final tool-call input
|
|
6748
|
+
* must still be JSON-encoded, regardless of the delta encoding.
|
|
6749
|
+
*/
|
|
6750
|
+
inputEncoding?: 'json' | 'text';
|
|
6849
6751
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
6850
6752
|
providerExecuted?: boolean;
|
|
6851
6753
|
dynamic?: boolean;
|
|
@@ -6877,67 +6779,6 @@ declare type LanguageModelV3StreamPart = {
|
|
|
6877
6779
|
error: unknown;
|
|
6878
6780
|
};
|
|
6879
6781
|
|
|
6880
|
-
declare type LanguageModelV3StreamPart_2 = {
|
|
6881
|
-
type: 'text-start';
|
|
6882
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6883
|
-
id: string;
|
|
6884
|
-
} | {
|
|
6885
|
-
type: 'text-delta';
|
|
6886
|
-
id: string;
|
|
6887
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6888
|
-
delta: string;
|
|
6889
|
-
} | {
|
|
6890
|
-
type: 'text-end';
|
|
6891
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6892
|
-
id: string;
|
|
6893
|
-
} | {
|
|
6894
|
-
type: 'reasoning-start';
|
|
6895
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6896
|
-
id: string;
|
|
6897
|
-
} | {
|
|
6898
|
-
type: 'reasoning-delta';
|
|
6899
|
-
id: string;
|
|
6900
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6901
|
-
delta: string;
|
|
6902
|
-
} | {
|
|
6903
|
-
type: 'reasoning-end';
|
|
6904
|
-
id: string;
|
|
6905
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6906
|
-
} | {
|
|
6907
|
-
type: 'tool-input-start';
|
|
6908
|
-
id: string;
|
|
6909
|
-
toolName: string;
|
|
6910
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6911
|
-
providerExecuted?: boolean;
|
|
6912
|
-
dynamic?: boolean;
|
|
6913
|
-
title?: string;
|
|
6914
|
-
} | {
|
|
6915
|
-
type: 'tool-input-delta';
|
|
6916
|
-
id: string;
|
|
6917
|
-
delta: string;
|
|
6918
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6919
|
-
} | {
|
|
6920
|
-
type: 'tool-input-end';
|
|
6921
|
-
id: string;
|
|
6922
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6923
|
-
} | LanguageModelV3ToolApprovalRequest_2 | LanguageModelV3ToolCall_2 | LanguageModelV3ToolResult_2 | LanguageModelV3File_2 | LanguageModelV3Source_2 | {
|
|
6924
|
-
type: 'stream-start';
|
|
6925
|
-
warnings: Array<SharedV3Warning_2>;
|
|
6926
|
-
} | ({
|
|
6927
|
-
type: 'response-metadata';
|
|
6928
|
-
} & LanguageModelV3ResponseMetadata_2) | {
|
|
6929
|
-
type: 'finish';
|
|
6930
|
-
usage: LanguageModelV3Usage_2;
|
|
6931
|
-
finishReason: LanguageModelV3FinishReason_2;
|
|
6932
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
6933
|
-
} | {
|
|
6934
|
-
type: 'raw';
|
|
6935
|
-
rawValue: unknown;
|
|
6936
|
-
} | {
|
|
6937
|
-
type: 'error';
|
|
6938
|
-
error: unknown;
|
|
6939
|
-
};
|
|
6940
|
-
|
|
6941
6782
|
/**
|
|
6942
6783
|
* The result of a language model doStream call.
|
|
6943
6784
|
*/
|
|
@@ -6995,23 +6836,6 @@ declare interface LanguageModelV3TextPart {
|
|
|
6995
6836
|
providerOptions?: SharedV3ProviderOptions;
|
|
6996
6837
|
}
|
|
6997
6838
|
|
|
6998
|
-
/**
|
|
6999
|
-
* Text content part of a prompt. It contains a string of text.
|
|
7000
|
-
*/
|
|
7001
|
-
declare interface LanguageModelV3TextPart_2 {
|
|
7002
|
-
type: 'text';
|
|
7003
|
-
/**
|
|
7004
|
-
* The text content.
|
|
7005
|
-
*/
|
|
7006
|
-
text: string;
|
|
7007
|
-
/**
|
|
7008
|
-
* Additional provider-specific options. They are passed through
|
|
7009
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
7010
|
-
* functionality that can be fully encapsulated in the provider.
|
|
7011
|
-
*/
|
|
7012
|
-
providerOptions?: SharedV3ProviderOptions_2;
|
|
7013
|
-
}
|
|
7014
|
-
|
|
7015
6839
|
/**
|
|
7016
6840
|
* Tool approval request emitted by a provider for a provider-executed tool call.
|
|
7017
6841
|
*
|
|
@@ -7035,29 +6859,6 @@ declare type LanguageModelV3ToolApprovalRequest = {
|
|
|
7035
6859
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
7036
6860
|
};
|
|
7037
6861
|
|
|
7038
|
-
/**
|
|
7039
|
-
* Tool approval request emitted by a provider for a provider-executed tool call.
|
|
7040
|
-
*
|
|
7041
|
-
* This is used for flows where the provider executes the tool (e.g. MCP tools)
|
|
7042
|
-
* but requires an explicit user approval before continuing.
|
|
7043
|
-
*/
|
|
7044
|
-
declare type LanguageModelV3ToolApprovalRequest_2 = {
|
|
7045
|
-
type: 'tool-approval-request';
|
|
7046
|
-
/**
|
|
7047
|
-
* ID of the approval request. This ID is referenced by the subsequent
|
|
7048
|
-
* tool-approval-response (tool message) to approve or deny execution.
|
|
7049
|
-
*/
|
|
7050
|
-
approvalId: string;
|
|
7051
|
-
/**
|
|
7052
|
-
* The tool call ID that this approval request is for.
|
|
7053
|
-
*/
|
|
7054
|
-
toolCallId: string;
|
|
7055
|
-
/**
|
|
7056
|
-
* Additional provider-specific metadata for the approval request.
|
|
7057
|
-
*/
|
|
7058
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
7059
|
-
};
|
|
7060
|
-
|
|
7061
6862
|
/**
|
|
7062
6863
|
* Tool approval response content part of a prompt. It contains the user's
|
|
7063
6864
|
* decision to approve or deny a provider-executed tool call.
|
|
@@ -7084,32 +6885,6 @@ declare interface LanguageModelV3ToolApprovalResponsePart {
|
|
|
7084
6885
|
providerOptions?: SharedV3ProviderOptions;
|
|
7085
6886
|
}
|
|
7086
6887
|
|
|
7087
|
-
/**
|
|
7088
|
-
* Tool approval response content part of a prompt. It contains the user's
|
|
7089
|
-
* decision to approve or deny a provider-executed tool call.
|
|
7090
|
-
*/
|
|
7091
|
-
declare interface LanguageModelV3ToolApprovalResponsePart_2 {
|
|
7092
|
-
type: 'tool-approval-response';
|
|
7093
|
-
/**
|
|
7094
|
-
* ID of the approval request that this response refers to.
|
|
7095
|
-
*/
|
|
7096
|
-
approvalId: string;
|
|
7097
|
-
/**
|
|
7098
|
-
* Whether the approval was granted (true) or denied (false).
|
|
7099
|
-
*/
|
|
7100
|
-
approved: boolean;
|
|
7101
|
-
/**
|
|
7102
|
-
* Optional reason for approval or denial.
|
|
7103
|
-
*/
|
|
7104
|
-
reason?: string;
|
|
7105
|
-
/**
|
|
7106
|
-
* Additional provider-specific options. They are passed through
|
|
7107
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
7108
|
-
* functionality that can be fully encapsulated in the provider.
|
|
7109
|
-
*/
|
|
7110
|
-
providerOptions?: SharedV3ProviderOptions_2;
|
|
7111
|
-
}
|
|
7112
|
-
|
|
7113
6888
|
/**
|
|
7114
6889
|
* Tool calls that the model has generated.
|
|
7115
6890
|
*/
|
|
@@ -7124,8 +6899,9 @@ declare type LanguageModelV3ToolCall = {
|
|
|
7124
6899
|
*/
|
|
7125
6900
|
toolName: string;
|
|
7126
6901
|
/**
|
|
7127
|
-
*
|
|
7128
|
-
*
|
|
6902
|
+
* JSON-encoded tool input. Must match the input schema of the tool.
|
|
6903
|
+
* String inputs must also be JSON-encoded, even when input deltas use text
|
|
6904
|
+
* encoding.
|
|
7129
6905
|
*/
|
|
7130
6906
|
input: string;
|
|
7131
6907
|
/**
|
|
@@ -7144,40 +6920,6 @@ declare type LanguageModelV3ToolCall = {
|
|
|
7144
6920
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
7145
6921
|
};
|
|
7146
6922
|
|
|
7147
|
-
/**
|
|
7148
|
-
* Tool calls that the model has generated.
|
|
7149
|
-
*/
|
|
7150
|
-
declare type LanguageModelV3ToolCall_2 = {
|
|
7151
|
-
type: 'tool-call';
|
|
7152
|
-
/**
|
|
7153
|
-
* The identifier of the tool call. It must be unique across all tool calls.
|
|
7154
|
-
*/
|
|
7155
|
-
toolCallId: string;
|
|
7156
|
-
/**
|
|
7157
|
-
* The name of the tool that should be called.
|
|
7158
|
-
*/
|
|
7159
|
-
toolName: string;
|
|
7160
|
-
/**
|
|
7161
|
-
* Stringified JSON object with the tool call arguments. Must match the
|
|
7162
|
-
* parameters schema of the tool.
|
|
7163
|
-
*/
|
|
7164
|
-
input: string;
|
|
7165
|
-
/**
|
|
7166
|
-
* Whether the tool call will be executed by the provider.
|
|
7167
|
-
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
7168
|
-
*/
|
|
7169
|
-
providerExecuted?: boolean;
|
|
7170
|
-
/**
|
|
7171
|
-
* Whether the tool is dynamic, i.e. defined at runtime.
|
|
7172
|
-
* For example, MCP (Model Context Protocol) tools that are executed by the provider.
|
|
7173
|
-
*/
|
|
7174
|
-
dynamic?: boolean;
|
|
7175
|
-
/**
|
|
7176
|
-
* Additional provider-specific metadata for the tool call.
|
|
7177
|
-
*/
|
|
7178
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
7179
|
-
};
|
|
7180
|
-
|
|
7181
6923
|
/**
|
|
7182
6924
|
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
7183
6925
|
*/
|
|
@@ -7208,36 +6950,6 @@ declare interface LanguageModelV3ToolCallPart {
|
|
|
7208
6950
|
providerOptions?: SharedV3ProviderOptions;
|
|
7209
6951
|
}
|
|
7210
6952
|
|
|
7211
|
-
/**
|
|
7212
|
-
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
7213
|
-
*/
|
|
7214
|
-
declare interface LanguageModelV3ToolCallPart_2 {
|
|
7215
|
-
type: 'tool-call';
|
|
7216
|
-
/**
|
|
7217
|
-
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
7218
|
-
*/
|
|
7219
|
-
toolCallId: string;
|
|
7220
|
-
/**
|
|
7221
|
-
* Name of the tool that is being called.
|
|
7222
|
-
*/
|
|
7223
|
-
toolName: string;
|
|
7224
|
-
/**
|
|
7225
|
-
* Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
7226
|
-
*/
|
|
7227
|
-
input: unknown;
|
|
7228
|
-
/**
|
|
7229
|
-
* Whether the tool call will be executed by the provider.
|
|
7230
|
-
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
7231
|
-
*/
|
|
7232
|
-
providerExecuted?: boolean;
|
|
7233
|
-
/**
|
|
7234
|
-
* Additional provider-specific options. They are passed through
|
|
7235
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
7236
|
-
* functionality that can be fully encapsulated in the provider.
|
|
7237
|
-
*/
|
|
7238
|
-
providerOptions?: SharedV3ProviderOptions_2;
|
|
7239
|
-
}
|
|
7240
|
-
|
|
7241
6953
|
declare type LanguageModelV3ToolChoice = {
|
|
7242
6954
|
type: 'auto';
|
|
7243
6955
|
} | {
|
|
@@ -7275,233 +6987,26 @@ declare type LanguageModelV3ToolResult = {
|
|
|
7275
6987
|
*
|
|
7276
6988
|
* Preliminary tool results replace each other, e.g. image previews.
|
|
7277
6989
|
* There always has to be a final, non-preliminary tool result.
|
|
7278
|
-
*
|
|
7279
|
-
* If this flag is set to true, the tool result is preliminary.
|
|
7280
|
-
* If this flag is not set or is false, the tool result is not preliminary.
|
|
7281
|
-
*/
|
|
7282
|
-
preliminary?: boolean;
|
|
7283
|
-
/**
|
|
7284
|
-
* Whether the tool is dynamic, i.e. defined at runtime.
|
|
7285
|
-
* For example, MCP (Model Context Protocol) tools that are executed by the provider.
|
|
7286
|
-
*/
|
|
7287
|
-
dynamic?: boolean;
|
|
7288
|
-
/**
|
|
7289
|
-
* Additional provider-specific metadata for the tool result.
|
|
7290
|
-
*/
|
|
7291
|
-
providerMetadata?: SharedV3ProviderMetadata;
|
|
7292
|
-
};
|
|
7293
|
-
|
|
7294
|
-
/**
|
|
7295
|
-
* Result of a tool call that has been executed by the provider.
|
|
7296
|
-
*/
|
|
7297
|
-
declare type LanguageModelV3ToolResult_2 = {
|
|
7298
|
-
type: 'tool-result';
|
|
7299
|
-
/**
|
|
7300
|
-
* The ID of the tool call that this result is associated with.
|
|
7301
|
-
*/
|
|
7302
|
-
toolCallId: string;
|
|
7303
|
-
/**
|
|
7304
|
-
* Name of the tool that generated this result.
|
|
7305
|
-
*/
|
|
7306
|
-
toolName: string;
|
|
7307
|
-
/**
|
|
7308
|
-
* Result of the tool call. This is a JSON-serializable object.
|
|
7309
|
-
*/
|
|
7310
|
-
result: NonNullable<JSONValue_3>;
|
|
7311
|
-
/**
|
|
7312
|
-
* Optional flag if the result is an error or an error message.
|
|
7313
|
-
*/
|
|
7314
|
-
isError?: boolean;
|
|
7315
|
-
/**
|
|
7316
|
-
* Whether the tool result is preliminary.
|
|
7317
|
-
*
|
|
7318
|
-
* Preliminary tool results replace each other, e.g. image previews.
|
|
7319
|
-
* There always has to be a final, non-preliminary tool result.
|
|
7320
|
-
*
|
|
7321
|
-
* If this flag is set to true, the tool result is preliminary.
|
|
7322
|
-
* If this flag is not set or is false, the tool result is not preliminary.
|
|
7323
|
-
*/
|
|
7324
|
-
preliminary?: boolean;
|
|
7325
|
-
/**
|
|
7326
|
-
* Whether the tool is dynamic, i.e. defined at runtime.
|
|
7327
|
-
* For example, MCP (Model Context Protocol) tools that are executed by the provider.
|
|
7328
|
-
*/
|
|
7329
|
-
dynamic?: boolean;
|
|
7330
|
-
/**
|
|
7331
|
-
* Additional provider-specific metadata for the tool result.
|
|
7332
|
-
*/
|
|
7333
|
-
providerMetadata?: SharedV3ProviderMetadata_2;
|
|
7334
|
-
};
|
|
7335
|
-
|
|
7336
|
-
/**
|
|
7337
|
-
* Result of a tool call.
|
|
7338
|
-
*/
|
|
7339
|
-
declare type LanguageModelV3ToolResultOutput = {
|
|
7340
|
-
/**
|
|
7341
|
-
* Text tool output that should be directly sent to the API.
|
|
7342
|
-
*/
|
|
7343
|
-
type: 'text';
|
|
7344
|
-
value: string;
|
|
7345
|
-
/**
|
|
7346
|
-
* Provider-specific options.
|
|
7347
|
-
*/
|
|
7348
|
-
providerOptions?: SharedV3ProviderOptions;
|
|
7349
|
-
} | {
|
|
7350
|
-
type: 'json';
|
|
7351
|
-
value: JSONValue_2;
|
|
7352
|
-
/**
|
|
7353
|
-
* Provider-specific options.
|
|
7354
|
-
*/
|
|
7355
|
-
providerOptions?: SharedV3ProviderOptions;
|
|
7356
|
-
} | {
|
|
7357
|
-
/**
|
|
7358
|
-
* Type when the user has denied the execution of the tool call.
|
|
7359
|
-
*/
|
|
7360
|
-
type: 'execution-denied';
|
|
7361
|
-
/**
|
|
7362
|
-
* Optional reason for the execution denial.
|
|
7363
|
-
*/
|
|
7364
|
-
reason?: string;
|
|
7365
|
-
/**
|
|
7366
|
-
* Provider-specific options.
|
|
6990
|
+
*
|
|
6991
|
+
* If this flag is set to true, the tool result is preliminary.
|
|
6992
|
+
* If this flag is not set or is false, the tool result is not preliminary.
|
|
7367
6993
|
*/
|
|
7368
|
-
|
|
7369
|
-
} | {
|
|
7370
|
-
type: 'error-text';
|
|
7371
|
-
value: string;
|
|
6994
|
+
preliminary?: boolean;
|
|
7372
6995
|
/**
|
|
7373
|
-
*
|
|
6996
|
+
* Whether the tool is dynamic, i.e. defined at runtime.
|
|
6997
|
+
* For example, MCP (Model Context Protocol) tools that are executed by the provider.
|
|
7374
6998
|
*/
|
|
7375
|
-
|
|
7376
|
-
} | {
|
|
7377
|
-
type: 'error-json';
|
|
7378
|
-
value: JSONValue_2;
|
|
6999
|
+
dynamic?: boolean;
|
|
7379
7000
|
/**
|
|
7380
|
-
*
|
|
7001
|
+
* Additional provider-specific metadata for the tool result.
|
|
7381
7002
|
*/
|
|
7382
|
-
|
|
7383
|
-
} | {
|
|
7384
|
-
type: 'content';
|
|
7385
|
-
value: Array<{
|
|
7386
|
-
type: 'text';
|
|
7387
|
-
/**
|
|
7388
|
-
* Text content.
|
|
7389
|
-
*/
|
|
7390
|
-
text: string;
|
|
7391
|
-
/**
|
|
7392
|
-
* Provider-specific options.
|
|
7393
|
-
*/
|
|
7394
|
-
providerOptions?: SharedV3ProviderOptions;
|
|
7395
|
-
} | {
|
|
7396
|
-
type: 'file-data';
|
|
7397
|
-
/**
|
|
7398
|
-
* Base-64 encoded media data.
|
|
7399
|
-
*/
|
|
7400
|
-
data: string;
|
|
7401
|
-
/**
|
|
7402
|
-
* IANA media type.
|
|
7403
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
7404
|
-
*/
|
|
7405
|
-
mediaType: string;
|
|
7406
|
-
/**
|
|
7407
|
-
* Optional filename of the file.
|
|
7408
|
-
*/
|
|
7409
|
-
filename?: string;
|
|
7410
|
-
/**
|
|
7411
|
-
* Provider-specific options.
|
|
7412
|
-
*/
|
|
7413
|
-
providerOptions?: SharedV3ProviderOptions;
|
|
7414
|
-
} | {
|
|
7415
|
-
type: 'file-url';
|
|
7416
|
-
/**
|
|
7417
|
-
* URL of the file.
|
|
7418
|
-
*/
|
|
7419
|
-
url: string;
|
|
7420
|
-
/**
|
|
7421
|
-
* Provider-specific options.
|
|
7422
|
-
*/
|
|
7423
|
-
providerOptions?: SharedV3ProviderOptions;
|
|
7424
|
-
} | {
|
|
7425
|
-
type: 'file-id';
|
|
7426
|
-
/**
|
|
7427
|
-
* ID of the file.
|
|
7428
|
-
*
|
|
7429
|
-
* If you use multiple providers, you need to
|
|
7430
|
-
* specify the provider specific ids using
|
|
7431
|
-
* the Record option. The key is the provider
|
|
7432
|
-
* name, e.g. 'openai' or 'anthropic'.
|
|
7433
|
-
*/
|
|
7434
|
-
fileId: string | Record<string, string>;
|
|
7435
|
-
/**
|
|
7436
|
-
* Provider-specific options.
|
|
7437
|
-
*/
|
|
7438
|
-
providerOptions?: SharedV3ProviderOptions;
|
|
7439
|
-
} | {
|
|
7440
|
-
/**
|
|
7441
|
-
* Images that are referenced using base64 encoded data.
|
|
7442
|
-
*/
|
|
7443
|
-
type: 'image-data';
|
|
7444
|
-
/**
|
|
7445
|
-
* Base-64 encoded image data.
|
|
7446
|
-
*/
|
|
7447
|
-
data: string;
|
|
7448
|
-
/**
|
|
7449
|
-
* IANA media type.
|
|
7450
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
7451
|
-
*/
|
|
7452
|
-
mediaType: string;
|
|
7453
|
-
/**
|
|
7454
|
-
* Provider-specific options.
|
|
7455
|
-
*/
|
|
7456
|
-
providerOptions?: SharedV3ProviderOptions;
|
|
7457
|
-
} | {
|
|
7458
|
-
/**
|
|
7459
|
-
* Images that are referenced using a URL.
|
|
7460
|
-
*/
|
|
7461
|
-
type: 'image-url';
|
|
7462
|
-
/**
|
|
7463
|
-
* URL of the image.
|
|
7464
|
-
*/
|
|
7465
|
-
url: string;
|
|
7466
|
-
/**
|
|
7467
|
-
* Provider-specific options.
|
|
7468
|
-
*/
|
|
7469
|
-
providerOptions?: SharedV3ProviderOptions;
|
|
7470
|
-
} | {
|
|
7471
|
-
/**
|
|
7472
|
-
* Images that are referenced using a provider file id.
|
|
7473
|
-
*/
|
|
7474
|
-
type: 'image-file-id';
|
|
7475
|
-
/**
|
|
7476
|
-
* Image that is referenced using a provider file id.
|
|
7477
|
-
*
|
|
7478
|
-
* If you use multiple providers, you need to
|
|
7479
|
-
* specify the provider specific ids using
|
|
7480
|
-
* the Record option. The key is the provider
|
|
7481
|
-
* name, e.g. 'openai' or 'anthropic'.
|
|
7482
|
-
*/
|
|
7483
|
-
fileId: string | Record<string, string>;
|
|
7484
|
-
/**
|
|
7485
|
-
* Provider-specific options.
|
|
7486
|
-
*/
|
|
7487
|
-
providerOptions?: SharedV3ProviderOptions;
|
|
7488
|
-
} | {
|
|
7489
|
-
/**
|
|
7490
|
-
* Custom content part. This can be used to implement
|
|
7491
|
-
* provider-specific content parts.
|
|
7492
|
-
*/
|
|
7493
|
-
type: 'custom';
|
|
7494
|
-
/**
|
|
7495
|
-
* Provider-specific options.
|
|
7496
|
-
*/
|
|
7497
|
-
providerOptions?: SharedV3ProviderOptions;
|
|
7498
|
-
}>;
|
|
7003
|
+
providerMetadata?: SharedV3ProviderMetadata;
|
|
7499
7004
|
};
|
|
7500
7005
|
|
|
7501
7006
|
/**
|
|
7502
7007
|
* Result of a tool call.
|
|
7503
7008
|
*/
|
|
7504
|
-
declare type
|
|
7009
|
+
declare type LanguageModelV3ToolResultOutput = {
|
|
7505
7010
|
/**
|
|
7506
7011
|
* Text tool output that should be directly sent to the API.
|
|
7507
7012
|
*/
|
|
@@ -7510,14 +7015,14 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7510
7015
|
/**
|
|
7511
7016
|
* Provider-specific options.
|
|
7512
7017
|
*/
|
|
7513
|
-
providerOptions?:
|
|
7018
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7514
7019
|
} | {
|
|
7515
7020
|
type: 'json';
|
|
7516
|
-
value:
|
|
7021
|
+
value: JSONValue_2;
|
|
7517
7022
|
/**
|
|
7518
7023
|
* Provider-specific options.
|
|
7519
7024
|
*/
|
|
7520
|
-
providerOptions?:
|
|
7025
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7521
7026
|
} | {
|
|
7522
7027
|
/**
|
|
7523
7028
|
* Type when the user has denied the execution of the tool call.
|
|
@@ -7530,21 +7035,21 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7530
7035
|
/**
|
|
7531
7036
|
* Provider-specific options.
|
|
7532
7037
|
*/
|
|
7533
|
-
providerOptions?:
|
|
7038
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7534
7039
|
} | {
|
|
7535
7040
|
type: 'error-text';
|
|
7536
7041
|
value: string;
|
|
7537
7042
|
/**
|
|
7538
7043
|
* Provider-specific options.
|
|
7539
7044
|
*/
|
|
7540
|
-
providerOptions?:
|
|
7045
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7541
7046
|
} | {
|
|
7542
7047
|
type: 'error-json';
|
|
7543
|
-
value:
|
|
7048
|
+
value: JSONValue_2;
|
|
7544
7049
|
/**
|
|
7545
7050
|
* Provider-specific options.
|
|
7546
7051
|
*/
|
|
7547
|
-
providerOptions?:
|
|
7052
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7548
7053
|
} | {
|
|
7549
7054
|
type: 'content';
|
|
7550
7055
|
value: Array<{
|
|
@@ -7556,7 +7061,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7556
7061
|
/**
|
|
7557
7062
|
* Provider-specific options.
|
|
7558
7063
|
*/
|
|
7559
|
-
providerOptions?:
|
|
7064
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7560
7065
|
} | {
|
|
7561
7066
|
type: 'file-data';
|
|
7562
7067
|
/**
|
|
@@ -7575,7 +7080,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7575
7080
|
/**
|
|
7576
7081
|
* Provider-specific options.
|
|
7577
7082
|
*/
|
|
7578
|
-
providerOptions?:
|
|
7083
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7579
7084
|
} | {
|
|
7580
7085
|
type: 'file-url';
|
|
7581
7086
|
/**
|
|
@@ -7590,7 +7095,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7590
7095
|
/**
|
|
7591
7096
|
* Provider-specific options.
|
|
7592
7097
|
*/
|
|
7593
|
-
providerOptions?:
|
|
7098
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7594
7099
|
} | {
|
|
7595
7100
|
type: 'file-id';
|
|
7596
7101
|
/**
|
|
@@ -7605,7 +7110,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7605
7110
|
/**
|
|
7606
7111
|
* Provider-specific options.
|
|
7607
7112
|
*/
|
|
7608
|
-
providerOptions?:
|
|
7113
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7609
7114
|
} | {
|
|
7610
7115
|
/**
|
|
7611
7116
|
* Images that are referenced using base64 encoded data.
|
|
@@ -7623,7 +7128,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7623
7128
|
/**
|
|
7624
7129
|
* Provider-specific options.
|
|
7625
7130
|
*/
|
|
7626
|
-
providerOptions?:
|
|
7131
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7627
7132
|
} | {
|
|
7628
7133
|
/**
|
|
7629
7134
|
* Images that are referenced using a URL.
|
|
@@ -7636,7 +7141,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7636
7141
|
/**
|
|
7637
7142
|
* Provider-specific options.
|
|
7638
7143
|
*/
|
|
7639
|
-
providerOptions?:
|
|
7144
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7640
7145
|
} | {
|
|
7641
7146
|
/**
|
|
7642
7147
|
* Images that are referenced using a provider file id.
|
|
@@ -7654,7 +7159,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7654
7159
|
/**
|
|
7655
7160
|
* Provider-specific options.
|
|
7656
7161
|
*/
|
|
7657
|
-
providerOptions?:
|
|
7162
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7658
7163
|
} | {
|
|
7659
7164
|
/**
|
|
7660
7165
|
* Custom content part. This can be used to implement
|
|
@@ -7664,7 +7169,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7664
7169
|
/**
|
|
7665
7170
|
* Provider-specific options.
|
|
7666
7171
|
*/
|
|
7667
|
-
providerOptions?:
|
|
7172
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7668
7173
|
}>;
|
|
7669
7174
|
};
|
|
7670
7175
|
|
|
@@ -7693,31 +7198,6 @@ declare interface LanguageModelV3ToolResultPart {
|
|
|
7693
7198
|
providerOptions?: SharedV3ProviderOptions;
|
|
7694
7199
|
}
|
|
7695
7200
|
|
|
7696
|
-
/**
|
|
7697
|
-
* Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
7698
|
-
*/
|
|
7699
|
-
declare interface LanguageModelV3ToolResultPart_2 {
|
|
7700
|
-
type: 'tool-result';
|
|
7701
|
-
/**
|
|
7702
|
-
* ID of the tool call that this result is associated with.
|
|
7703
|
-
*/
|
|
7704
|
-
toolCallId: string;
|
|
7705
|
-
/**
|
|
7706
|
-
* Name of the tool that generated this result.
|
|
7707
|
-
*/
|
|
7708
|
-
toolName: string;
|
|
7709
|
-
/**
|
|
7710
|
-
* Result of the tool call.
|
|
7711
|
-
*/
|
|
7712
|
-
output: LanguageModelV3ToolResultOutput_2;
|
|
7713
|
-
/**
|
|
7714
|
-
* Additional provider-specific options. They are passed through
|
|
7715
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
7716
|
-
* functionality that can be fully encapsulated in the provider.
|
|
7717
|
-
*/
|
|
7718
|
-
providerOptions?: SharedV3ProviderOptions_2;
|
|
7719
|
-
}
|
|
7720
|
-
|
|
7721
7201
|
/**
|
|
7722
7202
|
* Usage information for a language model call.
|
|
7723
7203
|
*/
|
|
@@ -7769,57 +7249,6 @@ declare type LanguageModelV3Usage = {
|
|
|
7769
7249
|
raw?: JSONObject;
|
|
7770
7250
|
};
|
|
7771
7251
|
|
|
7772
|
-
/**
|
|
7773
|
-
* Usage information for a language model call.
|
|
7774
|
-
*/
|
|
7775
|
-
declare type LanguageModelV3Usage_2 = {
|
|
7776
|
-
/**
|
|
7777
|
-
* Information about the input tokens.
|
|
7778
|
-
*/
|
|
7779
|
-
inputTokens: {
|
|
7780
|
-
/**
|
|
7781
|
-
* The total number of input (prompt) tokens used.
|
|
7782
|
-
*/
|
|
7783
|
-
total: number | undefined;
|
|
7784
|
-
/**
|
|
7785
|
-
* The number of non-cached input (prompt) tokens used.
|
|
7786
|
-
*/
|
|
7787
|
-
noCache: number | undefined;
|
|
7788
|
-
/**
|
|
7789
|
-
* The number of cached input (prompt) tokens read.
|
|
7790
|
-
*/
|
|
7791
|
-
cacheRead: number | undefined;
|
|
7792
|
-
/**
|
|
7793
|
-
* The number of cached input (prompt) tokens written.
|
|
7794
|
-
*/
|
|
7795
|
-
cacheWrite: number | undefined;
|
|
7796
|
-
};
|
|
7797
|
-
/**
|
|
7798
|
-
* Information about the output tokens.
|
|
7799
|
-
*/
|
|
7800
|
-
outputTokens: {
|
|
7801
|
-
/**
|
|
7802
|
-
* The total number of output (completion) tokens used.
|
|
7803
|
-
*/
|
|
7804
|
-
total: number | undefined;
|
|
7805
|
-
/**
|
|
7806
|
-
* The number of text tokens used.
|
|
7807
|
-
*/
|
|
7808
|
-
text: number | undefined;
|
|
7809
|
-
/**
|
|
7810
|
-
* The number of reasoning tokens used.
|
|
7811
|
-
*/
|
|
7812
|
-
reasoning: number | undefined;
|
|
7813
|
-
};
|
|
7814
|
-
/**
|
|
7815
|
-
* Raw usage information from the provider.
|
|
7816
|
-
*
|
|
7817
|
-
* This is the usage information in the shape that the provider returns.
|
|
7818
|
-
* It can include additional information that is not part of the standard usage information.
|
|
7819
|
-
*/
|
|
7820
|
-
raw?: JSONObject_2;
|
|
7821
|
-
};
|
|
7822
|
-
|
|
7823
7252
|
/**
|
|
7824
7253
|
* Check if the last message is an assistant message with completed tool call approvals.
|
|
7825
7254
|
* The last step of the message must have at least one tool approval response and
|
|
@@ -7832,7 +7261,9 @@ export declare function lastAssistantMessageIsCompleteWithApprovalResponses({ me
|
|
|
7832
7261
|
/**
|
|
7833
7262
|
* Check if the last message is an assistant message with completed tool calls.
|
|
7834
7263
|
* The last step of the message must have at least one tool invocation and
|
|
7835
|
-
* all tool invocations must have a result.
|
|
7264
|
+
* all tool invocations must have a result. Completed model text may follow
|
|
7265
|
+
* the tool invocation because client-side tool results update parts in place,
|
|
7266
|
+
* but trailing text without a completed stream state prevents resubmission.
|
|
7836
7267
|
*/
|
|
7837
7268
|
export declare function lastAssistantMessageIsCompleteWithToolCalls({ messages, }: {
|
|
7838
7269
|
messages: UIMessage[];
|
|
@@ -7985,7 +7416,7 @@ export declare class MessageConversionError extends AISDKError {
|
|
|
7985
7416
|
}
|
|
7986
7417
|
|
|
7987
7418
|
export declare class MissingToolResultsError extends AISDKError {
|
|
7988
|
-
private readonly [symbol$
|
|
7419
|
+
private readonly [symbol$e];
|
|
7989
7420
|
readonly toolCallIds: string[];
|
|
7990
7421
|
constructor({ toolCallIds }: {
|
|
7991
7422
|
toolCallIds: string[];
|
|
@@ -8021,7 +7452,7 @@ export declare class NoContentGeneratedError extends AISDKError {
|
|
|
8021
7452
|
* - The model generated a response that could not be parsed.
|
|
8022
7453
|
*/
|
|
8023
7454
|
export declare class NoImageGeneratedError extends AISDKError {
|
|
8024
|
-
private readonly [symbol$
|
|
7455
|
+
private readonly [symbol$d_2];
|
|
8025
7456
|
/**
|
|
8026
7457
|
* The response metadata for each call.
|
|
8027
7458
|
*/
|
|
@@ -8046,7 +7477,7 @@ export declare class NoImageGeneratedError extends AISDKError {
|
|
|
8046
7477
|
* - `text`: The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
8047
7478
|
*/
|
|
8048
7479
|
export declare class NoObjectGeneratedError extends AISDKError {
|
|
8049
|
-
private readonly [symbol$
|
|
7480
|
+
private readonly [symbol$c_2];
|
|
8050
7481
|
/**
|
|
8051
7482
|
* The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
8052
7483
|
*/
|
|
@@ -8078,7 +7509,7 @@ export declare class NoObjectGeneratedError extends AISDKError {
|
|
|
8078
7509
|
* Thrown when no LLM output was generated, e.g. because of errors.
|
|
8079
7510
|
*/
|
|
8080
7511
|
export declare class NoOutputGeneratedError extends AISDKError {
|
|
8081
|
-
private readonly [symbol$
|
|
7512
|
+
private readonly [symbol$b_2];
|
|
8082
7513
|
constructor({ message, cause, }?: {
|
|
8083
7514
|
message?: string;
|
|
8084
7515
|
cause?: Error;
|
|
@@ -8099,7 +7530,7 @@ declare function normalizeHeaders(headers: HeadersInit | Record<string, string |
|
|
|
8099
7530
|
* Error that is thrown when no speech audio was generated.
|
|
8100
7531
|
*/
|
|
8101
7532
|
export declare class NoSpeechGeneratedError extends AISDKError {
|
|
8102
|
-
private readonly [symbol$
|
|
7533
|
+
private readonly [symbol$a];
|
|
8103
7534
|
readonly responses: Array<SpeechModelResponseMetadata>;
|
|
8104
7535
|
constructor(options: {
|
|
8105
7536
|
responses: Array<SpeechModelResponseMetadata>;
|
|
@@ -8135,7 +7566,7 @@ export declare class NoSuchProviderError extends NoSuchModelError {
|
|
|
8135
7566
|
}
|
|
8136
7567
|
|
|
8137
7568
|
export declare class NoSuchToolError extends AISDKError {
|
|
8138
|
-
private readonly [symbol$
|
|
7569
|
+
private readonly [symbol$k];
|
|
8139
7570
|
readonly toolName: string;
|
|
8140
7571
|
readonly availableTools: string[] | undefined;
|
|
8141
7572
|
constructor({ toolName, availableTools, message, }: {
|
|
@@ -8150,7 +7581,7 @@ export declare class NoSuchToolError extends AISDKError {
|
|
|
8150
7581
|
* Error that is thrown when no transcript was generated.
|
|
8151
7582
|
*/
|
|
8152
7583
|
export declare class NoTranscriptGeneratedError extends AISDKError {
|
|
8153
|
-
private readonly [symbol$
|
|
7584
|
+
private readonly [symbol$9_2];
|
|
8154
7585
|
readonly responses: Array<TranscriptionModelResponseMetadata>;
|
|
8155
7586
|
constructor(options: {
|
|
8156
7587
|
responses: Array<TranscriptionModelResponseMetadata>;
|
|
@@ -8159,7 +7590,7 @@ export declare class NoTranscriptGeneratedError extends AISDKError {
|
|
|
8159
7590
|
}
|
|
8160
7591
|
|
|
8161
7592
|
export declare class NoVideoGeneratedError extends AISDKError {
|
|
8162
|
-
private readonly [symbol$
|
|
7593
|
+
private readonly [symbol$8_2];
|
|
8163
7594
|
readonly responses: Array<VideoModelResponseMetadata>;
|
|
8164
7595
|
constructor({ message, cause, responses, }: {
|
|
8165
7596
|
message?: string;
|
|
@@ -8230,7 +7661,7 @@ export declare type OnFinishEvent<TOOLS extends ToolSet = ToolSet> = StepResult<
|
|
|
8230
7661
|
*
|
|
8231
7662
|
* Called when the generation operation begins, before any LLM calls.
|
|
8232
7663
|
*/
|
|
8233
|
-
export declare interface OnStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends
|
|
7664
|
+
export declare interface OnStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface, INCLUDE = {
|
|
8234
7665
|
requestBody?: boolean;
|
|
8235
7666
|
responseBody?: boolean;
|
|
8236
7667
|
}> {
|
|
@@ -8313,7 +7744,7 @@ export declare type OnStepFinishEvent<TOOLS extends ToolSet = ToolSet> = StepRes
|
|
|
8313
7744
|
* Called when a step (LLM call) begins, before the provider is called.
|
|
8314
7745
|
* Each step represents a single LLM invocation.
|
|
8315
7746
|
*/
|
|
8316
|
-
export declare interface OnStepStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends
|
|
7747
|
+
export declare interface OnStepStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface, INCLUDE = {
|
|
8317
7748
|
requestBody?: boolean;
|
|
8318
7749
|
responseBody?: boolean;
|
|
8319
7750
|
}> {
|
|
@@ -8445,7 +7876,7 @@ export declare namespace Output {
|
|
|
8445
7876
|
};
|
|
8446
7877
|
}
|
|
8447
7878
|
|
|
8448
|
-
declare interface
|
|
7879
|
+
export declare interface OutputInterface<OUTPUT = any, PARTIAL = any, ELEMENT = any> {
|
|
8449
7880
|
/**
|
|
8450
7881
|
* The name of the output mode.
|
|
8451
7882
|
*/
|
|
@@ -8629,7 +8060,7 @@ declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFact
|
|
|
8629
8060
|
declare function parseJSON(options: {
|
|
8630
8061
|
text: string;
|
|
8631
8062
|
schema?: undefined;
|
|
8632
|
-
}): Promise<
|
|
8063
|
+
}): Promise<JSONValue_2>;
|
|
8633
8064
|
|
|
8634
8065
|
/**
|
|
8635
8066
|
* Parses a JSON string into a strongly-typed object using the provided schema.
|
|
@@ -8669,7 +8100,7 @@ declare type ParseResult<T> = {
|
|
|
8669
8100
|
rawValue: unknown;
|
|
8670
8101
|
} | {
|
|
8671
8102
|
success: false;
|
|
8672
|
-
error:
|
|
8103
|
+
error: JSONParseError | TypeValidationError;
|
|
8673
8104
|
rawValue: unknown;
|
|
8674
8105
|
};
|
|
8675
8106
|
|
|
@@ -8824,7 +8255,7 @@ declare const perplexitySearchToolFactory: _ai_sdk_provider_utils.ProviderToolFa
|
|
|
8824
8255
|
*
|
|
8825
8256
|
* @param response - The Node.js ServerResponse object to pipe to.
|
|
8826
8257
|
* @param agent - The agent to run.
|
|
8827
|
-
* @param uiMessages - The input UI messages.
|
|
8258
|
+
* @param uiMessages - The input UI messages. Defaults to originalMessages.
|
|
8828
8259
|
* @param abortSignal - Abort signal. Optional.
|
|
8829
8260
|
* @param timeout - Timeout in milliseconds. Optional.
|
|
8830
8261
|
* @param options - The options for the agent. Optional.
|
|
@@ -8833,12 +8264,13 @@ declare const perplexitySearchToolFactory: _ai_sdk_provider_utils.ProviderToolFa
|
|
|
8833
8264
|
* @param headers - Additional headers for the response. Optional.
|
|
8834
8265
|
* @param status - The status code for the response. Optional.
|
|
8835
8266
|
* @param statusText - The status text for the response. Optional.
|
|
8267
|
+
* @param keepAliveMs - Optional interval for sending SSE keep-alive comments.
|
|
8836
8268
|
* @param consumeSseStream - Whether to consume the SSE stream. Optional.
|
|
8837
8269
|
*/
|
|
8838
|
-
export declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends
|
|
8270
|
+
export declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends OutputInterface = never, MESSAGE_METADATA = unknown>({ response, headers, status, statusText, keepAliveMs, consumeSseStream, ...options }: {
|
|
8839
8271
|
response: ServerResponse;
|
|
8840
8272
|
agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
|
|
8841
|
-
uiMessages
|
|
8273
|
+
uiMessages?: unknown[];
|
|
8842
8274
|
abortSignal?: AbortSignal;
|
|
8843
8275
|
timeout?: TimeoutConfiguration;
|
|
8844
8276
|
options?: CALL_OPTIONS;
|
|
@@ -8873,10 +8305,11 @@ export declare function pipeTextStreamToResponse({ response, status, statusText,
|
|
|
8873
8305
|
* @param options.statusText - The HTTP status text for the response.
|
|
8874
8306
|
* @param options.headers - Additional HTTP headers to include in the response.
|
|
8875
8307
|
* @param options.stream - The UI message chunk stream to send.
|
|
8308
|
+
* @param options.keepAliveMs - Optional interval for sending SSE keep-alive comments.
|
|
8876
8309
|
* @param options.consumeSseStream - Optional callback to consume a copy of the SSE stream independently.
|
|
8877
8310
|
* @returns A promise that resolves when the stream has been written.
|
|
8878
8311
|
*/
|
|
8879
|
-
export declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, consumeSseStream, }: {
|
|
8312
|
+
export declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, keepAliveMs, consumeSseStream, }: {
|
|
8880
8313
|
response: ServerResponse;
|
|
8881
8314
|
stream: ReadableStream<UIMessageChunk>;
|
|
8882
8315
|
} & UIMessageStreamResponseInit): Promise<void>;
|
|
@@ -8885,7 +8318,7 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
|
|
|
8885
8318
|
url: string;
|
|
8886
8319
|
headers?: Record<string, string | undefined>;
|
|
8887
8320
|
formData: FormData;
|
|
8888
|
-
failedResponseHandler: ResponseHandler<
|
|
8321
|
+
failedResponseHandler: ResponseHandler<APICallError>;
|
|
8889
8322
|
successfulResponseHandler: ResponseHandler<T>;
|
|
8890
8323
|
abortSignal?: AbortSignal;
|
|
8891
8324
|
fetch?: FetchFunction;
|
|
@@ -8899,7 +8332,7 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
|
|
|
8899
8332
|
url: string;
|
|
8900
8333
|
headers?: Record<string, string | undefined>;
|
|
8901
8334
|
body: unknown;
|
|
8902
|
-
failedResponseHandler: ResponseHandler<
|
|
8335
|
+
failedResponseHandler: ResponseHandler<APICallError>;
|
|
8903
8336
|
successfulResponseHandler: ResponseHandler<T>;
|
|
8904
8337
|
abortSignal?: AbortSignal;
|
|
8905
8338
|
fetch?: FetchFunction;
|
|
@@ -9142,7 +8575,7 @@ export declare type Provider = {
|
|
|
9142
8575
|
*
|
|
9143
8576
|
* @throws {NoSuchModelError} If no such model exists.
|
|
9144
8577
|
*/
|
|
9145
|
-
rerankingModel(modelId: string): RerankingModel;
|
|
8578
|
+
rerankingModel?(modelId: string): RerankingModel;
|
|
9146
8579
|
};
|
|
9147
8580
|
|
|
9148
8581
|
/**
|
|
@@ -9159,7 +8592,7 @@ export declare type ProviderMetadata = SharedV3ProviderMetadata;
|
|
|
9159
8592
|
* They are passed through to the provider from the AI SDK and enable
|
|
9160
8593
|
* provider-specific functionality that can be fully encapsulated in the provider.
|
|
9161
8594
|
*/
|
|
9162
|
-
declare type ProviderOptions =
|
|
8595
|
+
declare type ProviderOptions = SharedV3ProviderOptions;
|
|
9163
8596
|
|
|
9164
8597
|
export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV3> = Record<string, ProviderV3>, SEPARATOR extends string = ':'> {
|
|
9165
8598
|
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV3;
|
|
@@ -9425,6 +8858,10 @@ declare interface ReasoningPart {
|
|
|
9425
8858
|
*/
|
|
9426
8859
|
export declare type ReasoningUIPart = {
|
|
9427
8860
|
type: 'reasoning';
|
|
8861
|
+
/**
|
|
8862
|
+
* The reasoning part ID.
|
|
8863
|
+
*/
|
|
8864
|
+
id?: string;
|
|
9428
8865
|
/**
|
|
9429
8866
|
* The reasoning text.
|
|
9430
8867
|
*/
|
|
@@ -9727,7 +9164,7 @@ declare type RetryDelayProvider = ({ error, exponentialBackoffDelay, }: {
|
|
|
9727
9164
|
}) => number;
|
|
9728
9165
|
|
|
9729
9166
|
export declare class RetryError extends AISDKError {
|
|
9730
|
-
private readonly [symbol$
|
|
9167
|
+
private readonly [symbol$1_2];
|
|
9731
9168
|
readonly reason: RetryErrorReason_2;
|
|
9732
9169
|
readonly lastError: unknown;
|
|
9733
9170
|
readonly errors: Array<unknown>;
|
|
@@ -9773,7 +9210,7 @@ declare const retryWithExponentialBackoff: ({ maxRetries, initialDelayInMs, back
|
|
|
9773
9210
|
declare function safeParseJSON(options: {
|
|
9774
9211
|
text: string;
|
|
9775
9212
|
schema?: undefined;
|
|
9776
|
-
}): Promise<ParseResult<
|
|
9213
|
+
}): Promise<ParseResult<JSONValue_2>>;
|
|
9777
9214
|
|
|
9778
9215
|
/**
|
|
9779
9216
|
* Safely parses a JSON string into a strongly-typed object, using a provided schema to validate the object.
|
|
@@ -9801,32 +9238,23 @@ declare function safeParseJSON<T>(options: {
|
|
|
9801
9238
|
declare function safeValidateTypes<OBJECT>({ value, schema, context, }: {
|
|
9802
9239
|
value: unknown;
|
|
9803
9240
|
schema: FlexibleSchema<OBJECT>;
|
|
9804
|
-
context?:
|
|
9241
|
+
context?: TypeValidationContext;
|
|
9805
9242
|
}): Promise<{
|
|
9806
9243
|
success: true;
|
|
9807
9244
|
value: OBJECT;
|
|
9808
9245
|
rawValue: unknown;
|
|
9809
9246
|
} | {
|
|
9810
9247
|
success: false;
|
|
9811
|
-
error:
|
|
9248
|
+
error: TypeValidationError;
|
|
9812
9249
|
rawValue: unknown;
|
|
9813
|
-
}>;
|
|
9814
|
-
|
|
9815
|
-
/**
|
|
9816
|
-
* Validates a list of UI messages like `validateUIMessages`,
|
|
9817
|
-
* but instead of throwing it returns `{ success: true, data }`
|
|
9818
|
-
* or `{ success: false, error }`.
|
|
9819
|
-
*/
|
|
9820
|
-
export declare function safeValidateUIMessages<UI_MESSAGE extends UIMessage>(
|
|
9821
|
-
messages: unknown;
|
|
9822
|
-
metadataSchema?: FlexibleSchema<UIMessage['metadata']>;
|
|
9823
|
-
dataSchemas?: {
|
|
9824
|
-
[NAME in keyof InferUIMessageData<UI_MESSAGE> & string]?: FlexibleSchema<InferUIMessageData<UI_MESSAGE>[NAME]>;
|
|
9825
|
-
};
|
|
9826
|
-
tools?: {
|
|
9827
|
-
[NAME in keyof InferUIMessageTools<UI_MESSAGE> & string]?: Tool<InferUIMessageTools<UI_MESSAGE>[NAME]['input'], InferUIMessageTools<UI_MESSAGE>[NAME]['output']>;
|
|
9828
|
-
};
|
|
9829
|
-
}): Promise<SafeValidateUIMessagesResult<UI_MESSAGE>>;
|
|
9250
|
+
}>;
|
|
9251
|
+
|
|
9252
|
+
/**
|
|
9253
|
+
* Validates a list of UI messages like `validateUIMessages`,
|
|
9254
|
+
* but instead of throwing it returns `{ success: true, data }`
|
|
9255
|
+
* or `{ success: false, error }`.
|
|
9256
|
+
*/
|
|
9257
|
+
export declare function safeValidateUIMessages<UI_MESSAGE extends UIMessage>(options: ValidateUIMessagesOptions<UI_MESSAGE>): Promise<SafeValidateUIMessagesResult<UI_MESSAGE>>;
|
|
9830
9258
|
|
|
9831
9259
|
export declare type SafeValidateUIMessagesResult<UI_MESSAGE extends UIMessage> = {
|
|
9832
9260
|
success: true;
|
|
@@ -9866,8 +9294,10 @@ declare function secureJsonParse(text: string): any;
|
|
|
9866
9294
|
export declare class SerialJobExecutor {
|
|
9867
9295
|
private queue;
|
|
9868
9296
|
private isProcessing;
|
|
9297
|
+
private idleWaiters;
|
|
9869
9298
|
private processQueue;
|
|
9870
9299
|
run(job: Job): Promise<void>;
|
|
9300
|
+
waitForIdle(): Promise<void>;
|
|
9871
9301
|
}
|
|
9872
9302
|
|
|
9873
9303
|
declare type SharedV2Headers = Record<string, string>;
|
|
@@ -9943,29 +9373,6 @@ declare type SharedV3Headers = Record<string, string>;
|
|
|
9943
9373
|
*/
|
|
9944
9374
|
declare type SharedV3ProviderMetadata = Record<string, JSONObject>;
|
|
9945
9375
|
|
|
9946
|
-
/**
|
|
9947
|
-
* Additional provider-specific metadata.
|
|
9948
|
-
* Metadata are additional outputs from the provider.
|
|
9949
|
-
* They are passed through to the provider from the AI SDK
|
|
9950
|
-
* and enable provider-specific functionality
|
|
9951
|
-
* that can be fully encapsulated in the provider.
|
|
9952
|
-
*
|
|
9953
|
-
* This enables us to quickly ship provider-specific functionality
|
|
9954
|
-
* without affecting the core AI SDK.
|
|
9955
|
-
*
|
|
9956
|
-
* The outer record is keyed by the provider name, and the inner
|
|
9957
|
-
* record is keyed by the provider-specific metadata key.
|
|
9958
|
-
*
|
|
9959
|
-
* ```ts
|
|
9960
|
-
* {
|
|
9961
|
-
* "anthropic": {
|
|
9962
|
-
* "cacheControl": { "type": "ephemeral" }
|
|
9963
|
-
* }
|
|
9964
|
-
* }
|
|
9965
|
-
* ```
|
|
9966
|
-
*/
|
|
9967
|
-
declare type SharedV3ProviderMetadata_2 = Record<string, JSONObject_2>;
|
|
9968
|
-
|
|
9969
9376
|
/**
|
|
9970
9377
|
* Additional provider-specific options.
|
|
9971
9378
|
* Options are additional input to the provider.
|
|
@@ -9989,29 +9396,6 @@ declare type SharedV3ProviderMetadata_2 = Record<string, JSONObject_2>;
|
|
|
9989
9396
|
*/
|
|
9990
9397
|
declare type SharedV3ProviderOptions = Record<string, JSONObject>;
|
|
9991
9398
|
|
|
9992
|
-
/**
|
|
9993
|
-
* Additional provider-specific options.
|
|
9994
|
-
* Options are additional input to the provider.
|
|
9995
|
-
* They are passed through to the provider from the AI SDK
|
|
9996
|
-
* and enable provider-specific functionality
|
|
9997
|
-
* that can be fully encapsulated in the provider.
|
|
9998
|
-
*
|
|
9999
|
-
* This enables us to quickly ship provider-specific functionality
|
|
10000
|
-
* without affecting the core AI SDK.
|
|
10001
|
-
*
|
|
10002
|
-
* The outer record is keyed by the provider name, and the inner
|
|
10003
|
-
* record is keyed by the provider-specific metadata key.
|
|
10004
|
-
*
|
|
10005
|
-
* ```ts
|
|
10006
|
-
* {
|
|
10007
|
-
* "anthropic": {
|
|
10008
|
-
* "cacheControl": { "type": "ephemeral" }
|
|
10009
|
-
* }
|
|
10010
|
-
* }
|
|
10011
|
-
* ```
|
|
10012
|
-
*/
|
|
10013
|
-
declare type SharedV3ProviderOptions_2 = Record<string, JSONObject_2>;
|
|
10014
|
-
|
|
10015
9399
|
/**
|
|
10016
9400
|
* Warning from the model.
|
|
10017
9401
|
*
|
|
@@ -10055,49 +9439,6 @@ declare type SharedV3Warning = {
|
|
|
10055
9439
|
message: string;
|
|
10056
9440
|
};
|
|
10057
9441
|
|
|
10058
|
-
/**
|
|
10059
|
-
* Warning from the model.
|
|
10060
|
-
*
|
|
10061
|
-
* For example, that certain features are unsupported or compatibility
|
|
10062
|
-
* functionality is used (which might lead to suboptimal results).
|
|
10063
|
-
*/
|
|
10064
|
-
declare type SharedV3Warning_2 = {
|
|
10065
|
-
/**
|
|
10066
|
-
* A feature is not supported by the model.
|
|
10067
|
-
*/
|
|
10068
|
-
type: 'unsupported';
|
|
10069
|
-
/**
|
|
10070
|
-
* The feature that is not supported.
|
|
10071
|
-
*/
|
|
10072
|
-
feature: string;
|
|
10073
|
-
/**
|
|
10074
|
-
* Additional details about the warning.
|
|
10075
|
-
*/
|
|
10076
|
-
details?: string;
|
|
10077
|
-
} | {
|
|
10078
|
-
/**
|
|
10079
|
-
* A compatibility feature is used that might lead to suboptimal results.
|
|
10080
|
-
*/
|
|
10081
|
-
type: 'compatibility';
|
|
10082
|
-
/**
|
|
10083
|
-
* The feature that is used in a compatibility mode.
|
|
10084
|
-
*/
|
|
10085
|
-
feature: string;
|
|
10086
|
-
/**
|
|
10087
|
-
* Additional details about the warning.
|
|
10088
|
-
*/
|
|
10089
|
-
details?: string;
|
|
10090
|
-
} | {
|
|
10091
|
-
/**
|
|
10092
|
-
* Other warning.
|
|
10093
|
-
*/
|
|
10094
|
-
type: 'other';
|
|
10095
|
-
/**
|
|
10096
|
-
* The message of the warning.
|
|
10097
|
-
*/
|
|
10098
|
-
message: string;
|
|
10099
|
-
};
|
|
10100
|
-
|
|
10101
9442
|
declare type ShouldRetryFunction = (error: unknown) => boolean | Promise<boolean>;
|
|
10102
9443
|
|
|
10103
9444
|
/**
|
|
@@ -10202,7 +9543,7 @@ declare type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
10202
9543
|
/**
|
|
10203
9544
|
* Smooths text and reasoning streaming output.
|
|
10204
9545
|
*
|
|
10205
|
-
* @param delayInMs - The delay in milliseconds between each chunk. Defaults to 10ms. Can be set to `null` to skip the delay.
|
|
9546
|
+
* @param delayInMs - The delay in milliseconds between each chunk. Defaults to 10ms. Can be set to `null` to skip the delay. The delay is skipped while the document is hidden (e.g. browser background tabs), where timer throttling would otherwise stall the stream.
|
|
10206
9547
|
* @param chunking - Controls how the text is chunked for streaming. Use "word" to stream word by word (default), "line" to stream line by line, provide a custom RegExp pattern for custom chunking, provide an Intl.Segmenter for locale-aware word segmentation (recommended for CJK languages), or provide a custom ChunkDetector function.
|
|
10207
9548
|
*
|
|
10208
9549
|
* @returns A transform stream that smooths text streaming output.
|
|
@@ -11178,7 +10519,7 @@ declare class StreamingToolCallTracker<DELTA extends StreamingToolCallDelta = St
|
|
|
11178
10519
|
private finishToolCall;
|
|
11179
10520
|
}
|
|
11180
10521
|
|
|
11181
|
-
declare type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<
|
|
10522
|
+
declare type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<LanguageModelV3StreamPart>, 'enqueue'>;
|
|
11182
10523
|
|
|
11183
10524
|
declare interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCallDelta = StreamingToolCallDelta> {
|
|
11184
10525
|
/**
|
|
@@ -11198,11 +10539,11 @@ declare interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCal
|
|
|
11198
10539
|
* Extract provider-specific metadata from a tool call delta.
|
|
11199
10540
|
* Called once when a new tool call is detected.
|
|
11200
10541
|
*/
|
|
11201
|
-
extractMetadata?: (delta: DELTA) =>
|
|
10542
|
+
extractMetadata?: (delta: DELTA) => SharedV3ProviderMetadata | undefined;
|
|
11202
10543
|
/**
|
|
11203
10544
|
* Build the `providerMetadata` object for a `tool-call` event.
|
|
11204
10545
|
*/
|
|
11205
|
-
buildToolCallProviderMetadata?: (metadata:
|
|
10546
|
+
buildToolCallProviderMetadata?: (metadata: SharedV3ProviderMetadata | undefined) => SharedV3ProviderMetadata | undefined;
|
|
11206
10547
|
}
|
|
11207
10548
|
|
|
11208
10549
|
/**
|
|
@@ -11535,7 +10876,7 @@ declare interface StreamOptions {
|
|
|
11535
10876
|
* @returns
|
|
11536
10877
|
* A result object for accessing different stream types and additional information.
|
|
11537
10878
|
*/
|
|
11538
|
-
export declare function streamText<TOOLS extends ToolSet, OUTPUT extends
|
|
10879
|
+
export declare function streamText<TOOLS extends ToolSet, OUTPUT extends OutputInterface = OutputInterface<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_toolApprovalSecret, experimental_include: include, _internal: { now, generateId }, ...settings }: CallSettings & Prompt & {
|
|
11539
10880
|
/**
|
|
11540
10881
|
* The language model to use.
|
|
11541
10882
|
*/
|
|
@@ -11636,7 +10977,7 @@ export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_
|
|
|
11636
10977
|
*
|
|
11637
10978
|
* The usage is the combined usage of all steps.
|
|
11638
10979
|
*/
|
|
11639
|
-
onFinish?: StreamTextOnFinishCallback<TOOLS
|
|
10980
|
+
onFinish?: StreamTextOnFinishCallback<NoInfer<TOOLS>, NoInfer<OUTPUT>>;
|
|
11640
10981
|
onAbort?: StreamTextOnAbortCallback<TOOLS>;
|
|
11641
10982
|
/**
|
|
11642
10983
|
* Callback that is called when each step (LLM call) is finished, including intermediate steps.
|
|
@@ -11700,6 +11041,14 @@ export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_
|
|
|
11700
11041
|
};
|
|
11701
11042
|
}): StreamTextResult<TOOLS, OUTPUT>;
|
|
11702
11043
|
|
|
11044
|
+
export declare type StreamTextEndEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface> = OnFinishEvent<TOOLS> & {
|
|
11045
|
+
/**
|
|
11046
|
+
* The parsed output when an output setting was provided and parsing
|
|
11047
|
+
* succeeded.
|
|
11048
|
+
*/
|
|
11049
|
+
readonly output?: InferGenerateOutput<OUTPUT>;
|
|
11050
|
+
};
|
|
11051
|
+
|
|
11703
11052
|
/**
|
|
11704
11053
|
* Include settings for streamText (requestBody only).
|
|
11705
11054
|
*/
|
|
@@ -11730,6 +11079,8 @@ export declare type StreamTextOnChunkCallback<TOOLS extends ToolSet> = (event: {
|
|
|
11730
11079
|
}>;
|
|
11731
11080
|
}) => PromiseLike<void> | void;
|
|
11732
11081
|
|
|
11082
|
+
export declare type StreamTextOnEndCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface> = (event: StreamTextEndEvent<TOOLS, OUTPUT>) => PromiseLike<void> | void;
|
|
11083
|
+
|
|
11733
11084
|
/**
|
|
11734
11085
|
* Callback that is set using the `onError` option.
|
|
11735
11086
|
*
|
|
@@ -11744,7 +11095,7 @@ export declare type StreamTextOnErrorCallback = (event: {
|
|
|
11744
11095
|
*
|
|
11745
11096
|
* @param event - The event that is passed to the callback.
|
|
11746
11097
|
*/
|
|
11747
|
-
export declare type StreamTextOnFinishCallback<TOOLS extends ToolSet
|
|
11098
|
+
export declare type StreamTextOnFinishCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface> = StreamTextOnEndCallback<TOOLS, OUTPUT>;
|
|
11748
11099
|
|
|
11749
11100
|
/**
|
|
11750
11101
|
* Callback that is set using the `experimental_onStart` option.
|
|
@@ -11755,7 +11106,7 @@ export declare type StreamTextOnFinishCallback<TOOLS extends ToolSet> = (event:
|
|
|
11755
11106
|
*
|
|
11756
11107
|
* @param event - The event object containing generation configuration.
|
|
11757
11108
|
*/
|
|
11758
|
-
export declare type StreamTextOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends
|
|
11109
|
+
export declare type StreamTextOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface> = (event: OnStartEvent<TOOLS, OUTPUT, StreamTextIncludeSettings>) => PromiseLike<void> | void;
|
|
11759
11110
|
|
|
11760
11111
|
/**
|
|
11761
11112
|
* Callback that is set using the `onStepFinish` option.
|
|
@@ -11773,7 +11124,7 @@ export declare type StreamTextOnStepFinishCallback<TOOLS extends ToolSet> = (eve
|
|
|
11773
11124
|
*
|
|
11774
11125
|
* @param event - The event object containing step configuration.
|
|
11775
11126
|
*/
|
|
11776
|
-
export declare type StreamTextOnStepStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends
|
|
11127
|
+
export declare type StreamTextOnStepStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface> = (event: OnStepStartEvent<TOOLS, OUTPUT, StreamTextIncludeSettings>) => PromiseLike<void> | void;
|
|
11777
11128
|
|
|
11778
11129
|
export declare type StreamTextOnToolCallFinishCallback<TOOLS extends ToolSet = ToolSet> = (event: OnToolCallFinishEvent<TOOLS>) => PromiseLike<void> | void;
|
|
11779
11130
|
|
|
@@ -11782,7 +11133,7 @@ export declare type StreamTextOnToolCallStartCallback<TOOLS extends ToolSet = To
|
|
|
11782
11133
|
/**
|
|
11783
11134
|
* A result object for accessing different stream types and additional information.
|
|
11784
11135
|
*/
|
|
11785
|
-
export declare interface StreamTextResult<TOOLS extends ToolSet, OUTPUT extends
|
|
11136
|
+
export declare interface StreamTextResult<TOOLS extends ToolSet, OUTPUT extends OutputInterface> {
|
|
11786
11137
|
/**
|
|
11787
11138
|
* The content that was generated in the last step.
|
|
11788
11139
|
*
|
|
@@ -12023,8 +11374,6 @@ declare const symbol$1: unique symbol;
|
|
|
12023
11374
|
|
|
12024
11375
|
declare const symbol$1_2: unique symbol;
|
|
12025
11376
|
|
|
12026
|
-
declare const symbol$1_3: unique symbol;
|
|
12027
|
-
|
|
12028
11377
|
declare const symbol$2: unique symbol;
|
|
12029
11378
|
|
|
12030
11379
|
declare const symbol$2_2: unique symbol;
|
|
@@ -12049,8 +11398,6 @@ declare const symbol$7: unique symbol;
|
|
|
12049
11398
|
|
|
12050
11399
|
declare const symbol$7_2: unique symbol;
|
|
12051
11400
|
|
|
12052
|
-
declare const symbol$7_3: unique symbol;
|
|
12053
|
-
|
|
12054
11401
|
declare const symbol$8: unique symbol;
|
|
12055
11402
|
|
|
12056
11403
|
declare const symbol$8_2: unique symbol;
|
|
@@ -12069,14 +11416,10 @@ declare const symbol$c: unique symbol;
|
|
|
12069
11416
|
|
|
12070
11417
|
declare const symbol$c_2: unique symbol;
|
|
12071
11418
|
|
|
12072
|
-
declare const symbol$c_3: unique symbol;
|
|
12073
|
-
|
|
12074
11419
|
declare const symbol$d: unique symbol;
|
|
12075
11420
|
|
|
12076
11421
|
declare const symbol$d_2: unique symbol;
|
|
12077
11422
|
|
|
12078
|
-
declare const symbol$d_3: unique symbol;
|
|
12079
|
-
|
|
12080
11423
|
declare const symbol$e: unique symbol;
|
|
12081
11424
|
|
|
12082
11425
|
declare const symbol$f: unique symbol;
|
|
@@ -12091,6 +11434,8 @@ declare const symbol$j: unique symbol;
|
|
|
12091
11434
|
|
|
12092
11435
|
declare const symbol$k: unique symbol;
|
|
12093
11436
|
|
|
11437
|
+
declare const symbol$l: unique symbol;
|
|
11438
|
+
|
|
12094
11439
|
declare const symbol: unique symbol;
|
|
12095
11440
|
|
|
12096
11441
|
declare const symbol_2: unique symbol;
|
|
@@ -12117,13 +11462,260 @@ export declare type SystemModelMessage = {
|
|
|
12117
11462
|
|
|
12118
11463
|
export declare const systemModelMessageSchema: z.ZodType<SystemModelMessage>;
|
|
12119
11464
|
|
|
11465
|
+
declare interface TakoCard {
|
|
11466
|
+
card_id?: string | null;
|
|
11467
|
+
title?: string | null;
|
|
11468
|
+
description?: string | null;
|
|
11469
|
+
semantic_description?: string | null;
|
|
11470
|
+
webpage_url?: string | null;
|
|
11471
|
+
image_url?: string | null;
|
|
11472
|
+
embed_url?: string | null;
|
|
11473
|
+
sources?: Array<{
|
|
11474
|
+
source_name?: string | null;
|
|
11475
|
+
source_description?: string | null;
|
|
11476
|
+
source_index: 'data' | 'web';
|
|
11477
|
+
source_text?: string | null;
|
|
11478
|
+
url?: string | null;
|
|
11479
|
+
}> | null;
|
|
11480
|
+
methodologies?: Array<{
|
|
11481
|
+
methodology_name: string | null;
|
|
11482
|
+
methodology_description: string | null;
|
|
11483
|
+
}> | null;
|
|
11484
|
+
source_indexes?: Array<'data' | 'web'> | null;
|
|
11485
|
+
card_type?: string | null;
|
|
11486
|
+
relevance?: 'High' | 'Low' | 'Medium' | null;
|
|
11487
|
+
content?: TakoResultContent | null;
|
|
11488
|
+
exportable?: boolean;
|
|
11489
|
+
nodes?: Array<{
|
|
11490
|
+
id: string;
|
|
11491
|
+
type: 'entity' | 'metric';
|
|
11492
|
+
name: string;
|
|
11493
|
+
description?: string | null;
|
|
11494
|
+
}> | null;
|
|
11495
|
+
metric_definitions?: Array<{
|
|
11496
|
+
name: string;
|
|
11497
|
+
definition: string;
|
|
11498
|
+
}> | null;
|
|
11499
|
+
data_freshness?: {
|
|
11500
|
+
coverage_end?: string | null;
|
|
11501
|
+
data_as_of?: string | null;
|
|
11502
|
+
last_updated?: string | null;
|
|
11503
|
+
} | null;
|
|
11504
|
+
}
|
|
11505
|
+
|
|
11506
|
+
declare type TakoContentFormat = 'card_json' | 'csv' | 'json_compact' | 'json_records';
|
|
11507
|
+
|
|
11508
|
+
declare type TakoDatasetCell = boolean | number | string | null;
|
|
11509
|
+
|
|
11510
|
+
declare interface TakoDataSourceConfig {
|
|
11511
|
+
/**
|
|
11512
|
+
* Maximum number of data results to return (1-20). When includeContents is
|
|
11513
|
+
* true, each additional result adds its own data surcharge.
|
|
11514
|
+
*/
|
|
11515
|
+
count?: number;
|
|
11516
|
+
/**
|
|
11517
|
+
* Inline rows for each data result. This adds a data surcharge based on row
|
|
11518
|
+
* count and dataset source. To estimate cost, search with includeContents
|
|
11519
|
+
* disabled and inspect cards.content.export_pricing. This applies to every
|
|
11520
|
+
* returned card; limit sources.data.count and sources.data.maxRows to control
|
|
11521
|
+
* cost.
|
|
11522
|
+
*/
|
|
11523
|
+
includeContents?: boolean;
|
|
11524
|
+
/** Requested delivery mode for card data. Search cards are always inlined. */
|
|
11525
|
+
mode?: 'inline' | 'url';
|
|
11526
|
+
/** Serialization for inlined card data. */
|
|
11527
|
+
contentFormat?: TakoContentFormat;
|
|
11528
|
+
/**
|
|
11529
|
+
* Maximum rows to inline per result. Omit to use the allowance in
|
|
11530
|
+
* cards.content.export_pricing. A data surcharge applies per 1,000 exported
|
|
11531
|
+
* rows; lower values reduce cost.
|
|
11532
|
+
*/
|
|
11533
|
+
maxRows?: number;
|
|
11534
|
+
/** Data Graph node IDs to prioritize. */
|
|
11535
|
+
nodeIds?: string[];
|
|
11536
|
+
/** Return only cards matching nodeIds. Requires at least one node ID. */
|
|
11537
|
+
strict?: boolean;
|
|
11538
|
+
}
|
|
11539
|
+
|
|
11540
|
+
declare interface TakoResultContent {
|
|
11541
|
+
content_format?: TakoContentFormat | null;
|
|
11542
|
+
cost?: number;
|
|
11543
|
+
data?: string | null;
|
|
11544
|
+
records?: Array<Record<string, TakoDatasetCell>> | null;
|
|
11545
|
+
dataset?: {
|
|
11546
|
+
columns: Array<{
|
|
11547
|
+
name: string;
|
|
11548
|
+
type: 'boolean' | 'date' | 'datetime' | 'number' | 'string';
|
|
11549
|
+
unit?: string | null;
|
|
11550
|
+
}>;
|
|
11551
|
+
rows: TakoDatasetCell[][];
|
|
11552
|
+
total_rows: number;
|
|
11553
|
+
truncated: boolean;
|
|
11554
|
+
ref: string;
|
|
11555
|
+
sources: Array<{
|
|
11556
|
+
name: string;
|
|
11557
|
+
index?: 'data' | 'web';
|
|
11558
|
+
}>;
|
|
11559
|
+
provenance?: 'query' | 'web_extraction';
|
|
11560
|
+
} | null;
|
|
11561
|
+
card_data?: Record<string, unknown> | null;
|
|
11562
|
+
card_data_schema?: Record<string, unknown> | null;
|
|
11563
|
+
url?: string | null;
|
|
11564
|
+
expires_at?: string | null;
|
|
11565
|
+
total_rows?: number | null;
|
|
11566
|
+
truncated?: boolean;
|
|
11567
|
+
export_pricing?: {
|
|
11568
|
+
baseline_usd: number;
|
|
11569
|
+
free_rows: number;
|
|
11570
|
+
max_rows_ceiling: number;
|
|
11571
|
+
row_cpm_usd: number;
|
|
11572
|
+
} | null;
|
|
11573
|
+
manifest?: Array<{
|
|
11574
|
+
dtype?: 'boolean' | 'date' | 'datetime' | 'number' | 'string' | null;
|
|
11575
|
+
entity?: string | null;
|
|
11576
|
+
metric?: string | null;
|
|
11577
|
+
name?: string | null;
|
|
11578
|
+
unit?: string | null;
|
|
11579
|
+
}> | null;
|
|
11580
|
+
}
|
|
11581
|
+
|
|
11582
|
+
declare interface TakoSearchConfig {
|
|
11583
|
+
/** Search effort. fast is the default balanced option. */
|
|
11584
|
+
effort?: TakoSearchEffort;
|
|
11585
|
+
/** Sources to search. Omit to search both curated data and the web. */
|
|
11586
|
+
sources?: {
|
|
11587
|
+
data?: TakoDataSourceConfig;
|
|
11588
|
+
web?: TakoWebSourceConfig;
|
|
11589
|
+
};
|
|
11590
|
+
/** End-user coordinates for localized results. */
|
|
11591
|
+
location?: {
|
|
11592
|
+
latitude: number;
|
|
11593
|
+
longitude: number;
|
|
11594
|
+
};
|
|
11595
|
+
/** ISO 3166-1 alpha-2 country code. */
|
|
11596
|
+
countryCode?: string;
|
|
11597
|
+
/** BCP-47 locale. */
|
|
11598
|
+
locale?: string;
|
|
11599
|
+
/** IANA timezone. */
|
|
11600
|
+
timezone?: string;
|
|
11601
|
+
/** Settings that control card rendering. */
|
|
11602
|
+
outputSettings?: {
|
|
11603
|
+
imageDarkMode?: boolean;
|
|
11604
|
+
/** Instant-effort only. */
|
|
11605
|
+
forceRefresh?: boolean;
|
|
11606
|
+
};
|
|
11607
|
+
/** Maximum related search suggestions to include (1-20). */
|
|
11608
|
+
includeRelated?: number;
|
|
11609
|
+
}
|
|
11610
|
+
|
|
11611
|
+
declare type TakoSearchEffort = 'deep' | 'fast' | 'instant';
|
|
11612
|
+
|
|
11613
|
+
declare interface TakoSearchError {
|
|
11614
|
+
error: 'api_error' | 'configuration_error' | 'execution_error' | 'invalid_input' | 'rate_limit' | 'timeout' | 'unknown_tool';
|
|
11615
|
+
statusCode?: number;
|
|
11616
|
+
message: string;
|
|
11617
|
+
}
|
|
11618
|
+
|
|
11619
|
+
declare interface TakoSearchInput {
|
|
11620
|
+
query: string;
|
|
11621
|
+
effort?: TakoSearchEffort;
|
|
11622
|
+
sources?: {
|
|
11623
|
+
data?: {
|
|
11624
|
+
count?: number;
|
|
11625
|
+
include_contents?: boolean;
|
|
11626
|
+
mode?: 'inline' | 'url';
|
|
11627
|
+
content_format?: TakoContentFormat;
|
|
11628
|
+
max_rows?: number;
|
|
11629
|
+
node_ids?: string[];
|
|
11630
|
+
strict?: boolean;
|
|
11631
|
+
};
|
|
11632
|
+
web?: {
|
|
11633
|
+
count?: number;
|
|
11634
|
+
include_contents?: boolean;
|
|
11635
|
+
category?: 'finance' | 'news' | 'sports';
|
|
11636
|
+
include_domains?: string[];
|
|
11637
|
+
exclude_domains?: string[];
|
|
11638
|
+
snippet_max_chars?: number;
|
|
11639
|
+
highlights?: boolean;
|
|
11640
|
+
article_content_max_chars?: number;
|
|
11641
|
+
published_after?: string;
|
|
11642
|
+
published_before?: string;
|
|
11643
|
+
};
|
|
11644
|
+
};
|
|
11645
|
+
location?: {
|
|
11646
|
+
latitude: number;
|
|
11647
|
+
longitude: number;
|
|
11648
|
+
};
|
|
11649
|
+
country_code?: string;
|
|
11650
|
+
locale?: string;
|
|
11651
|
+
timezone?: string;
|
|
11652
|
+
output_settings?: {
|
|
11653
|
+
image_dark_mode?: boolean;
|
|
11654
|
+
force_refresh?: boolean;
|
|
11655
|
+
};
|
|
11656
|
+
include_related?: number;
|
|
11657
|
+
}
|
|
11658
|
+
|
|
11659
|
+
declare type TakoSearchOutput = TakoSearchError | TakoSearchResponse;
|
|
11660
|
+
|
|
11661
|
+
declare interface TakoSearchResponse {
|
|
11662
|
+
request_id: string;
|
|
11663
|
+
cards?: TakoCard[];
|
|
11664
|
+
web_results?: TakoWebResult[];
|
|
11665
|
+
usage?: {
|
|
11666
|
+
total_cost_usd: number;
|
|
11667
|
+
compute?: {
|
|
11668
|
+
cost_usd: number;
|
|
11669
|
+
} | null;
|
|
11670
|
+
data?: {
|
|
11671
|
+
cost_usd: number;
|
|
11672
|
+
datasets: number;
|
|
11673
|
+
} | null;
|
|
11674
|
+
} | null;
|
|
11675
|
+
related?: Array<Record<string, unknown>> | null;
|
|
11676
|
+
}
|
|
11677
|
+
|
|
11678
|
+
declare const takoSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<TakoSearchInput, TakoSearchOutput, TakoSearchConfig>;
|
|
11679
|
+
|
|
11680
|
+
declare interface TakoWebResult {
|
|
11681
|
+
title: string;
|
|
11682
|
+
url: string;
|
|
11683
|
+
snippet?: string | null;
|
|
11684
|
+
source_name?: string | null;
|
|
11685
|
+
publish_date?: string | null;
|
|
11686
|
+
content?: TakoResultContent | null;
|
|
11687
|
+
}
|
|
11688
|
+
|
|
11689
|
+
declare interface TakoWebSourceConfig {
|
|
11690
|
+
/** Maximum number of web results to return (1-20). */
|
|
11691
|
+
count?: number;
|
|
11692
|
+
/** Inline extracted web page text. This can add a data charge. */
|
|
11693
|
+
includeContents?: boolean;
|
|
11694
|
+
/** Optional web-result category filter. */
|
|
11695
|
+
category?: 'finance' | 'news' | 'sports';
|
|
11696
|
+
/** Only return results from these bare domains. */
|
|
11697
|
+
includeDomains?: string[];
|
|
11698
|
+
/** Exclude results from these bare domains. */
|
|
11699
|
+
excludeDomains?: string[];
|
|
11700
|
+
/** Maximum characters in each web-result snippet. */
|
|
11701
|
+
snippetMaxChars?: number;
|
|
11702
|
+
/** Include highlighted passages in web results. Defaults to true in AI Gateway. */
|
|
11703
|
+
highlights?: boolean;
|
|
11704
|
+
/** Maximum extracted characters per web page when including contents. */
|
|
11705
|
+
articleContentMaxChars?: number;
|
|
11706
|
+
/** Keep results published on or after this ISO date. */
|
|
11707
|
+
publishedAfter?: string;
|
|
11708
|
+
/** Keep results published on or before this ISO date. */
|
|
11709
|
+
publishedBefore?: string;
|
|
11710
|
+
}
|
|
11711
|
+
|
|
12120
11712
|
/**
|
|
12121
11713
|
* Implement this interface to create custom telemetry integrations.
|
|
12122
11714
|
* Methods can be sync or return a PromiseLike.
|
|
12123
11715
|
*/
|
|
12124
11716
|
export declare interface TelemetryIntegration {
|
|
12125
|
-
onStart?: Listener<OnStartEvent<ToolSet,
|
|
12126
|
-
onStepStart?: Listener<OnStepStartEvent<ToolSet,
|
|
11717
|
+
onStart?: Listener<OnStartEvent<ToolSet, OutputInterface>>;
|
|
11718
|
+
onStepStart?: Listener<OnStepStartEvent<ToolSet, OutputInterface>>;
|
|
12127
11719
|
onToolCallStart?: Listener<OnToolCallStartEvent<ToolSet>>;
|
|
12128
11720
|
onToolCallFinish?: Listener<OnToolCallFinishEvent<ToolSet>>;
|
|
12129
11721
|
onStepFinish?: Listener<OnStepFinishEvent<ToolSet>>;
|
|
@@ -12225,6 +11817,8 @@ export declare type TextStreamPart<TOOLS extends ToolSet> = {
|
|
|
12225
11817
|
type: 'tool-input-start';
|
|
12226
11818
|
id: string;
|
|
12227
11819
|
toolName: string;
|
|
11820
|
+
/** Encoding of the input deltas. Defaults to JSON when omitted. */
|
|
11821
|
+
inputEncoding?: 'json' | 'text';
|
|
12228
11822
|
providerMetadata?: ProviderMetadata;
|
|
12229
11823
|
toolMetadata?: JSONObject;
|
|
12230
11824
|
providerExecuted?: boolean;
|
|
@@ -12329,7 +11923,7 @@ export declare type TimeoutConfiguration = number | {
|
|
|
12329
11923
|
*
|
|
12330
11924
|
* The tool can also contain an optional execute function for the actual execution function of the tool.
|
|
12331
11925
|
*/
|
|
12332
|
-
export declare type Tool<INPUT extends
|
|
11926
|
+
export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTPUT extends JSONValue_2 | unknown | never = any> = {
|
|
12333
11927
|
/**
|
|
12334
11928
|
* An optional description of what the tool does.
|
|
12335
11929
|
* Will be used by the language model to decide whether to use the tool.
|
|
@@ -12355,7 +11949,7 @@ export declare type Tool<INPUT extends JSONValue_3 | unknown | never = any, OUTP
|
|
|
12355
11949
|
* and UI message parts. This is useful for sources of dynamic tools (e.g.
|
|
12356
11950
|
* an MCP server) to identify themselves.
|
|
12357
11951
|
*/
|
|
12358
|
-
metadata?:
|
|
11952
|
+
metadata?: JSONObject;
|
|
12359
11953
|
/**
|
|
12360
11954
|
* The schema of the input that the tool expects.
|
|
12361
11955
|
* The language model will use this to generate the input.
|
|
@@ -12538,6 +12132,13 @@ export declare type ToolApprovalResponse = {
|
|
|
12538
12132
|
approved: boolean;
|
|
12539
12133
|
/**
|
|
12540
12134
|
* Optional reason for the approval or denial.
|
|
12135
|
+
*
|
|
12136
|
+
* For denied tool calls, the reason is included in the `execution-denied`
|
|
12137
|
+
* tool result that is sent to the model. For approved tool calls that are
|
|
12138
|
+
* executed by the SDK, the reason remains in the message history: it is not
|
|
12139
|
+
* included in the model prompt and is not exposed through a dedicated tool
|
|
12140
|
+
* execution option. For provider-executed tools, the approval response
|
|
12141
|
+
* (including the reason) is forwarded to the provider.
|
|
12541
12142
|
*/
|
|
12542
12143
|
reason?: string;
|
|
12543
12144
|
/**
|
|
@@ -12576,7 +12177,7 @@ declare interface ToolCall<NAME extends string, INPUT> {
|
|
|
12576
12177
|
}
|
|
12577
12178
|
|
|
12578
12179
|
export declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
12579
|
-
private readonly [symbol$
|
|
12180
|
+
private readonly [symbol$f];
|
|
12580
12181
|
readonly toolCallId: string;
|
|
12581
12182
|
readonly approvalId: string;
|
|
12582
12183
|
constructor({ toolCallId, approvalId, }: {
|
|
@@ -12668,6 +12269,45 @@ export declare type ToolChoice<TOOLS extends Record<string, unknown>> = 'auto' |
|
|
|
12668
12269
|
toolName: Extract<keyof TOOLS, string>;
|
|
12669
12270
|
};
|
|
12670
12271
|
|
|
12272
|
+
/**
|
|
12273
|
+
* Thrown when a model response does not satisfy an enforced tool choice.
|
|
12274
|
+
*/
|
|
12275
|
+
export declare class ToolChoiceViolationError extends AISDKError {
|
|
12276
|
+
private readonly [symbol$7_2];
|
|
12277
|
+
/**
|
|
12278
|
+
* The tool choice that the model response did not satisfy.
|
|
12279
|
+
*/
|
|
12280
|
+
readonly toolChoice: EnforcedToolChoice;
|
|
12281
|
+
/**
|
|
12282
|
+
* Reason why the model finished generating the response.
|
|
12283
|
+
*/
|
|
12284
|
+
readonly finishReason: FinishReason;
|
|
12285
|
+
/**
|
|
12286
|
+
* The provider that returned the response.
|
|
12287
|
+
*/
|
|
12288
|
+
readonly provider: string;
|
|
12289
|
+
/**
|
|
12290
|
+
* The model that returned the response.
|
|
12291
|
+
*/
|
|
12292
|
+
readonly modelId: string;
|
|
12293
|
+
/**
|
|
12294
|
+
* The normalized content returned by the model.
|
|
12295
|
+
*
|
|
12296
|
+
* This can be inspected to recover a tool call that the provider returned as
|
|
12297
|
+
* text or reasoning instead of a structured tool call.
|
|
12298
|
+
*/
|
|
12299
|
+
readonly content: Array<LanguageModelV3Content>;
|
|
12300
|
+
constructor({ toolChoice, finishReason, provider, modelId, content, message, }: {
|
|
12301
|
+
toolChoice: EnforcedToolChoice;
|
|
12302
|
+
finishReason: FinishReason;
|
|
12303
|
+
provider: string;
|
|
12304
|
+
modelId: string;
|
|
12305
|
+
content: Array<LanguageModelV3Content>;
|
|
12306
|
+
message?: string;
|
|
12307
|
+
});
|
|
12308
|
+
static isInstance(error: unknown): error is ToolChoiceViolationError;
|
|
12309
|
+
}
|
|
12310
|
+
|
|
12671
12311
|
/**
|
|
12672
12312
|
* Content of a tool message. It is an array of tool result parts.
|
|
12673
12313
|
*/
|
|
@@ -12718,7 +12358,7 @@ export declare interface ToolExecutionOptions {
|
|
|
12718
12358
|
* - A tool call needs approval, or
|
|
12719
12359
|
* - A stop condition is met (default stop condition is stepCountIs(20))
|
|
12720
12360
|
*/
|
|
12721
|
-
declare class ToolLoopAgent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends
|
|
12361
|
+
declare class ToolLoopAgent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends OutputInterface = never> implements Agent<CALL_OPTIONS, TOOLS, OUTPUT> {
|
|
12722
12362
|
readonly version = "agent-v1";
|
|
12723
12363
|
private readonly settings;
|
|
12724
12364
|
constructor(settings: ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>);
|
|
@@ -12751,7 +12391,7 @@ export declare type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}
|
|
|
12751
12391
|
/**
|
|
12752
12392
|
* Configuration options for an agent.
|
|
12753
12393
|
*/
|
|
12754
|
-
declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends
|
|
12394
|
+
declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends OutputInterface = never> = Omit<CallSettings, 'abortSignal'> & {
|
|
12755
12395
|
/**
|
|
12756
12396
|
* The id of the agent.
|
|
12757
12397
|
*/
|
|
@@ -12819,6 +12459,12 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
12819
12459
|
* Callback that is called when all steps are finished and the response is complete.
|
|
12820
12460
|
*/
|
|
12821
12461
|
onFinish?: ToolLoopAgentOnFinishCallback<NoInfer<TOOLS>>;
|
|
12462
|
+
/**
|
|
12463
|
+
* Secret for HMAC-signing tool approval requests. When set, the server
|
|
12464
|
+
* signs each approval request at issuance and verifies the signature when
|
|
12465
|
+
* the approval is replayed, preventing client-forged approvals.
|
|
12466
|
+
*/
|
|
12467
|
+
experimental_toolApprovalSecret?: string | Uint8Array;
|
|
12822
12468
|
/**
|
|
12823
12469
|
* Additional provider-specific options. They are passed through
|
|
12824
12470
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -12858,7 +12504,7 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
12858
12504
|
* }),
|
|
12859
12505
|
* ```
|
|
12860
12506
|
*/
|
|
12861
|
-
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' | 'allowSystemInMessages' | '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' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
|
|
12507
|
+
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' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'experimental_toolApprovalSecret' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'timeout' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'experimental_toolApprovalSecret' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
|
|
12862
12508
|
};
|
|
12863
12509
|
export { ToolLoopAgentSettings as Experimental_AgentSettings }
|
|
12864
12510
|
export { ToolLoopAgentSettings }
|
|
@@ -12983,7 +12629,7 @@ declare type ToolResultOutput = {
|
|
|
12983
12629
|
providerOptions?: ProviderOptions;
|
|
12984
12630
|
} | {
|
|
12985
12631
|
type: 'json';
|
|
12986
|
-
value:
|
|
12632
|
+
value: JSONValue_2;
|
|
12987
12633
|
/**
|
|
12988
12634
|
* Provider-specific options.
|
|
12989
12635
|
*/
|
|
@@ -13010,7 +12656,7 @@ declare type ToolResultOutput = {
|
|
|
13010
12656
|
providerOptions?: ProviderOptions;
|
|
13011
12657
|
} | {
|
|
13012
12658
|
type: 'error-json';
|
|
13013
|
-
value:
|
|
12659
|
+
value: JSONValue_2;
|
|
13014
12660
|
/**
|
|
13015
12661
|
* Provider-specific options.
|
|
13016
12662
|
*/
|
|
@@ -13643,21 +13289,6 @@ declare interface TypeValidationContext {
|
|
|
13643
13289
|
entityId?: string;
|
|
13644
13290
|
}
|
|
13645
13291
|
|
|
13646
|
-
declare interface TypeValidationContext_2 {
|
|
13647
|
-
/**
|
|
13648
|
-
* Field path in dot notation (e.g., "message.metadata", "message.parts[3].data")
|
|
13649
|
-
*/
|
|
13650
|
-
field?: string;
|
|
13651
|
-
/**
|
|
13652
|
-
* Entity name (e.g., tool name, data type name)
|
|
13653
|
-
*/
|
|
13654
|
-
entityName?: string;
|
|
13655
|
-
/**
|
|
13656
|
-
* Entity identifier (e.g., message ID, tool call ID)
|
|
13657
|
-
*/
|
|
13658
|
-
entityId?: string;
|
|
13659
|
-
}
|
|
13660
|
-
|
|
13661
13292
|
export declare class TypeValidationError extends AISDKError {
|
|
13662
13293
|
private readonly [symbol$1];
|
|
13663
13294
|
readonly value: unknown;
|
|
@@ -13686,34 +13317,6 @@ export declare class TypeValidationError extends AISDKError {
|
|
|
13686
13317
|
}): TypeValidationError;
|
|
13687
13318
|
}
|
|
13688
13319
|
|
|
13689
|
-
declare class TypeValidationError_2 extends AISDKError_2 {
|
|
13690
|
-
private readonly [symbol$1_2];
|
|
13691
|
-
readonly value: unknown;
|
|
13692
|
-
readonly context?: TypeValidationContext_2;
|
|
13693
|
-
constructor({ value, cause, context, }: {
|
|
13694
|
-
value: unknown;
|
|
13695
|
-
cause: unknown;
|
|
13696
|
-
context?: TypeValidationContext_2;
|
|
13697
|
-
});
|
|
13698
|
-
static isInstance(error: unknown): error is TypeValidationError_2;
|
|
13699
|
-
/**
|
|
13700
|
-
* Wraps an error into a TypeValidationError.
|
|
13701
|
-
* If the cause is already a TypeValidationError with the same value and context, it returns the cause.
|
|
13702
|
-
* Otherwise, it creates a new TypeValidationError.
|
|
13703
|
-
*
|
|
13704
|
-
* @param {Object} params - The parameters for wrapping the error.
|
|
13705
|
-
* @param {unknown} params.value - The value that failed validation.
|
|
13706
|
-
* @param {unknown} params.cause - The original error or cause of the validation failure.
|
|
13707
|
-
* @param {TypeValidationContext} params.context - Optional context about what is being validated.
|
|
13708
|
-
* @returns {TypeValidationError} A TypeValidationError instance.
|
|
13709
|
-
*/
|
|
13710
|
-
static wrap({ value, cause, context, }: {
|
|
13711
|
-
value: unknown;
|
|
13712
|
-
cause: unknown;
|
|
13713
|
-
context?: TypeValidationContext_2;
|
|
13714
|
-
}): TypeValidationError_2;
|
|
13715
|
-
}
|
|
13716
|
-
|
|
13717
13320
|
export declare const UI_MESSAGE_STREAM_HEADERS: {
|
|
13718
13321
|
'content-type': string;
|
|
13719
13322
|
'cache-control': string;
|
|
@@ -13816,6 +13419,8 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
13816
13419
|
type: 'tool-approval-request';
|
|
13817
13420
|
approvalId: string;
|
|
13818
13421
|
toolCallId: string;
|
|
13422
|
+
approvalDescriptor?: unknown;
|
|
13423
|
+
inputSchemaInput?: unknown;
|
|
13819
13424
|
signature?: string;
|
|
13820
13425
|
} | {
|
|
13821
13426
|
type: 'tool-output-available';
|
|
@@ -13841,6 +13446,8 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
13841
13446
|
type: 'tool-input-start';
|
|
13842
13447
|
toolCallId: string;
|
|
13843
13448
|
toolName: string;
|
|
13449
|
+
/** Encoding of the input deltas. Defaults to JSON when omitted. */
|
|
13450
|
+
inputEncoding?: 'json' | 'text';
|
|
13844
13451
|
providerExecuted?: boolean;
|
|
13845
13452
|
providerMetadata?: ProviderMetadata;
|
|
13846
13453
|
toolMetadata?: JSONObject;
|
|
@@ -13934,6 +13541,11 @@ export declare type UIMessageStreamOnFinishCallback<UI_MESSAGE extends UIMessage
|
|
|
13934
13541
|
* Indicates whether the stream was aborted.
|
|
13935
13542
|
*/
|
|
13936
13543
|
isAborted: boolean;
|
|
13544
|
+
/**
|
|
13545
|
+
* The operation-level outcome of the stream. Fatal stream-processing
|
|
13546
|
+
* failures override outcomes declared by the stream owner.
|
|
13547
|
+
*/
|
|
13548
|
+
outcome: UIMessageStreamOutcome;
|
|
13937
13549
|
/**
|
|
13938
13550
|
* The message that was sent to the client as a response
|
|
13939
13551
|
* (including the original message if it was extended).
|
|
@@ -14015,16 +13627,45 @@ export declare type UIMessageStreamOptions<UI_MESSAGE extends UIMessage> = {
|
|
|
14015
13627
|
/**
|
|
14016
13628
|
* Process an error, e.g. to log it. Default to `() => 'An error occurred.'`.
|
|
14017
13629
|
*
|
|
13630
|
+
* Tool execution errors marked `providerExecuted: true` bypass this callback.
|
|
13631
|
+
* Their strings pass through unchanged; other values are JSON-stringified to
|
|
13632
|
+
* preserve provider error data for model-message round trips. Stream errors
|
|
13633
|
+
* and invalid tool calls still use it.
|
|
13634
|
+
*
|
|
14018
13635
|
* @returns error message to include in the data stream.
|
|
14019
13636
|
*/
|
|
14020
13637
|
onError?: (error: unknown) => string;
|
|
14021
13638
|
};
|
|
14022
13639
|
|
|
13640
|
+
/**
|
|
13641
|
+
* The operation-level outcome of a UI message stream.
|
|
13642
|
+
*
|
|
13643
|
+
* This is separate from model finish reasons and individual stream chunks.
|
|
13644
|
+
* Fatal stream-processing failures override outcomes declared by the stream
|
|
13645
|
+
* owner.
|
|
13646
|
+
*/
|
|
13647
|
+
export declare type UIMessageStreamOutcome = {
|
|
13648
|
+
status: 'completed';
|
|
13649
|
+
} | {
|
|
13650
|
+
status: 'failed';
|
|
13651
|
+
error?: unknown;
|
|
13652
|
+
} | {
|
|
13653
|
+
status: 'aborted';
|
|
13654
|
+
} | {
|
|
13655
|
+
status: 'unknown';
|
|
13656
|
+
};
|
|
13657
|
+
|
|
14023
13658
|
/**
|
|
14024
13659
|
* Options for creating a UI message stream response.
|
|
14025
13660
|
* Extends the standard `ResponseInit` with additional streaming options.
|
|
14026
13661
|
*/
|
|
14027
13662
|
declare type UIMessageStreamResponseInit = ResponseInit & {
|
|
13663
|
+
/**
|
|
13664
|
+
* Optional interval in milliseconds for sending SSE keep-alive comments.
|
|
13665
|
+
* When set, an opening comment is sent immediately and additional comments
|
|
13666
|
+
* are sent after the stream has been idle for the configured interval.
|
|
13667
|
+
*/
|
|
13668
|
+
keepAliveMs?: number;
|
|
14028
13669
|
/**
|
|
14029
13670
|
* Optional callback to consume a copy of the SSE stream independently.
|
|
14030
13671
|
* This is useful for logging, debugging, or processing the stream in parallel.
|
|
@@ -14052,6 +13693,18 @@ export declare interface UIMessageStreamWriter<UI_MESSAGE extends UIMessage = UI
|
|
|
14052
13693
|
onError: ErrorHandler | undefined;
|
|
14053
13694
|
}
|
|
14054
13695
|
|
|
13696
|
+
export declare interface UIMessageStreamWriterWithOutcome<UI_MESSAGE extends UIMessage = UIMessage> extends UIMessageStreamWriter<UI_MESSAGE> {
|
|
13697
|
+
/**
|
|
13698
|
+
* Declares the operation-level outcome of the composed stream.
|
|
13699
|
+
*
|
|
13700
|
+
* The first outcome declared through this method is retained. Fatal
|
|
13701
|
+
* execution, merge, error-handling, or downstream processing failures
|
|
13702
|
+
* override declared outcomes. Declaring an outcome does not write a chunk or
|
|
13703
|
+
* close the stream.
|
|
13704
|
+
*/
|
|
13705
|
+
setOutcome(outcome: UIMessageStreamOutcome): void;
|
|
13706
|
+
}
|
|
13707
|
+
|
|
14055
13708
|
export declare type UITool = {
|
|
14056
13709
|
input: unknown;
|
|
14057
13710
|
output: unknown | undefined;
|
|
@@ -14076,6 +13729,15 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14076
13729
|
} & ({
|
|
14077
13730
|
state: 'input-streaming';
|
|
14078
13731
|
input?: DeepPartial<asUITool<TOOL>['input']> | undefined;
|
|
13732
|
+
/**
|
|
13733
|
+
* The raw tool input text received so far.
|
|
13734
|
+
*
|
|
13735
|
+
* This is used to continue input streaming when a message is persisted
|
|
13736
|
+
* and later resumed.
|
|
13737
|
+
*/
|
|
13738
|
+
rawInput?: string;
|
|
13739
|
+
/** Encoding of `rawInput`. Defaults to JSON when omitted. */
|
|
13740
|
+
inputEncoding?: 'json' | 'text';
|
|
14079
13741
|
output?: never;
|
|
14080
13742
|
errorText?: never;
|
|
14081
13743
|
callProviderMetadata?: ProviderMetadata;
|
|
@@ -14096,8 +13758,10 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14096
13758
|
approval: {
|
|
14097
13759
|
id: string;
|
|
14098
13760
|
approved?: never;
|
|
13761
|
+
descriptor?: unknown;
|
|
14099
13762
|
reason?: never;
|
|
14100
13763
|
signature?: string;
|
|
13764
|
+
inputSchemaInput?: unknown;
|
|
14101
13765
|
};
|
|
14102
13766
|
} | {
|
|
14103
13767
|
state: 'approval-responded';
|
|
@@ -14108,8 +13772,10 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14108
13772
|
approval: {
|
|
14109
13773
|
id: string;
|
|
14110
13774
|
approved: boolean;
|
|
13775
|
+
descriptor?: unknown;
|
|
14111
13776
|
reason?: string;
|
|
14112
13777
|
signature?: string;
|
|
13778
|
+
inputSchemaInput?: unknown;
|
|
14113
13779
|
};
|
|
14114
13780
|
} | {
|
|
14115
13781
|
state: 'output-available';
|
|
@@ -14122,8 +13788,10 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14122
13788
|
approval?: {
|
|
14123
13789
|
id: string;
|
|
14124
13790
|
approved: true;
|
|
13791
|
+
descriptor?: unknown;
|
|
14125
13792
|
reason?: string;
|
|
14126
13793
|
signature?: string;
|
|
13794
|
+
inputSchemaInput?: unknown;
|
|
14127
13795
|
};
|
|
14128
13796
|
} | {
|
|
14129
13797
|
state: 'output-error';
|
|
@@ -14136,8 +13804,10 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14136
13804
|
approval?: {
|
|
14137
13805
|
id: string;
|
|
14138
13806
|
approved: true;
|
|
13807
|
+
descriptor?: unknown;
|
|
14139
13808
|
reason?: string;
|
|
14140
13809
|
signature?: string;
|
|
13810
|
+
inputSchemaInput?: unknown;
|
|
14141
13811
|
};
|
|
14142
13812
|
} | {
|
|
14143
13813
|
state: 'output-denied';
|
|
@@ -14148,8 +13818,10 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14148
13818
|
approval: {
|
|
14149
13819
|
id: string;
|
|
14150
13820
|
approved: false;
|
|
13821
|
+
descriptor?: unknown;
|
|
14151
13822
|
reason?: string;
|
|
14152
13823
|
signature?: string;
|
|
13824
|
+
inputSchemaInput?: unknown;
|
|
14153
13825
|
};
|
|
14154
13826
|
});
|
|
14155
13827
|
|
|
@@ -14287,7 +13959,7 @@ declare function validateDownloadUrl(url: string): void;
|
|
|
14287
13959
|
declare function validateTypes<OBJECT>({ value, schema, context, }: {
|
|
14288
13960
|
value: unknown;
|
|
14289
13961
|
schema: FlexibleSchema<OBJECT>;
|
|
14290
|
-
context?:
|
|
13962
|
+
context?: TypeValidationContext;
|
|
14291
13963
|
}): Promise<OBJECT>;
|
|
14292
13964
|
|
|
14293
13965
|
/**
|
|
@@ -14297,7 +13969,9 @@ declare function validateTypes<OBJECT>({ value, schema, context, }: {
|
|
|
14297
13969
|
* the corresponding schemas are provided. Otherwise, they are assumed to be
|
|
14298
13970
|
* valid.
|
|
14299
13971
|
*/
|
|
14300
|
-
export declare function validateUIMessages<UI_MESSAGE extends UIMessage>(
|
|
13972
|
+
export declare function validateUIMessages<UI_MESSAGE extends UIMessage>(options: ValidateUIMessagesOptions<UI_MESSAGE>): Promise<Array<UI_MESSAGE>>;
|
|
13973
|
+
|
|
13974
|
+
declare type ValidateUIMessagesOptions<UI_MESSAGE extends UIMessage> = {
|
|
14301
13975
|
messages: unknown;
|
|
14302
13976
|
metadataSchema?: FlexibleSchema<UIMessage['metadata']>;
|
|
14303
13977
|
dataSchemas?: {
|
|
@@ -14306,7 +13980,7 @@ export declare function validateUIMessages<UI_MESSAGE extends UIMessage>({ messa
|
|
|
14306
13980
|
tools?: {
|
|
14307
13981
|
[NAME in keyof InferUIMessageTools<UI_MESSAGE> & string]?: Tool<InferUIMessageTools<UI_MESSAGE>[NAME]['input'], InferUIMessageTools<UI_MESSAGE>[NAME]['output']>;
|
|
14308
13982
|
};
|
|
14309
|
-
}
|
|
13983
|
+
};
|
|
14310
13984
|
|
|
14311
13985
|
declare type ValidationResult<OBJECT> = {
|
|
14312
13986
|
success: true;
|
|
@@ -14490,11 +14164,12 @@ declare type VideoModelV3CallOptions = {
|
|
|
14490
14164
|
n: number;
|
|
14491
14165
|
/**
|
|
14492
14166
|
* Aspect ratio of the videos to generate.
|
|
14493
|
-
* Must have the format `{width}:{height}
|
|
14167
|
+
* Must have the format `{width}:{height}`, or `'adaptive'` to inherit the
|
|
14168
|
+
* ratio from the input media.
|
|
14494
14169
|
* `undefined` will use the provider's default aspect ratio.
|
|
14495
14170
|
* Common values: '16:9', '9:16', '1:1', '21:9', '4:3'
|
|
14496
14171
|
*/
|
|
14497
|
-
aspectRatio: `${number}:${number}` | undefined;
|
|
14172
|
+
aspectRatio: `${number}:${number}` | 'adaptive' | undefined;
|
|
14498
14173
|
/**
|
|
14499
14174
|
* Resolution of the video to generate.
|
|
14500
14175
|
* Format: `{width}x{height}` (e.g., '1280x720', '1920x1080')
|
|
@@ -14759,5 +14434,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
|
|
|
14759
14434
|
}): Schema<OBJECT>;
|
|
14760
14435
|
|
|
14761
14436
|
export { }
|
|
14762
|
-
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider,
|
|
14763
|
-
export { EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER, schemaSymbol, symbol$1, symbol$1_2, symbol$
|
|
14437
|
+
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, 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, PrepareStepCallSettings as PrepareStepCallSettings, ResponseMessage as ResponseMessage, LanguageModelV3ToolCall as LanguageModelV3ToolCall, GenerateTextIncludeSettings as GenerateTextIncludeSettings, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, DataUIMessageChunk as DataUIMessageChunk, InferElementOutput as InferElementOutput, ConsumeStreamOptions as ConsumeStreamOptions, StreamTextIncludeSettings as StreamTextIncludeSettings, StreamTextOnAbortCallback as StreamTextOnAbortCallback, EnrichedStreamPart as EnrichedStreamPart, CallbackModelInfo as CallbackModelInfo, LanguageModelV3ToolChoice as LanguageModelV3ToolChoice, Listener as Listener, MaybePromiseLike as MaybePromiseLike, 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, ValidateUIMessagesOptions as ValidateUIMessagesOptions, SingleRequestTextStreamPart as SingleRequestTextStreamPart, EnforcedToolChoice as EnforcedToolChoice, LanguageModelV3Content as LanguageModelV3Content, RetryErrorReason_2 as RetryErrorReason_2, GenerateImagePrompt as GenerateImagePrompt, JSONValue_2 as JSONValue_2, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, VideoModelResponseMetadata as VideoModelResponseMetadata, VideoModelProviderMetadata as VideoModelProviderMetadata, VideoModel as VideoModel, VideoModelV3FrameType as VideoModelV3FrameType, 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 };
|
|
14438
|
+
export { EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER, 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$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$k, symbol$l, symbol, symbol_2, symbol_3 };
|