@mastra/ai-sdk 1.11.2-alpha.0 → 1.11.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_types/@ai-sdk_provider/dist/index.d.ts +12 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +409 -922
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +1096 -1307
- package/dist/_types/@internal_ai-v7/dist/index.d.ts +2570 -3952
- package/dist/helpers.d.ts.map +1 -1
- package/dist/index.cjs +3017 -6594
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4198 -7774
- package/dist/index.js.map +1 -1
- package/dist/middleware.d.ts.map +1 -1
- package/dist/transformers.d.ts +2 -0
- package/dist/transformers.d.ts.map +1 -1
- package/dist/ui.cjs +1 -2
- package/dist/ui.js +1 -2
- package/package.json +21 -22
|
@@ -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.
|
|
@@ -306,8 +315,10 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
306
315
|
delay,
|
|
307
316
|
downloadBlob,
|
|
308
317
|
dynamicTool,
|
|
318
|
+
encodePathSegment,
|
|
309
319
|
executeTool,
|
|
310
320
|
extractResponseHeaders,
|
|
321
|
+
fetchWithValidatedEndpoint,
|
|
311
322
|
fetchWithValidatedRedirects,
|
|
312
323
|
generateId,
|
|
313
324
|
getErrorMessage,
|
|
@@ -386,36 +397,34 @@ export declare class AISDKError extends Error {
|
|
|
386
397
|
}
|
|
387
398
|
|
|
388
399
|
/**
|
|
389
|
-
*
|
|
390
|
-
*
|
|
400
|
+
* AnyValue can be:
|
|
401
|
+
* - a string, number, boolean value
|
|
402
|
+
* - a byte array (Uint8Array)
|
|
403
|
+
* - array of any value
|
|
404
|
+
* - map from string to any value (a plain Object)
|
|
405
|
+
* - null (an empty value)
|
|
406
|
+
*
|
|
407
|
+
* https://opentelemetry.io/docs/specs/otel/common/#anyvalue
|
|
408
|
+
*
|
|
409
|
+
* Notable JavaScript types that are excluded:
|
|
410
|
+
* - `undefined` - Excluding this means the common practice in instrumentations,
|
|
411
|
+
* using `undefined` to mean "no value for this optional attribute", can
|
|
412
|
+
* remain supported.
|
|
413
|
+
* - `BigInt`
|
|
414
|
+
* - TypedArrays other than `Uint8Array`
|
|
415
|
+
* - subclasses of Object, e.g. Date, Error
|
|
416
|
+
*
|
|
417
|
+
* The TypeScript type `unknown` is used for `AnyValue`. This has some
|
|
418
|
+
* implications:
|
|
419
|
+
* - Callers of `@opentelemetry/api` APIs using `AnyValue` can pass in
|
|
420
|
+
* whatever type. This was always the case for (untyped) JavaScript usage.
|
|
421
|
+
* - SDK implementations of `@opentelemetry/api` need to document if/when they
|
|
422
|
+
* support a subset of AnyValue types.
|
|
423
|
+
* - Using `unknown` allows future changes to support more types (e.g. BigInt).
|
|
424
|
+
*
|
|
425
|
+
* @since 1.10.0
|
|
391
426
|
*/
|
|
392
|
-
declare
|
|
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
|
-
}
|
|
427
|
+
declare type AnyValue = unknown;
|
|
419
428
|
|
|
420
429
|
export declare class APICallError extends AISDKError {
|
|
421
430
|
private readonly [symbol$c];
|
|
@@ -441,30 +450,6 @@ export declare class APICallError extends AISDKError {
|
|
|
441
450
|
static isInstance(error: unknown): error is APICallError;
|
|
442
451
|
}
|
|
443
452
|
|
|
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
453
|
export declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
|
|
469
454
|
|
|
470
455
|
/**
|
|
@@ -498,24 +483,20 @@ declare type asUITool<TOOL extends UITool | Tool> = TOOL extends Tool ? InferUIT
|
|
|
498
483
|
export declare type AsyncIterableStream<T> = AsyncIterable<T> & ReadableStream<T>;
|
|
499
484
|
|
|
500
485
|
/**
|
|
501
|
-
* Attributes is a
|
|
502
|
-
*
|
|
503
|
-
* Note: only the own enumerable keys are counted as valid attribute keys.
|
|
486
|
+
* Attributes is a mapping from string to attribute values.
|
|
487
|
+
* https://opentelemetry.io/docs/specs/otel/common/#attribute-collections
|
|
504
488
|
*
|
|
505
|
-
* @since 1.
|
|
489
|
+
* @since 1.1.0
|
|
506
490
|
*/
|
|
507
491
|
declare interface Attributes {
|
|
508
|
-
[attributeKey: string]:
|
|
492
|
+
[attributeKey: string]: AnyValue;
|
|
509
493
|
}
|
|
510
494
|
|
|
511
495
|
/**
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
* null or undefined attribute values are invalid and will result in undefined behavior.
|
|
515
|
-
*
|
|
516
|
-
* @since 1.3.0
|
|
496
|
+
* @since 1.1.0
|
|
497
|
+
* @deprecated use AnyValue
|
|
517
498
|
*/
|
|
518
|
-
declare type AttributeValue =
|
|
499
|
+
declare type AttributeValue = AnyValue;
|
|
519
500
|
|
|
520
501
|
declare type BaseToolCall = {
|
|
521
502
|
type: 'tool-call';
|
|
@@ -532,6 +513,124 @@ declare type BaseToolCall = {
|
|
|
532
513
|
*/
|
|
533
514
|
export declare function bindTelemetryIntegration(integration: TelemetryIntegration): TelemetryIntegration;
|
|
534
515
|
|
|
516
|
+
declare interface BrowserbaseFetchConfig {
|
|
517
|
+
/** Whether to follow HTTP redirects (default: false). */
|
|
518
|
+
allowRedirects?: boolean;
|
|
519
|
+
/** Whether to bypass TLS certificate verification (default: false). */
|
|
520
|
+
allowInsecureSsl?: boolean;
|
|
521
|
+
/** Whether to route the request through Browserbase proxies (default: false). */
|
|
522
|
+
proxies?: boolean;
|
|
523
|
+
/** Output format for the response content (default: raw). */
|
|
524
|
+
format?: BrowserbaseFetchFormat;
|
|
525
|
+
/**
|
|
526
|
+
* JSON Schema describing the desired response content. Only used when format
|
|
527
|
+
* is json.
|
|
528
|
+
*/
|
|
529
|
+
schema?: Record<string, unknown>;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
declare interface BrowserbaseFetchError {
|
|
533
|
+
error: 'api_error' | 'configuration_error' | 'execution_error' | 'invalid_input' | 'rate_limit' | 'timeout' | 'unknown';
|
|
534
|
+
statusCode?: number;
|
|
535
|
+
message: string;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
declare type BrowserbaseFetchFormat = 'raw' | 'json' | 'markdown';
|
|
539
|
+
|
|
540
|
+
declare interface BrowserbaseFetchInput {
|
|
541
|
+
/** URL of the page to fetch. */
|
|
542
|
+
url: string;
|
|
543
|
+
/** Whether to follow HTTP redirects. */
|
|
544
|
+
allow_redirects?: boolean;
|
|
545
|
+
/** Whether to bypass TLS certificate verification. */
|
|
546
|
+
allow_insecure_ssl?: boolean;
|
|
547
|
+
/** Whether to route the request through Browserbase proxies. */
|
|
548
|
+
proxies?: boolean;
|
|
549
|
+
/** Output format for the response content. */
|
|
550
|
+
format?: BrowserbaseFetchFormat;
|
|
551
|
+
/**
|
|
552
|
+
* JSON Schema describing the desired response content. Only used when format
|
|
553
|
+
* is json.
|
|
554
|
+
*/
|
|
555
|
+
schema?: Record<string, unknown>;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
declare type BrowserbaseFetchOutput = BrowserbaseFetchError | BrowserbaseFetchResponse;
|
|
559
|
+
|
|
560
|
+
declare interface BrowserbaseFetchResponse {
|
|
561
|
+
/** Unique identifier for the fetch request. */
|
|
562
|
+
id: string;
|
|
563
|
+
/**
|
|
564
|
+
* Response body. Raw and markdown responses return strings; JSON extraction
|
|
565
|
+
* returns an object matching the requested schema.
|
|
566
|
+
*/
|
|
567
|
+
content: string | Record<string, unknown>;
|
|
568
|
+
/** MIME type of the response. */
|
|
569
|
+
contentType: string;
|
|
570
|
+
/** Character encoding of the response. */
|
|
571
|
+
encoding: string;
|
|
572
|
+
/** Response headers from the fetched page. */
|
|
573
|
+
headers: Record<string, string>;
|
|
574
|
+
/** HTTP status code returned by the fetched page. */
|
|
575
|
+
statusCode: number;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
declare const browserbaseFetchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<BrowserbaseFetchInput, BrowserbaseFetchOutput, BrowserbaseFetchConfig>;
|
|
579
|
+
|
|
580
|
+
declare interface BrowserbaseSearchConfig {
|
|
581
|
+
/**
|
|
582
|
+
* Default maximum number of results to return (1-25, default: 10).
|
|
583
|
+
*/
|
|
584
|
+
numResults?: number;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
declare interface BrowserbaseSearchError {
|
|
588
|
+
error: 'api_error' | 'configuration_error' | 'execution_error' | 'invalid_input' | 'rate_limit' | 'timeout' | 'unknown';
|
|
589
|
+
statusCode?: number;
|
|
590
|
+
message: string;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
declare interface BrowserbaseSearchInput {
|
|
594
|
+
/**
|
|
595
|
+
* Web search query (1-200 characters).
|
|
596
|
+
*/
|
|
597
|
+
query: string;
|
|
598
|
+
/**
|
|
599
|
+
* Maximum number of results to return (1-25, default: 10).
|
|
600
|
+
*/
|
|
601
|
+
num_results?: number;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
declare type BrowserbaseSearchOutput = BrowserbaseSearchError | BrowserbaseSearchResponse;
|
|
605
|
+
|
|
606
|
+
declare interface BrowserbaseSearchResponse {
|
|
607
|
+
/** The search query that was executed. */
|
|
608
|
+
query: string;
|
|
609
|
+
/** Unique identifier for the request. */
|
|
610
|
+
requestId: string;
|
|
611
|
+
/** Search results. */
|
|
612
|
+
results: BrowserbaseSearchResult[];
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
declare interface BrowserbaseSearchResult {
|
|
616
|
+
/** Unique identifier for the result. */
|
|
617
|
+
id: string;
|
|
618
|
+
/** Title of the search result. */
|
|
619
|
+
title: string;
|
|
620
|
+
/** URL of the search result. */
|
|
621
|
+
url: string;
|
|
622
|
+
/** Author of the content, when available. */
|
|
623
|
+
author?: string;
|
|
624
|
+
/** Favicon URL, when available. */
|
|
625
|
+
favicon?: string;
|
|
626
|
+
/** Image URL, when available. */
|
|
627
|
+
image?: string;
|
|
628
|
+
/** Publication date in ISO 8601 format, when available. */
|
|
629
|
+
publishedDate?: string;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
declare const browserbaseSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<BrowserbaseSearchInput, BrowserbaseSearchOutput, BrowserbaseSearchConfig>;
|
|
633
|
+
|
|
535
634
|
/**
|
|
536
635
|
* Common model information used across callback events.
|
|
537
636
|
*/
|
|
@@ -810,6 +909,12 @@ export declare type ChatStatus = 'submitted' | 'streaming' | 'ready' | 'error';
|
|
|
810
909
|
* @template UI_MESSAGE - The UI message type extending UIMessage
|
|
811
910
|
*/
|
|
812
911
|
export declare interface ChatTransport<UI_MESSAGE extends UIMessage> {
|
|
912
|
+
/**
|
|
913
|
+
* Whether reconnecting returns the complete response from its beginning.
|
|
914
|
+
* Complete replays must reset the streaming message state before processing
|
|
915
|
+
* the first start chunk.
|
|
916
|
+
*/
|
|
917
|
+
readonly resumeStreamIsReplay?: boolean;
|
|
813
918
|
/**
|
|
814
919
|
* Sends messages to the chat API endpoint and returns a streaming response.
|
|
815
920
|
*
|
|
@@ -858,6 +963,7 @@ export declare interface ChatTransport<UI_MESSAGE extends UIMessage> {
|
|
|
858
963
|
*
|
|
859
964
|
* @param options - Configuration object containing:
|
|
860
965
|
* @param options.chatId - Unique identifier for the chat session to reconnect to
|
|
966
|
+
* @param options.abortSignal - Signal to abort the reconnection request if needed
|
|
861
967
|
* @param options.headers - Additional HTTP headers to include in the reconnection request
|
|
862
968
|
* @param options.body - Additional JSON properties to include in the request body
|
|
863
969
|
* @param options.metadata - Custom metadata to attach to the request
|
|
@@ -871,6 +977,8 @@ export declare interface ChatTransport<UI_MESSAGE extends UIMessage> {
|
|
|
871
977
|
reconnectToStream: (options: {
|
|
872
978
|
/** Unique identifier for the chat session to reconnect to */
|
|
873
979
|
chatId: string;
|
|
980
|
+
/** Signal to abort the reconnection request if needed */
|
|
981
|
+
abortSignal?: AbortSignal;
|
|
874
982
|
} & ChatRequestOptions) => Promise<ReadableStream<UIMessageChunk> | null>;
|
|
875
983
|
}
|
|
876
984
|
|
|
@@ -908,9 +1016,10 @@ export declare type CompletionRequestOptions = {
|
|
|
908
1016
|
* @param options.onError - Optional callback to handle errors that occur during consumption.
|
|
909
1017
|
* @returns A promise that resolves when the stream is fully consumed.
|
|
910
1018
|
*/
|
|
911
|
-
export declare function consumeStream({ stream, onError, }: {
|
|
1019
|
+
export declare function consumeStream({ stream, onError, abortSignal, }: {
|
|
912
1020
|
stream: ReadableStream;
|
|
913
1021
|
onError?: (error: unknown) => void;
|
|
1022
|
+
abortSignal?: AbortSignal;
|
|
914
1023
|
}): Promise<void>;
|
|
915
1024
|
|
|
916
1025
|
declare type ConsumeStreamOptions = {
|
|
@@ -988,7 +1097,7 @@ export declare function convertFileListToFileUIParts(files: FileList | undefined
|
|
|
988
1097
|
* If the file is base64 data, it returns a data URI with the base64 data.
|
|
989
1098
|
* If the file is a Uint8Array, it converts it to base64 and returns a data URI.
|
|
990
1099
|
*/
|
|
991
|
-
declare function convertImageModelFileToDataUri(file:
|
|
1100
|
+
declare function convertImageModelFileToDataUri(file: ImageModelV3File): string;
|
|
992
1101
|
|
|
993
1102
|
declare function convertToBase64(value: string | Uint8Array): string;
|
|
994
1103
|
|
|
@@ -1063,7 +1172,7 @@ export declare function cosineSimilarity(vector1: number[], vector2: number[]):
|
|
|
1063
1172
|
* Runs the agent and stream the output as a UI message stream.
|
|
1064
1173
|
*
|
|
1065
1174
|
* @param agent - The agent to run.
|
|
1066
|
-
* @param uiMessages - The input UI messages.
|
|
1175
|
+
* @param uiMessages - The input UI messages. Defaults to originalMessages.
|
|
1067
1176
|
* @param abortSignal - The abort signal. Optional.
|
|
1068
1177
|
* @param timeout - Timeout in milliseconds. Optional.
|
|
1069
1178
|
* @param options - The options for the agent.
|
|
@@ -1072,9 +1181,9 @@ export declare function cosineSimilarity(vector1: number[], vector2: number[]):
|
|
|
1072
1181
|
*
|
|
1073
1182
|
* @returns The UI message stream.
|
|
1074
1183
|
*/
|
|
1075
|
-
export declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends
|
|
1184
|
+
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
1185
|
agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
|
|
1077
|
-
uiMessages
|
|
1186
|
+
uiMessages?: unknown[];
|
|
1078
1187
|
abortSignal?: AbortSignal;
|
|
1079
1188
|
timeout?: TimeoutConfiguration;
|
|
1080
1189
|
options?: CALL_OPTIONS;
|
|
@@ -1086,7 +1195,7 @@ export declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends
|
|
|
1086
1195
|
* Runs the agent and returns a response object with a UI message stream.
|
|
1087
1196
|
*
|
|
1088
1197
|
* @param agent - The agent to run.
|
|
1089
|
-
* @param uiMessages - The input UI messages.
|
|
1198
|
+
* @param uiMessages - The input UI messages. Defaults to originalMessages.
|
|
1090
1199
|
* @param abortSignal - Abort signal. Optional.
|
|
1091
1200
|
* @param timeout - Timeout in milliseconds. Optional.
|
|
1092
1201
|
* @param options - The options for the agent. Optional.
|
|
@@ -1095,13 +1204,14 @@ export declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends
|
|
|
1095
1204
|
* @param headers - Additional headers for the response. Optional.
|
|
1096
1205
|
* @param status - The status code for the response. Optional.
|
|
1097
1206
|
* @param statusText - The status text for the response. Optional.
|
|
1207
|
+
* @param keepAliveMs - Optional interval for sending SSE keep-alive comments.
|
|
1098
1208
|
* @param consumeSseStream - Whether to consume the SSE stream. Optional.
|
|
1099
1209
|
*
|
|
1100
1210
|
* @returns The response object.
|
|
1101
1211
|
*/
|
|
1102
|
-
export declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends
|
|
1212
|
+
export declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends OutputInterface = never, MESSAGE_METADATA = unknown>({ headers, status, statusText, keepAliveMs, consumeSseStream, ...options }: {
|
|
1103
1213
|
agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
|
|
1104
|
-
uiMessages
|
|
1214
|
+
uiMessages?: unknown[];
|
|
1105
1215
|
abortSignal?: AbortSignal;
|
|
1106
1216
|
timeout?: TimeoutConfiguration;
|
|
1107
1217
|
options?: CALL_OPTIONS;
|
|
@@ -1156,7 +1266,7 @@ declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage,
|
|
|
1156
1266
|
errorSchema: FlexibleSchema<T>;
|
|
1157
1267
|
errorToMessage: (error: T) => string;
|
|
1158
1268
|
isRetryable?: (response: Response, error?: T) => boolean;
|
|
1159
|
-
}) => ResponseHandler<
|
|
1269
|
+
}) => ResponseHandler<APICallError>;
|
|
1160
1270
|
|
|
1161
1271
|
declare const createJsonResponseHandler: <T>(responseSchema: FlexibleSchema<T>) => ResponseHandler<T>;
|
|
1162
1272
|
|
|
@@ -1201,7 +1311,7 @@ declare function createProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS e
|
|
|
1201
1311
|
supportsDeferredResults?: boolean;
|
|
1202
1312
|
}): ProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS>;
|
|
1203
1313
|
|
|
1204
|
-
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<
|
|
1314
|
+
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
|
|
1205
1315
|
|
|
1206
1316
|
/**
|
|
1207
1317
|
* Creates a Response object from a text stream.
|
|
@@ -1227,7 +1337,7 @@ declare function createToolNameMapping({ tools, providerToolNames, resolveProvid
|
|
|
1227
1337
|
/**
|
|
1228
1338
|
* Tools that were passed to the language model.
|
|
1229
1339
|
*/
|
|
1230
|
-
tools: Array<
|
|
1340
|
+
tools: Array<LanguageModelV3FunctionTool | LanguageModelV3ProviderTool> | undefined;
|
|
1231
1341
|
/**
|
|
1232
1342
|
* Maps the provider tool ids to the provider tool names.
|
|
1233
1343
|
*/
|
|
@@ -1236,7 +1346,7 @@ declare function createToolNameMapping({ tools, providerToolNames, resolveProvid
|
|
|
1236
1346
|
* Optional resolver for provider tool names that cannot be represented as
|
|
1237
1347
|
* static id -> name mappings (e.g. dynamic provider names).
|
|
1238
1348
|
*/
|
|
1239
|
-
resolveProviderToolName?: (tool:
|
|
1349
|
+
resolveProviderToolName?: (tool: LanguageModelV3ProviderTool) => string | undefined;
|
|
1240
1350
|
}): ToolNameMapping;
|
|
1241
1351
|
|
|
1242
1352
|
export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESSAGE, 'id' | 'role'> & {
|
|
@@ -1260,7 +1370,7 @@ export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESS
|
|
|
1260
1370
|
export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ execute, onError, // prevent leaking server error details to the client by default
|
|
1261
1371
|
originalMessages, onStepFinish, onFinish, generateId, }: {
|
|
1262
1372
|
execute: (options: {
|
|
1263
|
-
writer:
|
|
1373
|
+
writer: UIMessageStreamWriterWithOutcome<UI_MESSAGE>;
|
|
1264
1374
|
}) => Promise<void> | void;
|
|
1265
1375
|
onError?: (error: unknown) => string;
|
|
1266
1376
|
/**
|
|
@@ -1284,11 +1394,12 @@ export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ ex
|
|
|
1284
1394
|
* @param options.statusText - The HTTP status text for the response.
|
|
1285
1395
|
* @param options.headers - Additional HTTP headers to include in the response.
|
|
1286
1396
|
* @param options.stream - The UI message chunk stream to send.
|
|
1397
|
+
* @param options.keepAliveMs - Optional interval for sending SSE keep-alive comments.
|
|
1287
1398
|
* @param options.consumeSseStream - Optional callback to consume a copy of the SSE stream independently.
|
|
1288
1399
|
*
|
|
1289
1400
|
* @returns A `Response` object with the UI message stream as the body.
|
|
1290
1401
|
*/
|
|
1291
|
-
export declare function createUIMessageStreamResponse({ status, statusText, headers, stream, consumeSseStream, }: UIMessageStreamResponseInit & {
|
|
1402
|
+
export declare function createUIMessageStreamResponse({ status, statusText, headers, stream, keepAliveMs, consumeSseStream, }: UIMessageStreamResponseInit & {
|
|
1292
1403
|
stream: ReadableStream<UIMessageChunk>;
|
|
1293
1404
|
}): Response;
|
|
1294
1405
|
|
|
@@ -1373,7 +1484,15 @@ declare type DeepPartialInternal<T> = T extends null | undefined | string | numb
|
|
|
1373
1484
|
declare const DEFAULT_MAX_DOWNLOAD_SIZE: number;
|
|
1374
1485
|
|
|
1375
1486
|
export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends HttpChatTransport<UI_MESSAGE> {
|
|
1376
|
-
|
|
1487
|
+
readonly resumeStreamIsReplay: boolean;
|
|
1488
|
+
constructor({ resumeStreamIsReplay, ...options }?: HttpChatTransportInitOptions<UI_MESSAGE> & {
|
|
1489
|
+
/**
|
|
1490
|
+
* Whether resumed streams replay the response from the beginning.
|
|
1491
|
+
* Defaults to true. Set to false for endpoints that only continue the
|
|
1492
|
+
* interrupted response, even when they emit a start chunk.
|
|
1493
|
+
*/
|
|
1494
|
+
resumeStreamIsReplay?: boolean;
|
|
1495
|
+
});
|
|
1377
1496
|
protected processResponseStream(stream: ReadableStream<Uint8Array<ArrayBufferLike>>): ReadableStream<UIMessageChunk>;
|
|
1378
1497
|
}
|
|
1379
1498
|
|
|
@@ -1467,7 +1586,7 @@ declare class DelayedPromise<T> {
|
|
|
1467
1586
|
* });
|
|
1468
1587
|
* ```
|
|
1469
1588
|
*/
|
|
1470
|
-
export declare class DirectChatTransport<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends
|
|
1589
|
+
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
1590
|
private readonly agent;
|
|
1472
1591
|
private readonly agentOptions;
|
|
1473
1592
|
private readonly uiMessageStreamOptions;
|
|
@@ -1485,7 +1604,7 @@ export declare class DirectChatTransport<CALL_OPTIONS = never, TOOLS extends Too
|
|
|
1485
1604
|
/**
|
|
1486
1605
|
* Options for the `DirectChatTransport` class.
|
|
1487
1606
|
*/
|
|
1488
|
-
export declare type DirectChatTransportOptions<CALL_OPTIONS, TOOLS extends ToolSet, OUTPUT extends
|
|
1607
|
+
export declare type DirectChatTransportOptions<CALL_OPTIONS, TOOLS extends ToolSet, OUTPUT extends OutputInterface, UI_MESSAGE extends UIMessage<unknown, never, InferUITools<TOOLS>>> = {
|
|
1489
1608
|
/**
|
|
1490
1609
|
* The agent to use for generating responses.
|
|
1491
1610
|
*/
|
|
@@ -1512,7 +1631,7 @@ declare function downloadBlob(url: string, options?: {
|
|
|
1512
1631
|
abortSignal?: AbortSignal;
|
|
1513
1632
|
}): Promise<Blob>;
|
|
1514
1633
|
|
|
1515
|
-
export declare class DownloadError extends
|
|
1634
|
+
export declare class DownloadError extends AISDKError {
|
|
1516
1635
|
private readonly [symbol_2];
|
|
1517
1636
|
readonly url: string;
|
|
1518
1637
|
readonly statusCode?: number;
|
|
@@ -1534,7 +1653,7 @@ export declare function dynamicTool(tool: {
|
|
|
1534
1653
|
description?: string;
|
|
1535
1654
|
title?: string;
|
|
1536
1655
|
providerOptions?: ProviderOptions;
|
|
1537
|
-
metadata?:
|
|
1656
|
+
metadata?: JSONObject;
|
|
1538
1657
|
inputSchema: FlexibleSchema<unknown>;
|
|
1539
1658
|
execute: ToolExecuteFunction<unknown, unknown>;
|
|
1540
1659
|
/**
|
|
@@ -1609,6 +1728,13 @@ export declare type DynamicToolResult = {
|
|
|
1609
1728
|
|
|
1610
1729
|
export declare type DynamicToolUIPart = {
|
|
1611
1730
|
type: 'dynamic-tool';
|
|
1731
|
+
/**
|
|
1732
|
+
* `false` when a static tool part was normalized to a dynamic tool part
|
|
1733
|
+
* because its current tool schema was unavailable or incompatible.
|
|
1734
|
+
*
|
|
1735
|
+
* This preserves its static origin across persistence boundaries.
|
|
1736
|
+
*/
|
|
1737
|
+
dynamic?: false;
|
|
1612
1738
|
/**
|
|
1613
1739
|
* Name of the tool that is being called.
|
|
1614
1740
|
*/
|
|
@@ -1626,6 +1752,15 @@ export declare type DynamicToolUIPart = {
|
|
|
1626
1752
|
} & ({
|
|
1627
1753
|
state: 'input-streaming';
|
|
1628
1754
|
input?: unknown;
|
|
1755
|
+
/**
|
|
1756
|
+
* The raw tool input text received so far.
|
|
1757
|
+
*
|
|
1758
|
+
* This is used to continue input streaming when a message is persisted
|
|
1759
|
+
* and later resumed.
|
|
1760
|
+
*/
|
|
1761
|
+
rawInput?: string;
|
|
1762
|
+
/** Encoding of `rawInput`. Defaults to JSON when omitted. */
|
|
1763
|
+
inputEncoding?: 'json' | 'text';
|
|
1629
1764
|
output?: never;
|
|
1630
1765
|
errorText?: never;
|
|
1631
1766
|
callProviderMetadata?: ProviderMetadata;
|
|
@@ -1646,8 +1781,10 @@ export declare type DynamicToolUIPart = {
|
|
|
1646
1781
|
approval: {
|
|
1647
1782
|
id: string;
|
|
1648
1783
|
approved?: never;
|
|
1784
|
+
descriptor?: unknown;
|
|
1649
1785
|
reason?: never;
|
|
1650
1786
|
signature?: string;
|
|
1787
|
+
inputSchemaInput?: unknown;
|
|
1651
1788
|
};
|
|
1652
1789
|
} | {
|
|
1653
1790
|
state: 'approval-responded';
|
|
@@ -1658,8 +1795,10 @@ export declare type DynamicToolUIPart = {
|
|
|
1658
1795
|
approval: {
|
|
1659
1796
|
id: string;
|
|
1660
1797
|
approved: boolean;
|
|
1798
|
+
descriptor?: unknown;
|
|
1661
1799
|
reason?: string;
|
|
1662
1800
|
signature?: string;
|
|
1801
|
+
inputSchemaInput?: unknown;
|
|
1663
1802
|
};
|
|
1664
1803
|
} | {
|
|
1665
1804
|
state: 'output-available';
|
|
@@ -1672,8 +1811,10 @@ export declare type DynamicToolUIPart = {
|
|
|
1672
1811
|
approval?: {
|
|
1673
1812
|
id: string;
|
|
1674
1813
|
approved: true;
|
|
1814
|
+
descriptor?: unknown;
|
|
1675
1815
|
reason?: string;
|
|
1676
1816
|
signature?: string;
|
|
1817
|
+
inputSchemaInput?: unknown;
|
|
1677
1818
|
};
|
|
1678
1819
|
} | {
|
|
1679
1820
|
state: 'output-error';
|
|
@@ -1685,8 +1826,10 @@ export declare type DynamicToolUIPart = {
|
|
|
1685
1826
|
approval?: {
|
|
1686
1827
|
id: string;
|
|
1687
1828
|
approved: true;
|
|
1829
|
+
descriptor?: unknown;
|
|
1688
1830
|
reason?: string;
|
|
1689
1831
|
signature?: string;
|
|
1832
|
+
inputSchemaInput?: unknown;
|
|
1690
1833
|
};
|
|
1691
1834
|
} | {
|
|
1692
1835
|
state: 'output-denied';
|
|
@@ -1697,8 +1840,10 @@ export declare type DynamicToolUIPart = {
|
|
|
1697
1840
|
approval: {
|
|
1698
1841
|
id: string;
|
|
1699
1842
|
approved: false;
|
|
1843
|
+
descriptor?: unknown;
|
|
1700
1844
|
reason?: string;
|
|
1701
1845
|
signature?: string;
|
|
1846
|
+
inputSchemaInput?: unknown;
|
|
1702
1847
|
};
|
|
1703
1848
|
});
|
|
1704
1849
|
|
|
@@ -1786,11 +1931,11 @@ export declare type EmbeddingModel = string | EmbeddingModelV3 | EmbeddingModelV
|
|
|
1786
1931
|
export declare type EmbeddingModelMiddleware = EmbeddingModelV3Middleware;
|
|
1787
1932
|
|
|
1788
1933
|
declare type EmbeddingModelProviderOptionsTransformer = (options: {
|
|
1789
|
-
providerOptions:
|
|
1934
|
+
providerOptions: SharedV3ProviderOptions | undefined;
|
|
1790
1935
|
values: Array<string>;
|
|
1791
1936
|
startIndex: number;
|
|
1792
1937
|
endIndex: number;
|
|
1793
|
-
}) =>
|
|
1938
|
+
}) => SharedV3ProviderOptions | undefined | PromiseLike<SharedV3ProviderOptions | undefined>;
|
|
1794
1939
|
|
|
1795
1940
|
/**
|
|
1796
1941
|
* Represents the number of tokens used in an embedding.
|
|
@@ -2080,8 +2225,9 @@ declare type EmbeddingModelV3Result = {
|
|
|
2080
2225
|
* Embed several values using an embedding model. The type of the value is defined
|
|
2081
2226
|
* by the embedding model.
|
|
2082
2227
|
*
|
|
2083
|
-
* `embedMany` automatically splits large requests into smaller chunks
|
|
2084
|
-
* has a limit on
|
|
2228
|
+
* `embedMany` automatically splits large requests into smaller chunks when the
|
|
2229
|
+
* model has a limit on either the number of embeddings or the UTF-8 input bytes
|
|
2230
|
+
* that can be processed in a single call.
|
|
2085
2231
|
*
|
|
2086
2232
|
* @param model - The embedding model to use.
|
|
2087
2233
|
* @param values - The values that should be embedded.
|
|
@@ -2230,6 +2376,21 @@ export declare class EmptyResponseBodyError extends AISDKError {
|
|
|
2230
2376
|
static isInstance(error: unknown): error is EmptyResponseBodyError;
|
|
2231
2377
|
}
|
|
2232
2378
|
|
|
2379
|
+
/**
|
|
2380
|
+
* Encodes a raw identifier as one URL path segment, including standalone dot
|
|
2381
|
+
* segments that URL parsers would otherwise normalize. Pass unencoded values;
|
|
2382
|
+
* for resource paths with intentional slashes, encode each segment separately.
|
|
2383
|
+
*/
|
|
2384
|
+
declare function encodePathSegment(value: string): string;
|
|
2385
|
+
|
|
2386
|
+
declare type EnforcedToolChoice = Extract<LanguageModelV3ToolChoice, {
|
|
2387
|
+
type: 'none';
|
|
2388
|
+
} | {
|
|
2389
|
+
type: 'required';
|
|
2390
|
+
} | {
|
|
2391
|
+
type: 'tool';
|
|
2392
|
+
}>;
|
|
2393
|
+
|
|
2233
2394
|
declare type EnrichedStreamPart<TOOLS extends ToolSet, PARTIAL_OUTPUT> = {
|
|
2234
2395
|
part: TextStreamPart<TOOLS>;
|
|
2235
2396
|
partialOutput: PARTIAL_OUTPUT | undefined;
|
|
@@ -2276,7 +2437,7 @@ declare interface EventSourceMessage {
|
|
|
2276
2437
|
* const eventStream =
|
|
2277
2438
|
* response.body
|
|
2278
2439
|
* .pipeThrough(new TextDecoderStream())
|
|
2279
|
-
* .pipeThrough(new EventSourceParserStream({
|
|
2440
|
+
* .pipeThrough(new EventSourceParserStream({onError: 'terminate'}))
|
|
2280
2441
|
* ```
|
|
2281
2442
|
*
|
|
2282
2443
|
* @public
|
|
@@ -2285,7 +2446,7 @@ declare class EventSourceParserStream extends TransformStream<
|
|
|
2285
2446
|
string,
|
|
2286
2447
|
EventSourceMessage
|
|
2287
2448
|
> {
|
|
2288
|
-
constructor({ onError, onRetry, onComment }?: StreamOptions);
|
|
2449
|
+
constructor({ onError, onRetry, onComment, maxBufferSize }?: StreamOptions);
|
|
2289
2450
|
}
|
|
2290
2451
|
|
|
2291
2452
|
declare type ExaSearchCategory = 'company' | 'people' | 'research paper' | 'news' | 'personal site' | 'financial report';
|
|
@@ -2611,9 +2772,10 @@ export declare function experimental_generateVideo({ model: modelArg, prompt: pr
|
|
|
2611
2772
|
*/
|
|
2612
2773
|
maxVideosPerCall?: number;
|
|
2613
2774
|
/**
|
|
2614
|
-
* Aspect ratio of the videos to generate. Must have the format
|
|
2775
|
+
* Aspect ratio of the videos to generate. Must have the format
|
|
2776
|
+
* `{width}:{height}`, or `'adaptive'` to inherit the ratio from the input media.
|
|
2615
2777
|
*/
|
|
2616
|
-
aspectRatio?: `${number}:${number}
|
|
2778
|
+
aspectRatio?: `${number}:${number}` | 'adaptive';
|
|
2617
2779
|
/**
|
|
2618
2780
|
* Resolution of the videos to generate. Must have the format `{width}x{height}`.
|
|
2619
2781
|
*/
|
|
@@ -2881,38 +3043,82 @@ declare function extractResponseHeaders(response: Response): {
|
|
|
2881
3043
|
declare type FetchFunction = typeof globalThis.fetch;
|
|
2882
3044
|
|
|
2883
3045
|
/**
|
|
2884
|
-
* Fetches
|
|
3046
|
+
* Fetches one validated URL without following redirects.
|
|
3047
|
+
*
|
|
3048
|
+
* On Node.js, the default fetch validates and pins DNS results at connect time.
|
|
3049
|
+
* An injected fetch is responsible for equivalent connect-time validation.
|
|
3050
|
+
* Redirects are rejected by default. Callers using `redirect: 'manual'` must
|
|
3051
|
+
* validate the Location target before issuing another request.
|
|
3052
|
+
*/
|
|
3053
|
+
declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, trustedOrigin, redirect, }: {
|
|
3054
|
+
url: string | URL;
|
|
3055
|
+
init?: RequestInit;
|
|
3056
|
+
fetch?: FetchFunction;
|
|
3057
|
+
/**
|
|
3058
|
+
* A developer-configured origin that may legitimately resolve to a private
|
|
3059
|
+
* address. This must never be derived from untrusted response data.
|
|
3060
|
+
*/
|
|
3061
|
+
trustedOrigin?: string;
|
|
3062
|
+
redirect?: 'error' | 'manual';
|
|
3063
|
+
}): Promise<Response>;
|
|
3064
|
+
|
|
3065
|
+
/**
|
|
3066
|
+
* Fetches a URL while enforcing the download guard on every hop.
|
|
2885
3067
|
*
|
|
2886
3068
|
* Redirects are followed manually (`redirect: 'manual'`) so each hop is
|
|
2887
3069
|
* validated with {@link validateDownloadUrl} *before* it is requested. Relying
|
|
2888
3070
|
* on the default `redirect: 'follow'` would issue the request to a redirect
|
|
2889
3071
|
* target (e.g. an internal address) before we ever see its URL, defeating the
|
|
2890
|
-
*
|
|
3072
|
+
* guard.
|
|
3073
|
+
*
|
|
3074
|
+
* Request headers are also protected: {@link sanitizeRequestHeaders} strips
|
|
3075
|
+
* proxy/metadata/cookie/hop-by-hop headers before the first request, and all
|
|
3076
|
+
* caller headers except `User-Agent` are dropped on a cross-origin redirect.
|
|
3077
|
+
* Credentials and custom headers are preserved on the first hop for backwards
|
|
3078
|
+
* compatibility. The caller must ensure that the initial URL may receive them.
|
|
3079
|
+
* The fetch spec only strips `Authorization` on cross-origin redirects because
|
|
3080
|
+
* in a browser, CORS preflighting protects custom headers; there is no CORS on
|
|
3081
|
+
* the server, so provider API keys carried in custom headers (e.g. `x-key`)
|
|
3082
|
+
* must be dropped here as well.
|
|
2891
3083
|
*
|
|
2892
3084
|
* A `redirect: 'manual'` request yields an unreadable opaque response in the
|
|
2893
3085
|
* browser (and in other spec-compliant fetch implementations), so the redirect
|
|
2894
3086
|
* 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
|
|
3087
|
+
* natively because reaching an internal network is not possible (fetch is
|
|
3088
|
+
* constrained by CORS and cannot reach a server's internal network or
|
|
3089
|
+
* cloud-metadata). On any other runtime we cannot validate the hop, so we fail
|
|
3090
|
+
* closed rather than follow it blindly and bypass the guard.
|
|
3091
|
+
*
|
|
3092
|
+
* A hop that is same-origin with `trustedOrigin` (the developer-configured
|
|
3093
|
+
* provider endpoint) skips target validation: that origin is exactly what an
|
|
3094
|
+
* unvalidated, config-derived request would fetch anyway, and validating it
|
|
3095
|
+
* would break legitimate self-hosted / localhost deployments whose response
|
|
3096
|
+
* URLs point back at the configured host. Hops on any other origin are always
|
|
3097
|
+
* validated.
|
|
2899
3098
|
*
|
|
2900
3099
|
* The returned response is the final (non-redirect) response. The caller is
|
|
2901
3100
|
* responsible for checking `response.ok` and reading the body.
|
|
2902
3101
|
*
|
|
2903
3102
|
* On Node.js, the default fetch resolves every hostname through a validating
|
|
2904
3103
|
* lookup hook and passes those exact addresses to the connector, preventing
|
|
2905
|
-
* hostname-to-private-IP and DNS-rebinding bypasses.
|
|
3104
|
+
* hostname-to-private-IP and DNS-rebinding bypasses. An injected fetch is
|
|
3105
|
+
* responsible for equivalent connect-time validation. Other runtimes should
|
|
2906
3106
|
* constrain egress at the network layer when handling untrusted URLs.
|
|
2907
3107
|
*
|
|
2908
3108
|
* @throws DownloadError if a hop is unsafe, the redirect limit is exceeded, or
|
|
2909
3109
|
* a redirect cannot be validated on a non-browser runtime.
|
|
2910
3110
|
*/
|
|
2911
|
-
declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, }: {
|
|
3111
|
+
declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, fetch: customFetch, trustedOrigin, }: {
|
|
2912
3112
|
url: string;
|
|
2913
3113
|
headers?: HeadersInit;
|
|
2914
3114
|
abortSignal?: AbortSignal;
|
|
2915
3115
|
maxRedirects?: number;
|
|
3116
|
+
fetch?: FetchFunction;
|
|
3117
|
+
/**
|
|
3118
|
+
* A developer-configured origin (e.g. the provider's `baseURL`) whose hops
|
|
3119
|
+
* skip target validation. Must never be derived from response data.
|
|
3120
|
+
*/
|
|
3121
|
+
trustedOrigin?: string;
|
|
2916
3122
|
}): Promise<Response>;
|
|
2917
3123
|
|
|
2918
3124
|
/**
|
|
@@ -2995,7 +3201,7 @@ declare interface GatewayCreditsResponse {
|
|
|
2995
3201
|
totalUsed: string;
|
|
2996
3202
|
}
|
|
2997
3203
|
|
|
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 & {});
|
|
3204
|
+
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
3205
|
|
|
3000
3206
|
declare interface GatewayFetchMetadataResponse {
|
|
3001
3207
|
models: GatewayLanguageModelEntry[];
|
|
@@ -3045,7 +3251,7 @@ declare interface GatewayGenerationInfoParams {
|
|
|
3045
3251
|
id: string;
|
|
3046
3252
|
}
|
|
3047
3253
|
|
|
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' | '
|
|
3254
|
+
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-3-image-klein' | '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-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
3255
|
|
|
3050
3256
|
declare interface GatewayLanguageModelEntry {
|
|
3051
3257
|
/**
|
|
@@ -3096,7 +3302,7 @@ declare interface GatewayLanguageModelEntry {
|
|
|
3096
3302
|
|
|
3097
3303
|
declare type GatewayLanguageModelSpecification = Pick<LanguageModelV3, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
3098
3304
|
|
|
3099
|
-
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/
|
|
3305
|
+
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-1017' | 'deepseek/deepseek-v4.1-flash-1017-fast' | 'deepseek/deepseek-v4.1-flash-fast' | 'elorian/glimpse' | '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-3' | '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' | 'minimax/minimax-m3.1-flash' | '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' | 'moonshotai/kimi-k3.1-pro' | 'moonshotai/kimi-k3.1-pro-highspeed' | '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-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-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-6.1-terra' | 'openai/gpt-6.1-terra-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' | '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' | 'scaledown/scaledown-extract-1' | 'scaledown/scaledown-summarize-1' | '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/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
3306
|
|
|
3101
3307
|
declare interface GatewayProvider extends ProviderV3 {
|
|
3102
3308
|
(modelId: GatewayModelId): LanguageModelV3;
|
|
@@ -3208,9 +3414,9 @@ declare interface GatewayProviderSettings {
|
|
|
3208
3414
|
metadataCacheRefreshMillis?: number;
|
|
3209
3415
|
}
|
|
3210
3416
|
|
|
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 & {});
|
|
3417
|
+
declare type GatewayRerankingModelId = 'cohere/rerank-v3.5' | 'cohere/rerank-v4-fast' | 'cohere/rerank-v4-pro' | 'cohere/rerank-v5-fast' | 'cohere/rerank-v5-pro' | 'voyage/rerank-2.5' | 'voyage/rerank-2.5-lite' | 'voyage/rerank-3' | 'voyage/rerank-3-lite' | (string & {});
|
|
3212
3418
|
|
|
3213
|
-
declare type GatewaySpeechModelId = 'openai/tts-1' | 'openai/tts-1-hd' | '
|
|
3419
|
+
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' | 'mistral/voxtral-mini-tts-3' | 'openai/tts-1' | 'openai/tts-1-hd' | 'spacexai/grok-tts' | (string & {});
|
|
3214
3420
|
|
|
3215
3421
|
declare interface GatewaySpendReportParams {
|
|
3216
3422
|
/** Start date in YYYY-MM-DD format (inclusive) */
|
|
@@ -3274,6 +3480,20 @@ declare interface GatewaySpendReportRow {
|
|
|
3274
3480
|
* Gateway-specific provider-defined tools.
|
|
3275
3481
|
*/
|
|
3276
3482
|
declare const gatewayTools: {
|
|
3483
|
+
/**
|
|
3484
|
+
* Fetch page content using Browserbase's lightweight Fetch API.
|
|
3485
|
+
*
|
|
3486
|
+
* Supports raw, Markdown, and schema-driven JSON output as well as redirects,
|
|
3487
|
+
* proxy routing, and TLS controls.
|
|
3488
|
+
*/
|
|
3489
|
+
browserbaseFetch: (config?: BrowserbaseFetchConfig) => ReturnType<typeof browserbaseFetchToolFactory>;
|
|
3490
|
+
/**
|
|
3491
|
+
* Search the web using Browserbase's Search API for fast, structured results.
|
|
3492
|
+
*
|
|
3493
|
+
* Returns titles, URLs, and available publication metadata without requiring
|
|
3494
|
+
* a browser session.
|
|
3495
|
+
*/
|
|
3496
|
+
browserbaseSearch: (config?: BrowserbaseSearchConfig) => ReturnType<typeof browserbaseSearchToolFactory>;
|
|
3277
3497
|
/**
|
|
3278
3498
|
* Search the web using Exa for current information and token-efficient
|
|
3279
3499
|
* excerpts optimized for agent workflows.
|
|
@@ -3299,11 +3519,20 @@ declare const gatewayTools: {
|
|
|
3299
3519
|
* domain, language, date range, and recency filters.
|
|
3300
3520
|
*/
|
|
3301
3521
|
perplexitySearch: (config?: PerplexitySearchConfig) => ReturnType<typeof perplexitySearchToolFactory>;
|
|
3522
|
+
/**
|
|
3523
|
+
* Search the web and Tako's curated knowledge graph in one call for
|
|
3524
|
+
* token-efficient web excerpts and structured data results grounded in
|
|
3525
|
+
* premium sources, each with an embed-ready visualization.
|
|
3526
|
+
*
|
|
3527
|
+
* Supports effort, per-source web and data controls, localization, and inline
|
|
3528
|
+
* contents for agents that need to reason over underlying data.
|
|
3529
|
+
*/
|
|
3530
|
+
takoSearch: (config?: TakoSearchConfig) => ReturnType<typeof takoSearchToolFactory>;
|
|
3302
3531
|
};
|
|
3303
3532
|
|
|
3304
|
-
declare type GatewayTranscriptionModelId = 'openai/gpt-4o-mini-transcribe' | 'openai/gpt-4o-transcribe' | 'openai/gpt-realtime-whisper' | 'openai/whisper-1' | '
|
|
3533
|
+
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' | 'mistral/voxtral-mini-transcribe-3' | 'mistral/voxtral-small-transcribe-3' | 'openai/gpt-4o-mini-transcribe' | 'openai/gpt-4o-transcribe' | 'openai/gpt-realtime-whisper' | 'openai/whisper-1' | 'spacexai/grok-stt' | (string & {});
|
|
3305
3534
|
|
|
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' | '
|
|
3535
|
+
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
3536
|
|
|
3308
3537
|
/**
|
|
3309
3538
|
* A generated audio file.
|
|
@@ -3355,7 +3584,7 @@ export declare const generateId: IdGenerator;
|
|
|
3355
3584
|
* @param seed - Seed for the image generation.
|
|
3356
3585
|
* @param providerOptions - Additional provider-specific options that are passed through to the provider
|
|
3357
3586
|
* as body parameters.
|
|
3358
|
-
* @param maxRetries - Maximum number of retries. Set to 0 to disable retries. Default: 2.
|
|
3587
|
+
* @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
3588
|
* @param abortSignal - An optional abort signal that can be used to cancel the call.
|
|
3360
3589
|
* @param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
|
|
3361
3590
|
*
|
|
@@ -3406,7 +3635,9 @@ export declare function generateImage({ model: modelArg, prompt: promptArg, n, m
|
|
|
3406
3635
|
*/
|
|
3407
3636
|
providerOptions?: ProviderOptions;
|
|
3408
3637
|
/**
|
|
3409
|
-
* Maximum number of retries per image model call
|
|
3638
|
+
* Maximum number of retries per image model call, including retries after
|
|
3639
|
+
* unclassified empty responses. Empty responses marked as not retryable by
|
|
3640
|
+
* the provider are not retried. Set to 0 to disable retries.
|
|
3410
3641
|
*
|
|
3411
3642
|
* @default 2
|
|
3412
3643
|
*/
|
|
@@ -3691,7 +3922,7 @@ export declare interface GenerateObjectResult<OBJECT> {
|
|
|
3691
3922
|
* @returns
|
|
3692
3923
|
* A result object that contains the generated text, the results of the tool calls, and additional information.
|
|
3693
3924
|
*/
|
|
3694
|
-
export declare function generateText<TOOLS extends ToolSet, OUTPUT extends
|
|
3925
|
+
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
3926
|
/**
|
|
3696
3927
|
* The language model to use.
|
|
3697
3928
|
*/
|
|
@@ -3856,7 +4087,7 @@ export declare type GenerateTextOnFinishCallback<TOOLS extends ToolSet> = (event
|
|
|
3856
4087
|
*
|
|
3857
4088
|
* @param event - The event object containing generation configuration.
|
|
3858
4089
|
*/
|
|
3859
|
-
export declare type GenerateTextOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends
|
|
4090
|
+
export declare type GenerateTextOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface> = (event: OnStartEvent<TOOLS, OUTPUT, GenerateTextIncludeSettings>) => PromiseLike<void> | void;
|
|
3860
4091
|
|
|
3861
4092
|
/**
|
|
3862
4093
|
* Callback that is set using the `onStepFinish` option.
|
|
@@ -3877,7 +4108,7 @@ export declare type GenerateTextOnStepFinishCallback<TOOLS extends ToolSet> = (e
|
|
|
3877
4108
|
*
|
|
3878
4109
|
* @param event - The event object containing step configuration.
|
|
3879
4110
|
*/
|
|
3880
|
-
export declare type GenerateTextOnStepStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends
|
|
4111
|
+
export declare type GenerateTextOnStepStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface> = (event: OnStepStartEvent<TOOLS, OUTPUT, GenerateTextIncludeSettings>) => PromiseLike<void> | void;
|
|
3881
4112
|
|
|
3882
4113
|
/**
|
|
3883
4114
|
* Callback that is set using the `experimental_onToolCallFinish` option.
|
|
@@ -3907,7 +4138,7 @@ export declare type GenerateTextOnToolCallStartCallback<TOOLS extends ToolSet =
|
|
|
3907
4138
|
* The result of a `generateText` call.
|
|
3908
4139
|
* It contains the generated text, the tool calls that were made during the generation, and the results of the tool calls.
|
|
3909
4140
|
*/
|
|
3910
|
-
export declare interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT extends
|
|
4141
|
+
export declare interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT extends OutputInterface> {
|
|
3911
4142
|
/**
|
|
3912
4143
|
* The content that was generated in the last step.
|
|
3913
4144
|
*/
|
|
@@ -4025,7 +4256,8 @@ export declare interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT extend
|
|
|
4025
4256
|
* The generated output according to the `output` specification.
|
|
4026
4257
|
*
|
|
4027
4258
|
* @throws {NoOutputGeneratedError} When no output is available, for example
|
|
4028
|
-
* when the final step
|
|
4259
|
+
* when the final step finishes with a `tool-calls` reason, or when it
|
|
4260
|
+
* contains no text and does not finish with a `stop` reason.
|
|
4029
4261
|
*/
|
|
4030
4262
|
readonly output: InferGenerateOutput<OUTPUT>;
|
|
4031
4263
|
}
|
|
@@ -4065,13 +4297,44 @@ export declare interface GenerateVideoResult {
|
|
|
4065
4297
|
|
|
4066
4298
|
declare function getErrorMessage(error: unknown | undefined): string;
|
|
4067
4299
|
|
|
4068
|
-
declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
|
4300
|
+
declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, validateUrl, credentialedOrigin, trustedOrigin, }: {
|
|
4069
4301
|
url: string;
|
|
4070
4302
|
headers?: Record<string, string | undefined>;
|
|
4071
4303
|
failedResponseHandler: ResponseHandler<Error>;
|
|
4072
4304
|
successfulResponseHandler: ResponseHandler<T>;
|
|
4073
4305
|
abortSignal?: AbortSignal;
|
|
4074
4306
|
fetch?: FetchFunction;
|
|
4307
|
+
/**
|
|
4308
|
+
* Set `true` when `url` is untrusted (e.g. taken from a provider response
|
|
4309
|
+
* body): it is routed through {@link fetchWithValidatedRedirects}, which
|
|
4310
|
+
* rejects private/loopback/link-local targets and re-validates redirect
|
|
4311
|
+
* hops; blocked URLs throw `DownloadError`. Set `false` only for URLs built
|
|
4312
|
+
* from a developer-configured endpoint.
|
|
4313
|
+
*
|
|
4314
|
+
* Optional for backwards compatibility with existing callers; omitting it
|
|
4315
|
+
* behaves like `false` (no validation).
|
|
4316
|
+
*/
|
|
4317
|
+
validateUrl?: boolean;
|
|
4318
|
+
/**
|
|
4319
|
+
* When set, `headers` are sent only if `url` is same-origin with this origin
|
|
4320
|
+
* (the user-agent suffix is always kept). Pass the provider's configured
|
|
4321
|
+
* base URL alongside `validateUrl: true` so credentials never ride a request
|
|
4322
|
+
* to a response-supplied host on a different origin (e.g. a CDN). Redirects
|
|
4323
|
+
* that later cross origin drop all caller headers regardless (see
|
|
4324
|
+
* {@link fetchWithValidatedRedirects}).
|
|
4325
|
+
*/
|
|
4326
|
+
credentialedOrigin?: string;
|
|
4327
|
+
/**
|
|
4328
|
+
* A developer-configured origin (e.g. the provider's `baseURL`) that is
|
|
4329
|
+
* exempt from URL validation when `validateUrl` is `true`. A response URL
|
|
4330
|
+
* (or redirect hop) that is same-origin with it is fetched without target
|
|
4331
|
+
* validation — it points at exactly the host a config-derived
|
|
4332
|
+
* `validateUrl: false` request would fetch anyway, so blocking it would
|
|
4333
|
+
* only break legitimate self-hosted / localhost deployments whose response
|
|
4334
|
+
* URLs point back at the configured host. Hops on any other origin are
|
|
4335
|
+
* still validated. Must never be derived from response data.
|
|
4336
|
+
*/
|
|
4337
|
+
trustedOrigin?: string;
|
|
4075
4338
|
}) => Promise<{
|
|
4076
4339
|
value: T;
|
|
4077
4340
|
rawValue?: unknown;
|
|
@@ -4438,6 +4701,11 @@ declare type ImageModelV3 = {
|
|
|
4438
4701
|
* be returned as binary data.
|
|
4439
4702
|
*/
|
|
4440
4703
|
images: Array<string> | Array<Uint8Array>;
|
|
4704
|
+
/**
|
|
4705
|
+
* Whether an unsuccessful result, such as an empty image result, can be
|
|
4706
|
+
* retried. When omitted, the result is unclassified.
|
|
4707
|
+
*/
|
|
4708
|
+
isRetryable?: boolean;
|
|
4441
4709
|
/**
|
|
4442
4710
|
* Warnings for the call, e.g. unsupported features.
|
|
4443
4711
|
*/
|
|
@@ -4583,42 +4851,6 @@ declare type ImageModelV3File = {
|
|
|
4583
4851
|
providerOptions?: SharedV3ProviderMetadata;
|
|
4584
4852
|
};
|
|
4585
4853
|
|
|
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
4854
|
/**
|
|
4623
4855
|
* Middleware for ImageModelV3.
|
|
4624
4856
|
* This type defines the structure for middleware that can be used to modify
|
|
@@ -4740,19 +4972,19 @@ export { InferAgentUIMessage }
|
|
|
4740
4972
|
/**
|
|
4741
4973
|
* Infers the element type from an array output specification.
|
|
4742
4974
|
*/
|
|
4743
|
-
declare type InferElementOutput<OUTPUT extends
|
|
4975
|
+
declare type InferElementOutput<OUTPUT extends OutputInterface> = OUTPUT extends OutputInterface<any, any, infer ELEMENT> ? ELEMENT : never;
|
|
4744
4976
|
|
|
4745
4977
|
/**
|
|
4746
4978
|
* Infers the complete output type from the output specification.
|
|
4747
4979
|
*/
|
|
4748
|
-
export declare type InferGenerateOutput<OUTPUT extends
|
|
4980
|
+
export declare type InferGenerateOutput<OUTPUT extends OutputInterface> = OUTPUT extends OutputInterface<infer COMPLETE_OUTPUT, any, any> ? COMPLETE_OUTPUT : never;
|
|
4749
4981
|
|
|
4750
4982
|
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
4983
|
|
|
4752
4984
|
/**
|
|
4753
4985
|
* Infers the partial output type from the output specification.
|
|
4754
4986
|
*/
|
|
4755
|
-
export declare type InferStreamOutput<OUTPUT extends
|
|
4987
|
+
export declare type InferStreamOutput<OUTPUT extends OutputInterface> = OUTPUT extends OutputInterface<any, infer PARTIAL_OUTPUT, any> ? PARTIAL_OUTPUT : never;
|
|
4756
4988
|
|
|
4757
4989
|
/**
|
|
4758
4990
|
* Infer the input type of a tool.
|
|
@@ -4802,14 +5034,14 @@ export declare type InferUITools<TOOLS extends ToolSet> = {
|
|
|
4802
5034
|
};
|
|
4803
5035
|
|
|
4804
5036
|
declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPrefix, schemaSuffix, }: {
|
|
4805
|
-
messages:
|
|
5037
|
+
messages: LanguageModelV3Prompt;
|
|
4806
5038
|
schema?: JSONSchema7;
|
|
4807
5039
|
schemaPrefix?: string;
|
|
4808
5040
|
schemaSuffix?: string;
|
|
4809
|
-
}):
|
|
5041
|
+
}): LanguageModelV3Prompt;
|
|
4810
5042
|
|
|
4811
5043
|
export declare class InvalidArgumentError extends AISDKError {
|
|
4812
|
-
private readonly [symbol$
|
|
5044
|
+
private readonly [symbol$j];
|
|
4813
5045
|
readonly parameter: string;
|
|
4814
5046
|
readonly value: unknown;
|
|
4815
5047
|
constructor({ parameter, value, message, }: {
|
|
@@ -4871,7 +5103,7 @@ export declare class InvalidResponseDataError extends AISDKError {
|
|
|
4871
5103
|
}
|
|
4872
5104
|
|
|
4873
5105
|
export declare class InvalidStreamPartError extends AISDKError {
|
|
4874
|
-
private readonly [symbol$
|
|
5106
|
+
private readonly [symbol$i];
|
|
4875
5107
|
readonly chunk: SingleRequestTextStreamPart<any>;
|
|
4876
5108
|
constructor({ chunk, message, }: {
|
|
4877
5109
|
chunk: SingleRequestTextStreamPart<any>;
|
|
@@ -4881,7 +5113,7 @@ export declare class InvalidStreamPartError extends AISDKError {
|
|
|
4881
5113
|
}
|
|
4882
5114
|
|
|
4883
5115
|
export declare class InvalidToolApprovalError extends AISDKError {
|
|
4884
|
-
private readonly [symbol$
|
|
5116
|
+
private readonly [symbol$h];
|
|
4885
5117
|
readonly approvalId: string;
|
|
4886
5118
|
constructor({ approvalId }: {
|
|
4887
5119
|
approvalId: string;
|
|
@@ -4890,7 +5122,7 @@ export declare class InvalidToolApprovalError extends AISDKError {
|
|
|
4890
5122
|
}
|
|
4891
5123
|
|
|
4892
5124
|
export declare class InvalidToolApprovalSignatureError extends AISDKError {
|
|
4893
|
-
private readonly [symbol$
|
|
5125
|
+
private readonly [symbol$g];
|
|
4894
5126
|
readonly approvalId: string;
|
|
4895
5127
|
readonly toolCallId: string;
|
|
4896
5128
|
constructor({ approvalId, toolCallId, reason, }: {
|
|
@@ -4902,7 +5134,7 @@ export declare class InvalidToolApprovalSignatureError extends AISDKError {
|
|
|
4902
5134
|
}
|
|
4903
5135
|
|
|
4904
5136
|
export declare class InvalidToolInputError extends AISDKError {
|
|
4905
|
-
private readonly [symbol$
|
|
5137
|
+
private readonly [symbol$l];
|
|
4906
5138
|
readonly toolName: string;
|
|
4907
5139
|
readonly toolInput: string;
|
|
4908
5140
|
constructor({ toolInput, toolName, cause, message, }: {
|
|
@@ -5031,16 +5263,10 @@ declare type Job = () => Promise<void>;
|
|
|
5031
5263
|
|
|
5032
5264
|
declare type JSONArray = JSONValue_2[];
|
|
5033
5265
|
|
|
5034
|
-
declare type JSONArray_2 = JSONValue_3[];
|
|
5035
|
-
|
|
5036
5266
|
declare type JSONObject = {
|
|
5037
5267
|
[key: string]: JSONValue_2 | undefined;
|
|
5038
5268
|
};
|
|
5039
5269
|
|
|
5040
|
-
declare type JSONObject_2 = {
|
|
5041
|
-
[key: string]: JSONValue_3 | undefined;
|
|
5042
|
-
};
|
|
5043
|
-
|
|
5044
5270
|
export declare class JSONParseError extends AISDKError {
|
|
5045
5271
|
private readonly [symbol$7];
|
|
5046
5272
|
readonly text: string;
|
|
@@ -5051,16 +5277,6 @@ export declare class JSONParseError extends AISDKError {
|
|
|
5051
5277
|
static isInstance(error: unknown): error is JSONParseError;
|
|
5052
5278
|
}
|
|
5053
5279
|
|
|
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
5280
|
/**
|
|
5065
5281
|
* Create a schema using a JSON Schema.
|
|
5066
5282
|
*
|
|
@@ -5090,12 +5306,6 @@ export declare type JSONValue = JSONValue_2;
|
|
|
5090
5306
|
*/
|
|
5091
5307
|
declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
|
|
5092
5308
|
|
|
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
5309
|
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "speech", "transcription", "video"];
|
|
5100
5310
|
|
|
5101
5311
|
declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
|
|
@@ -6118,11 +6328,6 @@ declare type LanguageModelV3Content = LanguageModelV3Text | LanguageModelV3Reaso
|
|
|
6118
6328
|
*/
|
|
6119
6329
|
declare type LanguageModelV3DataContent = Uint8Array | string | URL;
|
|
6120
6330
|
|
|
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
6331
|
/**
|
|
6127
6332
|
* A file that has been generated by the model.
|
|
6128
6333
|
* Generated files as base64 encoded strings or binary data.
|
|
@@ -6151,34 +6356,6 @@ declare type LanguageModelV3File = {
|
|
|
6151
6356
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
6152
6357
|
};
|
|
6153
6358
|
|
|
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
6359
|
/**
|
|
6183
6360
|
* File content part of a prompt. It contains a file.
|
|
6184
6361
|
*/
|
|
@@ -6192,6 +6369,13 @@ declare interface LanguageModelV3FilePart {
|
|
|
6192
6369
|
* File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
6193
6370
|
*/
|
|
6194
6371
|
data: LanguageModelV3DataContent;
|
|
6372
|
+
/**
|
|
6373
|
+
* The original URL string before it was parsed into a URL.
|
|
6374
|
+
*
|
|
6375
|
+
* This is available when parsing changes the string and a provider needs to
|
|
6376
|
+
* preserve an opaque non-HTTP URI exactly.
|
|
6377
|
+
*/
|
|
6378
|
+
originalUrl?: string;
|
|
6195
6379
|
/**
|
|
6196
6380
|
* IANA media type of the file.
|
|
6197
6381
|
*
|
|
@@ -6208,42 +6392,6 @@ declare interface LanguageModelV3FilePart {
|
|
|
6208
6392
|
providerOptions?: SharedV3ProviderOptions;
|
|
6209
6393
|
}
|
|
6210
6394
|
|
|
6211
|
-
/**
|
|
6212
|
-
* File content part of a prompt. It contains a file.
|
|
6213
|
-
*/
|
|
6214
|
-
declare interface LanguageModelV3FilePart_2 {
|
|
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
6395
|
/**
|
|
6248
6396
|
* Reason why a language model finished generating a response.
|
|
6249
6397
|
*
|
|
@@ -6271,33 +6419,6 @@ declare type LanguageModelV3FinishReason = {
|
|
|
6271
6419
|
raw: string | undefined;
|
|
6272
6420
|
};
|
|
6273
6421
|
|
|
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 = {
|
|
6282
|
-
/**
|
|
6283
|
-
* Unified finish reason. This enables using the same finish reason across different providers.
|
|
6284
|
-
*
|
|
6285
|
-
* Can be one of the following:
|
|
6286
|
-
* - `stop`: model generated stop sequence
|
|
6287
|
-
* - `length`: model generated maximum number of tokens
|
|
6288
|
-
* - `content-filter`: content filter violation stopped the model
|
|
6289
|
-
* - `tool-calls`: model triggered tool calls
|
|
6290
|
-
* - `error`: model stopped because of an error
|
|
6291
|
-
* - `other`: model stopped for other reasons
|
|
6292
|
-
*/
|
|
6293
|
-
unified: 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
|
|
6294
|
-
/**
|
|
6295
|
-
* Raw finish reason from the provider.
|
|
6296
|
-
* This is the original finish reason from the provider.
|
|
6297
|
-
*/
|
|
6298
|
-
raw: string | undefined;
|
|
6299
|
-
};
|
|
6300
|
-
|
|
6301
6422
|
/**
|
|
6302
6423
|
* A tool has a name, a description, and a set of parameters.
|
|
6303
6424
|
*
|
|
@@ -6344,52 +6465,6 @@ declare type LanguageModelV3FunctionTool = {
|
|
|
6344
6465
|
providerOptions?: SharedV3ProviderOptions;
|
|
6345
6466
|
};
|
|
6346
6467
|
|
|
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
6468
|
/**
|
|
6394
6469
|
* The result of a language model doGenerate call.
|
|
6395
6470
|
*/
|
|
@@ -6461,27 +6536,6 @@ declare type LanguageModelV3Message = ({
|
|
|
6461
6536
|
providerOptions?: SharedV3ProviderOptions;
|
|
6462
6537
|
};
|
|
6463
6538
|
|
|
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
6539
|
/**
|
|
6486
6540
|
* Experimental middleware for LanguageModelV3.
|
|
6487
6541
|
* This type defines the structure for middleware that can be used to modify
|
|
@@ -6571,17 +6625,6 @@ declare type LanguageModelV3Middleware = {
|
|
|
6571
6625
|
*/
|
|
6572
6626
|
declare type LanguageModelV3Prompt = Array<LanguageModelV3Message>;
|
|
6573
6627
|
|
|
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
6628
|
/**
|
|
6586
6629
|
* The configuration of a provider tool.
|
|
6587
6630
|
*
|
|
@@ -6608,32 +6651,6 @@ declare type LanguageModelV3ProviderTool = {
|
|
|
6608
6651
|
args: Record<string, unknown>;
|
|
6609
6652
|
};
|
|
6610
6653
|
|
|
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
6654
|
/**
|
|
6638
6655
|
* Reasoning that the model has generated.
|
|
6639
6656
|
*/
|
|
@@ -6663,23 +6680,6 @@ declare interface LanguageModelV3ReasoningPart {
|
|
|
6663
6680
|
providerOptions?: SharedV3ProviderOptions;
|
|
6664
6681
|
}
|
|
6665
6682
|
|
|
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
6683
|
declare interface LanguageModelV3ResponseMetadata {
|
|
6684
6684
|
/**
|
|
6685
6685
|
* ID for the generated response, if the provider sends one.
|
|
@@ -6695,21 +6695,6 @@ declare interface LanguageModelV3ResponseMetadata {
|
|
|
6695
6695
|
modelId?: string;
|
|
6696
6696
|
}
|
|
6697
6697
|
|
|
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
6698
|
/**
|
|
6714
6699
|
* A source that has been used as input to generate the response.
|
|
6715
6700
|
*/
|
|
@@ -6763,59 +6748,6 @@ declare type LanguageModelV3Source = {
|
|
|
6763
6748
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
6764
6749
|
};
|
|
6765
6750
|
|
|
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
6751
|
declare type LanguageModelV3StreamPart = {
|
|
6820
6752
|
type: 'text-start';
|
|
6821
6753
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
@@ -6846,6 +6778,12 @@ declare type LanguageModelV3StreamPart = {
|
|
|
6846
6778
|
type: 'tool-input-start';
|
|
6847
6779
|
id: string;
|
|
6848
6780
|
toolName: string;
|
|
6781
|
+
/**
|
|
6782
|
+
* Encoding of the input deltas. Defaults to JSON when omitted.
|
|
6783
|
+
* Text deltas concatenate to a raw string. The final tool-call input
|
|
6784
|
+
* must still be JSON-encoded, regardless of the delta encoding.
|
|
6785
|
+
*/
|
|
6786
|
+
inputEncoding?: 'json' | 'text';
|
|
6849
6787
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
6850
6788
|
providerExecuted?: boolean;
|
|
6851
6789
|
dynamic?: boolean;
|
|
@@ -6877,67 +6815,6 @@ declare type LanguageModelV3StreamPart = {
|
|
|
6877
6815
|
error: unknown;
|
|
6878
6816
|
};
|
|
6879
6817
|
|
|
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
6818
|
/**
|
|
6942
6819
|
* The result of a language model doStream call.
|
|
6943
6820
|
*/
|
|
@@ -6995,23 +6872,6 @@ declare interface LanguageModelV3TextPart {
|
|
|
6995
6872
|
providerOptions?: SharedV3ProviderOptions;
|
|
6996
6873
|
}
|
|
6997
6874
|
|
|
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
6875
|
/**
|
|
7016
6876
|
* Tool approval request emitted by a provider for a provider-executed tool call.
|
|
7017
6877
|
*
|
|
@@ -7035,29 +6895,6 @@ declare type LanguageModelV3ToolApprovalRequest = {
|
|
|
7035
6895
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
7036
6896
|
};
|
|
7037
6897
|
|
|
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
6898
|
/**
|
|
7062
6899
|
* Tool approval response content part of a prompt. It contains the user's
|
|
7063
6900
|
* decision to approve or deny a provider-executed tool call.
|
|
@@ -7083,425 +6920,129 @@ declare interface LanguageModelV3ToolApprovalResponsePart {
|
|
|
7083
6920
|
*/
|
|
7084
6921
|
providerOptions?: SharedV3ProviderOptions;
|
|
7085
6922
|
}
|
|
7086
|
-
|
|
7087
|
-
/**
|
|
7088
|
-
* Tool
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
*
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
*
|
|
7108
|
-
*
|
|
7109
|
-
*/
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
*
|
|
7129
|
-
*/
|
|
7130
|
-
|
|
7131
|
-
/**
|
|
7132
|
-
*
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
*
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
*
|
|
7192
|
-
*/
|
|
7193
|
-
|
|
7194
|
-
/**
|
|
7195
|
-
*
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
*
|
|
7201
|
-
*/
|
|
7202
|
-
|
|
7203
|
-
/**
|
|
7204
|
-
* Additional provider-specific options. They are passed through
|
|
7205
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
7206
|
-
* functionality that can be fully encapsulated in the provider.
|
|
7207
|
-
*/
|
|
7208
|
-
providerOptions?: SharedV3ProviderOptions;
|
|
7209
|
-
}
|
|
7210
|
-
|
|
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
|
-
declare type LanguageModelV3ToolChoice = {
|
|
7242
|
-
type: 'auto';
|
|
7243
|
-
} | {
|
|
7244
|
-
type: 'none';
|
|
7245
|
-
} | {
|
|
7246
|
-
type: 'required';
|
|
7247
|
-
} | {
|
|
7248
|
-
type: 'tool';
|
|
7249
|
-
toolName: string;
|
|
7250
|
-
};
|
|
7251
|
-
|
|
7252
|
-
/**
|
|
7253
|
-
* Result of a tool call that has been executed by the provider.
|
|
7254
|
-
*/
|
|
7255
|
-
declare type LanguageModelV3ToolResult = {
|
|
7256
|
-
type: 'tool-result';
|
|
7257
|
-
/**
|
|
7258
|
-
* The ID of the tool call that this result is associated with.
|
|
7259
|
-
*/
|
|
7260
|
-
toolCallId: string;
|
|
7261
|
-
/**
|
|
7262
|
-
* Name of the tool that generated this result.
|
|
7263
|
-
*/
|
|
7264
|
-
toolName: string;
|
|
7265
|
-
/**
|
|
7266
|
-
* Result of the tool call. This is a JSON-serializable object.
|
|
7267
|
-
*/
|
|
7268
|
-
result: NonNullable<JSONValue_2>;
|
|
7269
|
-
/**
|
|
7270
|
-
* Optional flag if the result is an error or an error message.
|
|
7271
|
-
*/
|
|
7272
|
-
isError?: boolean;
|
|
7273
|
-
/**
|
|
7274
|
-
* Whether the tool result is preliminary.
|
|
7275
|
-
*
|
|
7276
|
-
* Preliminary tool results replace each other, e.g. image previews.
|
|
7277
|
-
* 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.
|
|
7367
|
-
*/
|
|
7368
|
-
providerOptions?: SharedV3ProviderOptions;
|
|
7369
|
-
} | {
|
|
7370
|
-
type: 'error-text';
|
|
7371
|
-
value: string;
|
|
7372
|
-
/**
|
|
7373
|
-
* Provider-specific options.
|
|
7374
|
-
*/
|
|
7375
|
-
providerOptions?: SharedV3ProviderOptions;
|
|
7376
|
-
} | {
|
|
7377
|
-
type: 'error-json';
|
|
7378
|
-
value: JSONValue_2;
|
|
7379
|
-
/**
|
|
7380
|
-
* Provider-specific options.
|
|
7381
|
-
*/
|
|
7382
|
-
providerOptions?: SharedV3ProviderOptions;
|
|
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
|
-
}>;
|
|
6923
|
+
|
|
6924
|
+
/**
|
|
6925
|
+
* Tool calls that the model has generated.
|
|
6926
|
+
*/
|
|
6927
|
+
declare type LanguageModelV3ToolCall = {
|
|
6928
|
+
type: 'tool-call';
|
|
6929
|
+
/**
|
|
6930
|
+
* The identifier of the tool call. It must be unique across all tool calls.
|
|
6931
|
+
*/
|
|
6932
|
+
toolCallId: string;
|
|
6933
|
+
/**
|
|
6934
|
+
* The name of the tool that should be called.
|
|
6935
|
+
*/
|
|
6936
|
+
toolName: string;
|
|
6937
|
+
/**
|
|
6938
|
+
* JSON-encoded tool input. Must match the input schema of the tool.
|
|
6939
|
+
* String inputs must also be JSON-encoded, even when input deltas use text
|
|
6940
|
+
* encoding.
|
|
6941
|
+
*/
|
|
6942
|
+
input: string;
|
|
6943
|
+
/**
|
|
6944
|
+
* Whether the tool call will be executed by the provider.
|
|
6945
|
+
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
6946
|
+
*/
|
|
6947
|
+
providerExecuted?: boolean;
|
|
6948
|
+
/**
|
|
6949
|
+
* Whether the tool is dynamic, i.e. defined at runtime.
|
|
6950
|
+
* For example, MCP (Model Context Protocol) tools that are executed by the provider.
|
|
6951
|
+
*/
|
|
6952
|
+
dynamic?: boolean;
|
|
6953
|
+
/**
|
|
6954
|
+
* Additional provider-specific metadata for the tool call.
|
|
6955
|
+
*/
|
|
6956
|
+
providerMetadata?: SharedV3ProviderMetadata;
|
|
6957
|
+
};
|
|
6958
|
+
|
|
6959
|
+
/**
|
|
6960
|
+
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
6961
|
+
*/
|
|
6962
|
+
declare interface LanguageModelV3ToolCallPart {
|
|
6963
|
+
type: 'tool-call';
|
|
6964
|
+
/**
|
|
6965
|
+
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
6966
|
+
*/
|
|
6967
|
+
toolCallId: string;
|
|
6968
|
+
/**
|
|
6969
|
+
* Name of the tool that is being called.
|
|
6970
|
+
*/
|
|
6971
|
+
toolName: string;
|
|
6972
|
+
/**
|
|
6973
|
+
* Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
6974
|
+
*/
|
|
6975
|
+
input: unknown;
|
|
6976
|
+
/**
|
|
6977
|
+
* Whether the tool call will be executed by the provider.
|
|
6978
|
+
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
6979
|
+
*/
|
|
6980
|
+
providerExecuted?: boolean;
|
|
6981
|
+
/**
|
|
6982
|
+
* Additional provider-specific options. They are passed through
|
|
6983
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
6984
|
+
* functionality that can be fully encapsulated in the provider.
|
|
6985
|
+
*/
|
|
6986
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
6987
|
+
}
|
|
6988
|
+
|
|
6989
|
+
declare type LanguageModelV3ToolChoice = {
|
|
6990
|
+
type: 'auto';
|
|
6991
|
+
} | {
|
|
6992
|
+
type: 'none';
|
|
6993
|
+
} | {
|
|
6994
|
+
type: 'required';
|
|
6995
|
+
} | {
|
|
6996
|
+
type: 'tool';
|
|
6997
|
+
toolName: string;
|
|
6998
|
+
};
|
|
6999
|
+
|
|
7000
|
+
/**
|
|
7001
|
+
* Result of a tool call that has been executed by the provider.
|
|
7002
|
+
*/
|
|
7003
|
+
declare type LanguageModelV3ToolResult = {
|
|
7004
|
+
type: 'tool-result';
|
|
7005
|
+
/**
|
|
7006
|
+
* The ID of the tool call that this result is associated with.
|
|
7007
|
+
*/
|
|
7008
|
+
toolCallId: string;
|
|
7009
|
+
/**
|
|
7010
|
+
* Name of the tool that generated this result.
|
|
7011
|
+
*/
|
|
7012
|
+
toolName: string;
|
|
7013
|
+
/**
|
|
7014
|
+
* Result of the tool call. This is a JSON-serializable object.
|
|
7015
|
+
*/
|
|
7016
|
+
result: NonNullable<JSONValue_2>;
|
|
7017
|
+
/**
|
|
7018
|
+
* Optional flag if the result is an error or an error message.
|
|
7019
|
+
*/
|
|
7020
|
+
isError?: boolean;
|
|
7021
|
+
/**
|
|
7022
|
+
* Whether the tool result is preliminary.
|
|
7023
|
+
*
|
|
7024
|
+
* Preliminary tool results replace each other, e.g. image previews.
|
|
7025
|
+
* There always has to be a final, non-preliminary tool result.
|
|
7026
|
+
*
|
|
7027
|
+
* If this flag is set to true, the tool result is preliminary.
|
|
7028
|
+
* If this flag is not set or is false, the tool result is not preliminary.
|
|
7029
|
+
*/
|
|
7030
|
+
preliminary?: boolean;
|
|
7031
|
+
/**
|
|
7032
|
+
* Whether the tool is dynamic, i.e. defined at runtime.
|
|
7033
|
+
* For example, MCP (Model Context Protocol) tools that are executed by the provider.
|
|
7034
|
+
*/
|
|
7035
|
+
dynamic?: boolean;
|
|
7036
|
+
/**
|
|
7037
|
+
* Additional provider-specific metadata for the tool result.
|
|
7038
|
+
*/
|
|
7039
|
+
providerMetadata?: SharedV3ProviderMetadata;
|
|
7499
7040
|
};
|
|
7500
7041
|
|
|
7501
7042
|
/**
|
|
7502
7043
|
* Result of a tool call.
|
|
7503
7044
|
*/
|
|
7504
|
-
declare type
|
|
7045
|
+
declare type LanguageModelV3ToolResultOutput = {
|
|
7505
7046
|
/**
|
|
7506
7047
|
* Text tool output that should be directly sent to the API.
|
|
7507
7048
|
*/
|
|
@@ -7510,14 +7051,14 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7510
7051
|
/**
|
|
7511
7052
|
* Provider-specific options.
|
|
7512
7053
|
*/
|
|
7513
|
-
providerOptions?:
|
|
7054
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7514
7055
|
} | {
|
|
7515
7056
|
type: 'json';
|
|
7516
|
-
value:
|
|
7057
|
+
value: JSONValue_2;
|
|
7517
7058
|
/**
|
|
7518
7059
|
* Provider-specific options.
|
|
7519
7060
|
*/
|
|
7520
|
-
providerOptions?:
|
|
7061
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7521
7062
|
} | {
|
|
7522
7063
|
/**
|
|
7523
7064
|
* Type when the user has denied the execution of the tool call.
|
|
@@ -7530,21 +7071,21 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7530
7071
|
/**
|
|
7531
7072
|
* Provider-specific options.
|
|
7532
7073
|
*/
|
|
7533
|
-
providerOptions?:
|
|
7074
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7534
7075
|
} | {
|
|
7535
7076
|
type: 'error-text';
|
|
7536
7077
|
value: string;
|
|
7537
7078
|
/**
|
|
7538
7079
|
* Provider-specific options.
|
|
7539
7080
|
*/
|
|
7540
|
-
providerOptions?:
|
|
7081
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7541
7082
|
} | {
|
|
7542
7083
|
type: 'error-json';
|
|
7543
|
-
value:
|
|
7084
|
+
value: JSONValue_2;
|
|
7544
7085
|
/**
|
|
7545
7086
|
* Provider-specific options.
|
|
7546
7087
|
*/
|
|
7547
|
-
providerOptions?:
|
|
7088
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7548
7089
|
} | {
|
|
7549
7090
|
type: 'content';
|
|
7550
7091
|
value: Array<{
|
|
@@ -7556,7 +7097,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7556
7097
|
/**
|
|
7557
7098
|
* Provider-specific options.
|
|
7558
7099
|
*/
|
|
7559
|
-
providerOptions?:
|
|
7100
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7560
7101
|
} | {
|
|
7561
7102
|
type: 'file-data';
|
|
7562
7103
|
/**
|
|
@@ -7575,7 +7116,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7575
7116
|
/**
|
|
7576
7117
|
* Provider-specific options.
|
|
7577
7118
|
*/
|
|
7578
|
-
providerOptions?:
|
|
7119
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7579
7120
|
} | {
|
|
7580
7121
|
type: 'file-url';
|
|
7581
7122
|
/**
|
|
@@ -7590,7 +7131,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7590
7131
|
/**
|
|
7591
7132
|
* Provider-specific options.
|
|
7592
7133
|
*/
|
|
7593
|
-
providerOptions?:
|
|
7134
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7594
7135
|
} | {
|
|
7595
7136
|
type: 'file-id';
|
|
7596
7137
|
/**
|
|
@@ -7605,7 +7146,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7605
7146
|
/**
|
|
7606
7147
|
* Provider-specific options.
|
|
7607
7148
|
*/
|
|
7608
|
-
providerOptions?:
|
|
7149
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7609
7150
|
} | {
|
|
7610
7151
|
/**
|
|
7611
7152
|
* Images that are referenced using base64 encoded data.
|
|
@@ -7623,7 +7164,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7623
7164
|
/**
|
|
7624
7165
|
* Provider-specific options.
|
|
7625
7166
|
*/
|
|
7626
|
-
providerOptions?:
|
|
7167
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7627
7168
|
} | {
|
|
7628
7169
|
/**
|
|
7629
7170
|
* Images that are referenced using a URL.
|
|
@@ -7636,7 +7177,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7636
7177
|
/**
|
|
7637
7178
|
* Provider-specific options.
|
|
7638
7179
|
*/
|
|
7639
|
-
providerOptions?:
|
|
7180
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7640
7181
|
} | {
|
|
7641
7182
|
/**
|
|
7642
7183
|
* Images that are referenced using a provider file id.
|
|
@@ -7654,7 +7195,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7654
7195
|
/**
|
|
7655
7196
|
* Provider-specific options.
|
|
7656
7197
|
*/
|
|
7657
|
-
providerOptions?:
|
|
7198
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7658
7199
|
} | {
|
|
7659
7200
|
/**
|
|
7660
7201
|
* Custom content part. This can be used to implement
|
|
@@ -7664,7 +7205,7 @@ declare type LanguageModelV3ToolResultOutput_2 = {
|
|
|
7664
7205
|
/**
|
|
7665
7206
|
* Provider-specific options.
|
|
7666
7207
|
*/
|
|
7667
|
-
providerOptions?:
|
|
7208
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
7668
7209
|
}>;
|
|
7669
7210
|
};
|
|
7670
7211
|
|
|
@@ -7693,31 +7234,6 @@ declare interface LanguageModelV3ToolResultPart {
|
|
|
7693
7234
|
providerOptions?: SharedV3ProviderOptions;
|
|
7694
7235
|
}
|
|
7695
7236
|
|
|
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
7237
|
/**
|
|
7722
7238
|
* Usage information for a language model call.
|
|
7723
7239
|
*/
|
|
@@ -7769,57 +7285,6 @@ declare type LanguageModelV3Usage = {
|
|
|
7769
7285
|
raw?: JSONObject;
|
|
7770
7286
|
};
|
|
7771
7287
|
|
|
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
7288
|
/**
|
|
7824
7289
|
* Check if the last message is an assistant message with completed tool call approvals.
|
|
7825
7290
|
* The last step of the message must have at least one tool approval response and
|
|
@@ -7832,7 +7297,9 @@ export declare function lastAssistantMessageIsCompleteWithApprovalResponses({ me
|
|
|
7832
7297
|
/**
|
|
7833
7298
|
* Check if the last message is an assistant message with completed tool calls.
|
|
7834
7299
|
* The last step of the message must have at least one tool invocation and
|
|
7835
|
-
* all tool invocations must have a result.
|
|
7300
|
+
* all tool invocations must have a result. Completed model text may follow
|
|
7301
|
+
* the tool invocation because client-side tool results update parts in place,
|
|
7302
|
+
* but trailing text without a completed stream state prevents resubmission.
|
|
7836
7303
|
*/
|
|
7837
7304
|
export declare function lastAssistantMessageIsCompleteWithToolCalls({ messages, }: {
|
|
7838
7305
|
messages: UIMessage[];
|
|
@@ -7872,7 +7339,11 @@ declare interface Link {
|
|
|
7872
7339
|
context: SpanContext;
|
|
7873
7340
|
/** A set of {@link SpanAttributes} on the link. */
|
|
7874
7341
|
attributes?: SpanAttributes;
|
|
7875
|
-
/**
|
|
7342
|
+
/**
|
|
7343
|
+
* Count of attributes of the link that were dropped due to collection limits
|
|
7344
|
+
*
|
|
7345
|
+
* @since 1.4.1
|
|
7346
|
+
*/
|
|
7876
7347
|
droppedAttributesCount?: number;
|
|
7877
7348
|
}
|
|
7878
7349
|
|
|
@@ -7985,7 +7456,7 @@ export declare class MessageConversionError extends AISDKError {
|
|
|
7985
7456
|
}
|
|
7986
7457
|
|
|
7987
7458
|
export declare class MissingToolResultsError extends AISDKError {
|
|
7988
|
-
private readonly [symbol$
|
|
7459
|
+
private readonly [symbol$e];
|
|
7989
7460
|
readonly toolCallIds: string[];
|
|
7990
7461
|
constructor({ toolCallIds }: {
|
|
7991
7462
|
toolCallIds: string[];
|
|
@@ -8021,7 +7492,7 @@ export declare class NoContentGeneratedError extends AISDKError {
|
|
|
8021
7492
|
* - The model generated a response that could not be parsed.
|
|
8022
7493
|
*/
|
|
8023
7494
|
export declare class NoImageGeneratedError extends AISDKError {
|
|
8024
|
-
private readonly [symbol$
|
|
7495
|
+
private readonly [symbol$d_2];
|
|
8025
7496
|
/**
|
|
8026
7497
|
* The response metadata for each call.
|
|
8027
7498
|
*/
|
|
@@ -8046,7 +7517,7 @@ export declare class NoImageGeneratedError extends AISDKError {
|
|
|
8046
7517
|
* - `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
7518
|
*/
|
|
8048
7519
|
export declare class NoObjectGeneratedError extends AISDKError {
|
|
8049
|
-
private readonly [symbol$
|
|
7520
|
+
private readonly [symbol$c_2];
|
|
8050
7521
|
/**
|
|
8051
7522
|
* The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
8052
7523
|
*/
|
|
@@ -8078,7 +7549,7 @@ export declare class NoObjectGeneratedError extends AISDKError {
|
|
|
8078
7549
|
* Thrown when no LLM output was generated, e.g. because of errors.
|
|
8079
7550
|
*/
|
|
8080
7551
|
export declare class NoOutputGeneratedError extends AISDKError {
|
|
8081
|
-
private readonly [symbol$
|
|
7552
|
+
private readonly [symbol$b_2];
|
|
8082
7553
|
constructor({ message, cause, }?: {
|
|
8083
7554
|
message?: string;
|
|
8084
7555
|
cause?: Error;
|
|
@@ -8099,7 +7570,7 @@ declare function normalizeHeaders(headers: HeadersInit | Record<string, string |
|
|
|
8099
7570
|
* Error that is thrown when no speech audio was generated.
|
|
8100
7571
|
*/
|
|
8101
7572
|
export declare class NoSpeechGeneratedError extends AISDKError {
|
|
8102
|
-
private readonly [symbol$
|
|
7573
|
+
private readonly [symbol$a];
|
|
8103
7574
|
readonly responses: Array<SpeechModelResponseMetadata>;
|
|
8104
7575
|
constructor(options: {
|
|
8105
7576
|
responses: Array<SpeechModelResponseMetadata>;
|
|
@@ -8135,7 +7606,7 @@ export declare class NoSuchProviderError extends NoSuchModelError {
|
|
|
8135
7606
|
}
|
|
8136
7607
|
|
|
8137
7608
|
export declare class NoSuchToolError extends AISDKError {
|
|
8138
|
-
private readonly [symbol$
|
|
7609
|
+
private readonly [symbol$k];
|
|
8139
7610
|
readonly toolName: string;
|
|
8140
7611
|
readonly availableTools: string[] | undefined;
|
|
8141
7612
|
constructor({ toolName, availableTools, message, }: {
|
|
@@ -8150,7 +7621,7 @@ export declare class NoSuchToolError extends AISDKError {
|
|
|
8150
7621
|
* Error that is thrown when no transcript was generated.
|
|
8151
7622
|
*/
|
|
8152
7623
|
export declare class NoTranscriptGeneratedError extends AISDKError {
|
|
8153
|
-
private readonly [symbol$
|
|
7624
|
+
private readonly [symbol$9_2];
|
|
8154
7625
|
readonly responses: Array<TranscriptionModelResponseMetadata>;
|
|
8155
7626
|
constructor(options: {
|
|
8156
7627
|
responses: Array<TranscriptionModelResponseMetadata>;
|
|
@@ -8159,7 +7630,7 @@ export declare class NoTranscriptGeneratedError extends AISDKError {
|
|
|
8159
7630
|
}
|
|
8160
7631
|
|
|
8161
7632
|
export declare class NoVideoGeneratedError extends AISDKError {
|
|
8162
|
-
private readonly [symbol$
|
|
7633
|
+
private readonly [symbol$8_2];
|
|
8163
7634
|
readonly responses: Array<VideoModelResponseMetadata>;
|
|
8164
7635
|
constructor({ message, cause, responses, }: {
|
|
8165
7636
|
message?: string;
|
|
@@ -8230,7 +7701,7 @@ export declare type OnFinishEvent<TOOLS extends ToolSet = ToolSet> = StepResult<
|
|
|
8230
7701
|
*
|
|
8231
7702
|
* Called when the generation operation begins, before any LLM calls.
|
|
8232
7703
|
*/
|
|
8233
|
-
export declare interface OnStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends
|
|
7704
|
+
export declare interface OnStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface, INCLUDE = {
|
|
8234
7705
|
requestBody?: boolean;
|
|
8235
7706
|
responseBody?: boolean;
|
|
8236
7707
|
}> {
|
|
@@ -8313,7 +7784,7 @@ export declare type OnStepFinishEvent<TOOLS extends ToolSet = ToolSet> = StepRes
|
|
|
8313
7784
|
* Called when a step (LLM call) begins, before the provider is called.
|
|
8314
7785
|
* Each step represents a single LLM invocation.
|
|
8315
7786
|
*/
|
|
8316
|
-
export declare interface OnStepStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends
|
|
7787
|
+
export declare interface OnStepStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface, INCLUDE = {
|
|
8317
7788
|
requestBody?: boolean;
|
|
8318
7789
|
responseBody?: boolean;
|
|
8319
7790
|
}> {
|
|
@@ -8445,7 +7916,7 @@ export declare namespace Output {
|
|
|
8445
7916
|
};
|
|
8446
7917
|
}
|
|
8447
7918
|
|
|
8448
|
-
declare interface
|
|
7919
|
+
export declare interface OutputInterface<OUTPUT = any, PARTIAL = any, ELEMENT = any> {
|
|
8449
7920
|
/**
|
|
8450
7921
|
* The name of the output mode.
|
|
8451
7922
|
*/
|
|
@@ -8480,11 +7951,9 @@ declare interface Output_2<OUTPUT = any, PARTIAL = any, ELEMENT = any> {
|
|
|
8480
7951
|
|
|
8481
7952
|
declare interface ParallelSearchConfig {
|
|
8482
7953
|
/**
|
|
8483
|
-
*
|
|
8484
|
-
* - "one-shot": Comprehensive results with longer excerpts for single-response answers (default)
|
|
8485
|
-
* - "agentic": Concise, token-efficient results for multi-step agentic workflows
|
|
7954
|
+
* Search mode. Defaults to `basic`.
|
|
8486
7955
|
*/
|
|
8487
|
-
mode?:
|
|
7956
|
+
mode?: ParallelSearchMode;
|
|
8488
7957
|
/**
|
|
8489
7958
|
* Default maximum number of results to return (1-20).
|
|
8490
7959
|
* Defaults to 10 if not specified.
|
|
@@ -8498,15 +7967,24 @@ declare interface ParallelSearchConfig {
|
|
|
8498
7967
|
* Default excerpt configuration for controlling result length.
|
|
8499
7968
|
*/
|
|
8500
7969
|
excerpts?: ParallelSearchExcerpts;
|
|
7970
|
+
/**
|
|
7971
|
+
* Maximum total characters across all result excerpts.
|
|
7972
|
+
*/
|
|
7973
|
+
maxCharsTotal?: number;
|
|
8501
7974
|
/**
|
|
8502
7975
|
* Default fetch policy for controlling content freshness.
|
|
8503
7976
|
*/
|
|
8504
7977
|
fetchPolicy?: ParallelSearchFetchPolicy;
|
|
7978
|
+
/**
|
|
7979
|
+
* ISO 3166-1 alpha-2 country code to localize results, e.g. 'us'.
|
|
7980
|
+
* Invalid codes are ignored with a warning.
|
|
7981
|
+
*/
|
|
7982
|
+
location?: string;
|
|
8505
7983
|
}
|
|
8506
7984
|
|
|
8507
7985
|
declare interface ParallelSearchError {
|
|
8508
7986
|
/** Error type */
|
|
8509
|
-
error: 'api_error' | '
|
|
7987
|
+
error: 'api_error' | 'configuration_error' | 'execution_error' | 'gateway_rate_limit' | 'invalid_input' | 'rate_limit' | 'timeout' | 'unknown' | 'unknown_tool';
|
|
8510
7988
|
/** HTTP status code if applicable */
|
|
8511
7989
|
statusCode?: number;
|
|
8512
7990
|
/** Human-readable error message */
|
|
@@ -8520,16 +7998,27 @@ declare interface ParallelSearchExcerpts {
|
|
|
8520
7998
|
maxCharsPerResult?: number;
|
|
8521
7999
|
/**
|
|
8522
8000
|
* Maximum total characters across all results.
|
|
8001
|
+
* @deprecated Use the top-level `maxCharsTotal` option instead.
|
|
8523
8002
|
*/
|
|
8524
8003
|
maxCharsTotal?: number;
|
|
8525
8004
|
}
|
|
8526
8005
|
|
|
8527
8006
|
declare interface ParallelSearchFetchPolicy {
|
|
8528
8007
|
/**
|
|
8529
|
-
* Maximum age in seconds
|
|
8530
|
-
*
|
|
8008
|
+
* Maximum age in seconds of cached content before a live fetch is attempted.
|
|
8009
|
+
* Minimum 600; lower values are raised to 600.
|
|
8531
8010
|
*/
|
|
8532
8011
|
maxAgeSeconds?: number;
|
|
8012
|
+
/**
|
|
8013
|
+
* Timeout in seconds for a live fetch when content is not cached.
|
|
8014
|
+
* The gateway caps it to stay within its own tool timeout.
|
|
8015
|
+
*/
|
|
8016
|
+
timeoutSeconds?: number;
|
|
8017
|
+
/**
|
|
8018
|
+
* Return an error instead of falling back to older cached content when a
|
|
8019
|
+
* live fetch fails or times out. Defaults to false.
|
|
8020
|
+
*/
|
|
8021
|
+
disableCacheFallback?: boolean;
|
|
8533
8022
|
}
|
|
8534
8023
|
|
|
8535
8024
|
declare interface ParallelSearchInput {
|
|
@@ -8540,16 +8029,13 @@ declare interface ParallelSearchInput {
|
|
|
8540
8029
|
*/
|
|
8541
8030
|
objective: string;
|
|
8542
8031
|
/**
|
|
8543
|
-
*
|
|
8544
|
-
* Maximum 200 characters per query.
|
|
8032
|
+
* 2-3 concise keyword queries, 3-6 words each (max 5, 200 characters each).
|
|
8545
8033
|
*/
|
|
8546
8034
|
search_queries?: string[];
|
|
8547
8035
|
/**
|
|
8548
|
-
*
|
|
8549
|
-
* - "one-shot": Comprehensive results with longer excerpts
|
|
8550
|
-
* - "agentic": Concise, token-efficient results for multi-step workflows
|
|
8036
|
+
* Search mode. Defaults to `basic`.
|
|
8551
8037
|
*/
|
|
8552
|
-
mode?:
|
|
8038
|
+
mode?: ParallelSearchMode;
|
|
8553
8039
|
/**
|
|
8554
8040
|
* Maximum number of results to return (1-20).
|
|
8555
8041
|
* Defaults to 10 if not specified.
|
|
@@ -8568,51 +8054,75 @@ declare interface ParallelSearchInput {
|
|
|
8568
8054
|
*/
|
|
8569
8055
|
excerpts?: {
|
|
8570
8056
|
max_chars_per_result?: number;
|
|
8057
|
+
/** @deprecated Use the top-level `max_chars_total` instead. */
|
|
8571
8058
|
max_chars_total?: number;
|
|
8572
8059
|
};
|
|
8060
|
+
/**
|
|
8061
|
+
* Maximum total characters across all result excerpts.
|
|
8062
|
+
*/
|
|
8063
|
+
max_chars_total?: number;
|
|
8573
8064
|
/**
|
|
8574
8065
|
* Fetch policy for controlling content freshness.
|
|
8575
8066
|
*/
|
|
8576
8067
|
fetch_policy?: {
|
|
8577
8068
|
max_age_seconds?: number;
|
|
8069
|
+
timeout_seconds?: number;
|
|
8070
|
+
disable_cache_fallback?: boolean;
|
|
8578
8071
|
};
|
|
8072
|
+
/**
|
|
8073
|
+
* ISO 3166-1 alpha-2 country code to localize results.
|
|
8074
|
+
*/
|
|
8075
|
+
location?: string;
|
|
8579
8076
|
}
|
|
8580
8077
|
|
|
8078
|
+
/**
|
|
8079
|
+
* Search mode. `turbo` and `fast` trade excerpt depth for latency (`turbo` is
|
|
8080
|
+
* English and Japanese only), `basic` is balanced, `advanced` is the most thorough.
|
|
8081
|
+
* Deprecated: `one-shot` (runs as `basic`) and `agentic` (runs as `advanced`).
|
|
8082
|
+
*/
|
|
8083
|
+
declare type ParallelSearchMode = (typeof parallelSearchModes)[number];
|
|
8084
|
+
|
|
8085
|
+
declare const parallelSearchModes: readonly ["turbo", "fast", "basic", "advanced", "one-shot", "agentic"];
|
|
8086
|
+
|
|
8581
8087
|
declare type ParallelSearchOutput = ParallelSearchResponse | ParallelSearchError;
|
|
8582
8088
|
|
|
8583
8089
|
declare interface ParallelSearchResponse {
|
|
8584
8090
|
/** Unique identifier for this search request */
|
|
8585
|
-
|
|
8586
|
-
/**
|
|
8091
|
+
search_id: string;
|
|
8092
|
+
/** Search results, ordered by decreasing relevance */
|
|
8587
8093
|
results: ParallelSearchResult[];
|
|
8094
|
+
/** Non-fatal issues with the request, such as an ignored `location` */
|
|
8095
|
+
warnings?: ParallelSearchWarning[] | null;
|
|
8096
|
+
/** Usage reported by Parallel for this search */
|
|
8097
|
+
usage?: ParallelSearchUsage[] | null;
|
|
8098
|
+
/** Session identifier shared by the searches made during one request */
|
|
8099
|
+
session_id?: string;
|
|
8588
8100
|
}
|
|
8589
8101
|
|
|
8590
8102
|
declare interface ParallelSearchResult {
|
|
8591
8103
|
/** URL of the search result */
|
|
8592
8104
|
url: string;
|
|
8593
|
-
/** Title of the
|
|
8594
|
-
title
|
|
8595
|
-
/**
|
|
8596
|
-
|
|
8597
|
-
/**
|
|
8598
|
-
|
|
8599
|
-
/** Relevance score for the result */
|
|
8600
|
-
relevanceScore?: number;
|
|
8105
|
+
/** Title of the page, if available */
|
|
8106
|
+
title?: string | null;
|
|
8107
|
+
/** Publication date of the page (YYYY-MM-DD), if available */
|
|
8108
|
+
publish_date?: string | null;
|
|
8109
|
+
/** Relevant excerpts from the page, formatted as markdown */
|
|
8110
|
+
excerpts: string[];
|
|
8601
8111
|
}
|
|
8602
8112
|
|
|
8603
8113
|
declare interface ParallelSearchSourcePolicy {
|
|
8604
8114
|
/**
|
|
8605
|
-
*
|
|
8606
|
-
* Example: ['wikipedia.org', '
|
|
8115
|
+
* Domains or domain/path prefixes to restrict results to. When set,
|
|
8116
|
+
* `excludeDomains` is ignored. Example: ['wikipedia.org', 'docs.python.org/3']
|
|
8607
8117
|
*/
|
|
8608
8118
|
includeDomains?: string[];
|
|
8609
8119
|
/**
|
|
8610
|
-
*
|
|
8611
|
-
* Example: ['reddit.com'
|
|
8120
|
+
* Domains or domain/path prefixes to exclude from results.
|
|
8121
|
+
* Example: ['reddit.com']
|
|
8612
8122
|
*/
|
|
8613
8123
|
excludeDomains?: string[];
|
|
8614
8124
|
/**
|
|
8615
|
-
* Only include results published after this date (
|
|
8125
|
+
* Only include results published on or after this date (YYYY-MM-DD).
|
|
8616
8126
|
* Example: '2024-01-01'
|
|
8617
8127
|
*/
|
|
8618
8128
|
afterDate?: string;
|
|
@@ -8620,6 +8130,22 @@ declare interface ParallelSearchSourcePolicy {
|
|
|
8620
8130
|
|
|
8621
8131
|
declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<ParallelSearchInput, ParallelSearchOutput, ParallelSearchConfig>;
|
|
8622
8132
|
|
|
8133
|
+
declare interface ParallelSearchUsage {
|
|
8134
|
+
/** Usage item name, e.g. 'sku_search' */
|
|
8135
|
+
name: string;
|
|
8136
|
+
/** Count for the usage item */
|
|
8137
|
+
count?: number;
|
|
8138
|
+
}
|
|
8139
|
+
|
|
8140
|
+
declare interface ParallelSearchWarning {
|
|
8141
|
+
/** Warning type, e.g. 'input_validation_warning'. New types may be added. */
|
|
8142
|
+
type: string;
|
|
8143
|
+
/** Human-readable message */
|
|
8144
|
+
message: string;
|
|
8145
|
+
/** Optional detail supporting the warning */
|
|
8146
|
+
detail?: Record<string, unknown> | null;
|
|
8147
|
+
}
|
|
8148
|
+
|
|
8623
8149
|
/**
|
|
8624
8150
|
* Parses a JSON string into an unknown object.
|
|
8625
8151
|
*
|
|
@@ -8629,7 +8155,7 @@ declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFact
|
|
|
8629
8155
|
declare function parseJSON(options: {
|
|
8630
8156
|
text: string;
|
|
8631
8157
|
schema?: undefined;
|
|
8632
|
-
}): Promise<
|
|
8158
|
+
}): Promise<JSONValue_2>;
|
|
8633
8159
|
|
|
8634
8160
|
/**
|
|
8635
8161
|
* Parses a JSON string into a strongly-typed object using the provided schema.
|
|
@@ -8669,7 +8195,7 @@ declare type ParseResult<T> = {
|
|
|
8669
8195
|
rawValue: unknown;
|
|
8670
8196
|
} | {
|
|
8671
8197
|
success: false;
|
|
8672
|
-
error:
|
|
8198
|
+
error: JSONParseError | TypeValidationError;
|
|
8673
8199
|
rawValue: unknown;
|
|
8674
8200
|
};
|
|
8675
8201
|
|
|
@@ -8824,7 +8350,7 @@ declare const perplexitySearchToolFactory: _ai_sdk_provider_utils.ProviderToolFa
|
|
|
8824
8350
|
*
|
|
8825
8351
|
* @param response - The Node.js ServerResponse object to pipe to.
|
|
8826
8352
|
* @param agent - The agent to run.
|
|
8827
|
-
* @param uiMessages - The input UI messages.
|
|
8353
|
+
* @param uiMessages - The input UI messages. Defaults to originalMessages.
|
|
8828
8354
|
* @param abortSignal - Abort signal. Optional.
|
|
8829
8355
|
* @param timeout - Timeout in milliseconds. Optional.
|
|
8830
8356
|
* @param options - The options for the agent. Optional.
|
|
@@ -8833,12 +8359,13 @@ declare const perplexitySearchToolFactory: _ai_sdk_provider_utils.ProviderToolFa
|
|
|
8833
8359
|
* @param headers - Additional headers for the response. Optional.
|
|
8834
8360
|
* @param status - The status code for the response. Optional.
|
|
8835
8361
|
* @param statusText - The status text for the response. Optional.
|
|
8362
|
+
* @param keepAliveMs - Optional interval for sending SSE keep-alive comments.
|
|
8836
8363
|
* @param consumeSseStream - Whether to consume the SSE stream. Optional.
|
|
8837
8364
|
*/
|
|
8838
|
-
export declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends
|
|
8365
|
+
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
8366
|
response: ServerResponse;
|
|
8840
8367
|
agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
|
|
8841
|
-
uiMessages
|
|
8368
|
+
uiMessages?: unknown[];
|
|
8842
8369
|
abortSignal?: AbortSignal;
|
|
8843
8370
|
timeout?: TimeoutConfiguration;
|
|
8844
8371
|
options?: CALL_OPTIONS;
|
|
@@ -8873,10 +8400,11 @@ export declare function pipeTextStreamToResponse({ response, status, statusText,
|
|
|
8873
8400
|
* @param options.statusText - The HTTP status text for the response.
|
|
8874
8401
|
* @param options.headers - Additional HTTP headers to include in the response.
|
|
8875
8402
|
* @param options.stream - The UI message chunk stream to send.
|
|
8403
|
+
* @param options.keepAliveMs - Optional interval for sending SSE keep-alive comments.
|
|
8876
8404
|
* @param options.consumeSseStream - Optional callback to consume a copy of the SSE stream independently.
|
|
8877
8405
|
* @returns A promise that resolves when the stream has been written.
|
|
8878
8406
|
*/
|
|
8879
|
-
export declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, consumeSseStream, }: {
|
|
8407
|
+
export declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, keepAliveMs, consumeSseStream, }: {
|
|
8880
8408
|
response: ServerResponse;
|
|
8881
8409
|
stream: ReadableStream<UIMessageChunk>;
|
|
8882
8410
|
} & UIMessageStreamResponseInit): Promise<void>;
|
|
@@ -8885,7 +8413,7 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
|
|
|
8885
8413
|
url: string;
|
|
8886
8414
|
headers?: Record<string, string | undefined>;
|
|
8887
8415
|
formData: FormData;
|
|
8888
|
-
failedResponseHandler: ResponseHandler<
|
|
8416
|
+
failedResponseHandler: ResponseHandler<APICallError>;
|
|
8889
8417
|
successfulResponseHandler: ResponseHandler<T>;
|
|
8890
8418
|
abortSignal?: AbortSignal;
|
|
8891
8419
|
fetch?: FetchFunction;
|
|
@@ -8899,7 +8427,7 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
|
|
|
8899
8427
|
url: string;
|
|
8900
8428
|
headers?: Record<string, string | undefined>;
|
|
8901
8429
|
body: unknown;
|
|
8902
|
-
failedResponseHandler: ResponseHandler<
|
|
8430
|
+
failedResponseHandler: ResponseHandler<APICallError>;
|
|
8903
8431
|
successfulResponseHandler: ResponseHandler<T>;
|
|
8904
8432
|
abortSignal?: AbortSignal;
|
|
8905
8433
|
fetch?: FetchFunction;
|
|
@@ -9142,7 +8670,7 @@ export declare type Provider = {
|
|
|
9142
8670
|
*
|
|
9143
8671
|
* @throws {NoSuchModelError} If no such model exists.
|
|
9144
8672
|
*/
|
|
9145
|
-
rerankingModel(modelId: string): RerankingModel;
|
|
8673
|
+
rerankingModel?(modelId: string): RerankingModel;
|
|
9146
8674
|
};
|
|
9147
8675
|
|
|
9148
8676
|
/**
|
|
@@ -9159,7 +8687,7 @@ export declare type ProviderMetadata = SharedV3ProviderMetadata;
|
|
|
9159
8687
|
* They are passed through to the provider from the AI SDK and enable
|
|
9160
8688
|
* provider-specific functionality that can be fully encapsulated in the provider.
|
|
9161
8689
|
*/
|
|
9162
|
-
declare type ProviderOptions =
|
|
8690
|
+
declare type ProviderOptions = SharedV3ProviderOptions;
|
|
9163
8691
|
|
|
9164
8692
|
export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV3> = Record<string, ProviderV3>, SEPARATOR extends string = ':'> {
|
|
9165
8693
|
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV3;
|
|
@@ -9425,6 +8953,10 @@ declare interface ReasoningPart {
|
|
|
9425
8953
|
*/
|
|
9426
8954
|
export declare type ReasoningUIPart = {
|
|
9427
8955
|
type: 'reasoning';
|
|
8956
|
+
/**
|
|
8957
|
+
* The reasoning part ID.
|
|
8958
|
+
*/
|
|
8959
|
+
id?: string;
|
|
9428
8960
|
/**
|
|
9429
8961
|
* The reasoning text.
|
|
9430
8962
|
*/
|
|
@@ -9727,7 +9259,7 @@ declare type RetryDelayProvider = ({ error, exponentialBackoffDelay, }: {
|
|
|
9727
9259
|
}) => number;
|
|
9728
9260
|
|
|
9729
9261
|
export declare class RetryError extends AISDKError {
|
|
9730
|
-
private readonly [symbol$
|
|
9262
|
+
private readonly [symbol$1_2];
|
|
9731
9263
|
readonly reason: RetryErrorReason_2;
|
|
9732
9264
|
readonly lastError: unknown;
|
|
9733
9265
|
readonly errors: Array<unknown>;
|
|
@@ -9773,7 +9305,7 @@ declare const retryWithExponentialBackoff: ({ maxRetries, initialDelayInMs, back
|
|
|
9773
9305
|
declare function safeParseJSON(options: {
|
|
9774
9306
|
text: string;
|
|
9775
9307
|
schema?: undefined;
|
|
9776
|
-
}): Promise<ParseResult<
|
|
9308
|
+
}): Promise<ParseResult<JSONValue_2>>;
|
|
9777
9309
|
|
|
9778
9310
|
/**
|
|
9779
9311
|
* Safely parses a JSON string into a strongly-typed object, using a provided schema to validate the object.
|
|
@@ -9801,14 +9333,14 @@ declare function safeParseJSON<T>(options: {
|
|
|
9801
9333
|
declare function safeValidateTypes<OBJECT>({ value, schema, context, }: {
|
|
9802
9334
|
value: unknown;
|
|
9803
9335
|
schema: FlexibleSchema<OBJECT>;
|
|
9804
|
-
context?:
|
|
9336
|
+
context?: TypeValidationContext;
|
|
9805
9337
|
}): Promise<{
|
|
9806
9338
|
success: true;
|
|
9807
9339
|
value: OBJECT;
|
|
9808
9340
|
rawValue: unknown;
|
|
9809
9341
|
} | {
|
|
9810
9342
|
success: false;
|
|
9811
|
-
error:
|
|
9343
|
+
error: TypeValidationError;
|
|
9812
9344
|
rawValue: unknown;
|
|
9813
9345
|
}>;
|
|
9814
9346
|
|
|
@@ -9817,16 +9349,7 @@ declare function safeValidateTypes<OBJECT>({ value, schema, context, }: {
|
|
|
9817
9349
|
* but instead of throwing it returns `{ success: true, data }`
|
|
9818
9350
|
* or `{ success: false, error }`.
|
|
9819
9351
|
*/
|
|
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>>;
|
|
9352
|
+
export declare function safeValidateUIMessages<UI_MESSAGE extends UIMessage>(options: ValidateUIMessagesOptions<UI_MESSAGE>): Promise<SafeValidateUIMessagesResult<UI_MESSAGE>>;
|
|
9830
9353
|
|
|
9831
9354
|
export declare type SafeValidateUIMessagesResult<UI_MESSAGE extends UIMessage> = {
|
|
9832
9355
|
success: true;
|
|
@@ -9866,8 +9389,10 @@ declare function secureJsonParse(text: string): any;
|
|
|
9866
9389
|
export declare class SerialJobExecutor {
|
|
9867
9390
|
private queue;
|
|
9868
9391
|
private isProcessing;
|
|
9392
|
+
private idleWaiters;
|
|
9869
9393
|
private processQueue;
|
|
9870
9394
|
run(job: Job): Promise<void>;
|
|
9395
|
+
waitForIdle(): Promise<void>;
|
|
9871
9396
|
}
|
|
9872
9397
|
|
|
9873
9398
|
declare type SharedV2Headers = Record<string, string>;
|
|
@@ -9943,29 +9468,6 @@ declare type SharedV3Headers = Record<string, string>;
|
|
|
9943
9468
|
*/
|
|
9944
9469
|
declare type SharedV3ProviderMetadata = Record<string, JSONObject>;
|
|
9945
9470
|
|
|
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
9471
|
/**
|
|
9970
9472
|
* Additional provider-specific options.
|
|
9971
9473
|
* Options are additional input to the provider.
|
|
@@ -9989,29 +9491,6 @@ declare type SharedV3ProviderMetadata_2 = Record<string, JSONObject_2>;
|
|
|
9989
9491
|
*/
|
|
9990
9492
|
declare type SharedV3ProviderOptions = Record<string, JSONObject>;
|
|
9991
9493
|
|
|
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
9494
|
/**
|
|
10016
9495
|
* Warning from the model.
|
|
10017
9496
|
*
|
|
@@ -10055,49 +9534,6 @@ declare type SharedV3Warning = {
|
|
|
10055
9534
|
message: string;
|
|
10056
9535
|
};
|
|
10057
9536
|
|
|
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
9537
|
declare type ShouldRetryFunction = (error: unknown) => boolean | Promise<boolean>;
|
|
10102
9538
|
|
|
10103
9539
|
/**
|
|
@@ -10202,7 +9638,7 @@ declare type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
10202
9638
|
/**
|
|
10203
9639
|
* Smooths text and reasoning streaming output.
|
|
10204
9640
|
*
|
|
10205
|
-
* @param delayInMs - The delay in milliseconds between each chunk. Defaults to 10ms. Can be set to `null` to skip the delay.
|
|
9641
|
+
* @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
9642
|
* @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
9643
|
*
|
|
10208
9644
|
* @returns A transform stream that smooths text streaming output.
|
|
@@ -10305,6 +9741,8 @@ declare interface Span {
|
|
|
10305
9741
|
* It is preferred span links be added at span creation.
|
|
10306
9742
|
*
|
|
10307
9743
|
* @param link the link to add.
|
|
9744
|
+
*
|
|
9745
|
+
* @since 1.9.0
|
|
10308
9746
|
*/
|
|
10309
9747
|
addLink(link: Link): this;
|
|
10310
9748
|
/**
|
|
@@ -10314,6 +9752,8 @@ declare interface Span {
|
|
|
10314
9752
|
* It is preferred span links be added at span creation.
|
|
10315
9753
|
*
|
|
10316
9754
|
* @param links the links to add.
|
|
9755
|
+
*
|
|
9756
|
+
* @since 1.9.0
|
|
10317
9757
|
*/
|
|
10318
9758
|
addLinks(links: Link[]): this;
|
|
10319
9759
|
/**
|
|
@@ -11178,7 +10618,7 @@ declare class StreamingToolCallTracker<DELTA extends StreamingToolCallDelta = St
|
|
|
11178
10618
|
private finishToolCall;
|
|
11179
10619
|
}
|
|
11180
10620
|
|
|
11181
|
-
declare type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<
|
|
10621
|
+
declare type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<LanguageModelV3StreamPart>, 'enqueue'>;
|
|
11182
10622
|
|
|
11183
10623
|
declare interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCallDelta = StreamingToolCallDelta> {
|
|
11184
10624
|
/**
|
|
@@ -11198,11 +10638,11 @@ declare interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCal
|
|
|
11198
10638
|
* Extract provider-specific metadata from a tool call delta.
|
|
11199
10639
|
* Called once when a new tool call is detected.
|
|
11200
10640
|
*/
|
|
11201
|
-
extractMetadata?: (delta: DELTA) =>
|
|
10641
|
+
extractMetadata?: (delta: DELTA) => SharedV3ProviderMetadata | undefined;
|
|
11202
10642
|
/**
|
|
11203
10643
|
* Build the `providerMetadata` object for a `tool-call` event.
|
|
11204
10644
|
*/
|
|
11205
|
-
buildToolCallProviderMetadata?: (metadata:
|
|
10645
|
+
buildToolCallProviderMetadata?: (metadata: SharedV3ProviderMetadata | undefined) => SharedV3ProviderMetadata | undefined;
|
|
11206
10646
|
}
|
|
11207
10647
|
|
|
11208
10648
|
/**
|
|
@@ -11486,6 +10926,16 @@ declare interface StreamOptions {
|
|
|
11486
10926
|
* @param comment - The comment encountered in the stream.
|
|
11487
10927
|
*/
|
|
11488
10928
|
onComment?: ((comment: string) => void) | undefined;
|
|
10929
|
+
/**
|
|
10930
|
+
* Maximum number of characters the parser is allowed to buffer across calls to `feed()`.
|
|
10931
|
+
* See {@link ParserConfig.maxBufferSize} for details.
|
|
10932
|
+
*
|
|
10933
|
+
* When the limit is exceeded, the stream is always errored (regardless of the `onError`
|
|
10934
|
+
* setting) since the underlying parser is unrecoverable without a `reset()`.
|
|
10935
|
+
*
|
|
10936
|
+
* @defaultValue `undefined` (unbounded)
|
|
10937
|
+
*/
|
|
10938
|
+
maxBufferSize?: number | undefined;
|
|
11489
10939
|
}
|
|
11490
10940
|
|
|
11491
10941
|
/**
|
|
@@ -11535,7 +10985,7 @@ declare interface StreamOptions {
|
|
|
11535
10985
|
* @returns
|
|
11536
10986
|
* A result object for accessing different stream types and additional information.
|
|
11537
10987
|
*/
|
|
11538
|
-
export declare function streamText<TOOLS extends ToolSet, OUTPUT extends
|
|
10988
|
+
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
10989
|
/**
|
|
11540
10990
|
* The language model to use.
|
|
11541
10991
|
*/
|
|
@@ -11636,7 +11086,7 @@ export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_
|
|
|
11636
11086
|
*
|
|
11637
11087
|
* The usage is the combined usage of all steps.
|
|
11638
11088
|
*/
|
|
11639
|
-
onFinish?: StreamTextOnFinishCallback<TOOLS
|
|
11089
|
+
onFinish?: StreamTextOnFinishCallback<NoInfer<TOOLS>, NoInfer<OUTPUT>>;
|
|
11640
11090
|
onAbort?: StreamTextOnAbortCallback<TOOLS>;
|
|
11641
11091
|
/**
|
|
11642
11092
|
* Callback that is called when each step (LLM call) is finished, including intermediate steps.
|
|
@@ -11700,6 +11150,14 @@ export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_
|
|
|
11700
11150
|
};
|
|
11701
11151
|
}): StreamTextResult<TOOLS, OUTPUT>;
|
|
11702
11152
|
|
|
11153
|
+
export declare type StreamTextEndEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface> = OnFinishEvent<TOOLS> & {
|
|
11154
|
+
/**
|
|
11155
|
+
* The parsed output when an output setting was provided and parsing
|
|
11156
|
+
* succeeded.
|
|
11157
|
+
*/
|
|
11158
|
+
readonly output?: InferGenerateOutput<OUTPUT>;
|
|
11159
|
+
};
|
|
11160
|
+
|
|
11703
11161
|
/**
|
|
11704
11162
|
* Include settings for streamText (requestBody only).
|
|
11705
11163
|
*/
|
|
@@ -11730,6 +11188,8 @@ export declare type StreamTextOnChunkCallback<TOOLS extends ToolSet> = (event: {
|
|
|
11730
11188
|
}>;
|
|
11731
11189
|
}) => PromiseLike<void> | void;
|
|
11732
11190
|
|
|
11191
|
+
export declare type StreamTextOnEndCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface> = (event: StreamTextEndEvent<TOOLS, OUTPUT>) => PromiseLike<void> | void;
|
|
11192
|
+
|
|
11733
11193
|
/**
|
|
11734
11194
|
* Callback that is set using the `onError` option.
|
|
11735
11195
|
*
|
|
@@ -11744,7 +11204,7 @@ export declare type StreamTextOnErrorCallback = (event: {
|
|
|
11744
11204
|
*
|
|
11745
11205
|
* @param event - The event that is passed to the callback.
|
|
11746
11206
|
*/
|
|
11747
|
-
export declare type StreamTextOnFinishCallback<TOOLS extends ToolSet
|
|
11207
|
+
export declare type StreamTextOnFinishCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface> = StreamTextOnEndCallback<TOOLS, OUTPUT>;
|
|
11748
11208
|
|
|
11749
11209
|
/**
|
|
11750
11210
|
* Callback that is set using the `experimental_onStart` option.
|
|
@@ -11755,7 +11215,7 @@ export declare type StreamTextOnFinishCallback<TOOLS extends ToolSet> = (event:
|
|
|
11755
11215
|
*
|
|
11756
11216
|
* @param event - The event object containing generation configuration.
|
|
11757
11217
|
*/
|
|
11758
|
-
export declare type StreamTextOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends
|
|
11218
|
+
export declare type StreamTextOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface> = (event: OnStartEvent<TOOLS, OUTPUT, StreamTextIncludeSettings>) => PromiseLike<void> | void;
|
|
11759
11219
|
|
|
11760
11220
|
/**
|
|
11761
11221
|
* Callback that is set using the `onStepFinish` option.
|
|
@@ -11773,7 +11233,7 @@ export declare type StreamTextOnStepFinishCallback<TOOLS extends ToolSet> = (eve
|
|
|
11773
11233
|
*
|
|
11774
11234
|
* @param event - The event object containing step configuration.
|
|
11775
11235
|
*/
|
|
11776
|
-
export declare type StreamTextOnStepStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends
|
|
11236
|
+
export declare type StreamTextOnStepStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends OutputInterface = OutputInterface> = (event: OnStepStartEvent<TOOLS, OUTPUT, StreamTextIncludeSettings>) => PromiseLike<void> | void;
|
|
11777
11237
|
|
|
11778
11238
|
export declare type StreamTextOnToolCallFinishCallback<TOOLS extends ToolSet = ToolSet> = (event: OnToolCallFinishEvent<TOOLS>) => PromiseLike<void> | void;
|
|
11779
11239
|
|
|
@@ -11782,7 +11242,7 @@ export declare type StreamTextOnToolCallStartCallback<TOOLS extends ToolSet = To
|
|
|
11782
11242
|
/**
|
|
11783
11243
|
* A result object for accessing different stream types and additional information.
|
|
11784
11244
|
*/
|
|
11785
|
-
export declare interface StreamTextResult<TOOLS extends ToolSet, OUTPUT extends
|
|
11245
|
+
export declare interface StreamTextResult<TOOLS extends ToolSet, OUTPUT extends OutputInterface> {
|
|
11786
11246
|
/**
|
|
11787
11247
|
* The content that was generated in the last step.
|
|
11788
11248
|
*
|
|
@@ -12023,8 +11483,6 @@ declare const symbol$1: unique symbol;
|
|
|
12023
11483
|
|
|
12024
11484
|
declare const symbol$1_2: unique symbol;
|
|
12025
11485
|
|
|
12026
|
-
declare const symbol$1_3: unique symbol;
|
|
12027
|
-
|
|
12028
11486
|
declare const symbol$2: unique symbol;
|
|
12029
11487
|
|
|
12030
11488
|
declare const symbol$2_2: unique symbol;
|
|
@@ -12049,8 +11507,6 @@ declare const symbol$7: unique symbol;
|
|
|
12049
11507
|
|
|
12050
11508
|
declare const symbol$7_2: unique symbol;
|
|
12051
11509
|
|
|
12052
|
-
declare const symbol$7_3: unique symbol;
|
|
12053
|
-
|
|
12054
11510
|
declare const symbol$8: unique symbol;
|
|
12055
11511
|
|
|
12056
11512
|
declare const symbol$8_2: unique symbol;
|
|
@@ -12069,14 +11525,10 @@ declare const symbol$c: unique symbol;
|
|
|
12069
11525
|
|
|
12070
11526
|
declare const symbol$c_2: unique symbol;
|
|
12071
11527
|
|
|
12072
|
-
declare const symbol$c_3: unique symbol;
|
|
12073
|
-
|
|
12074
11528
|
declare const symbol$d: unique symbol;
|
|
12075
11529
|
|
|
12076
11530
|
declare const symbol$d_2: unique symbol;
|
|
12077
11531
|
|
|
12078
|
-
declare const symbol$d_3: unique symbol;
|
|
12079
|
-
|
|
12080
11532
|
declare const symbol$e: unique symbol;
|
|
12081
11533
|
|
|
12082
11534
|
declare const symbol$f: unique symbol;
|
|
@@ -12091,6 +11543,8 @@ declare const symbol$j: unique symbol;
|
|
|
12091
11543
|
|
|
12092
11544
|
declare const symbol$k: unique symbol;
|
|
12093
11545
|
|
|
11546
|
+
declare const symbol$l: unique symbol;
|
|
11547
|
+
|
|
12094
11548
|
declare const symbol: unique symbol;
|
|
12095
11549
|
|
|
12096
11550
|
declare const symbol_2: unique symbol;
|
|
@@ -12117,13 +11571,260 @@ export declare type SystemModelMessage = {
|
|
|
12117
11571
|
|
|
12118
11572
|
export declare const systemModelMessageSchema: z.ZodType<SystemModelMessage>;
|
|
12119
11573
|
|
|
11574
|
+
declare interface TakoCard {
|
|
11575
|
+
card_id?: string | null;
|
|
11576
|
+
title?: string | null;
|
|
11577
|
+
description?: string | null;
|
|
11578
|
+
semantic_description?: string | null;
|
|
11579
|
+
webpage_url?: string | null;
|
|
11580
|
+
image_url?: string | null;
|
|
11581
|
+
embed_url?: string | null;
|
|
11582
|
+
sources?: Array<{
|
|
11583
|
+
source_name?: string | null;
|
|
11584
|
+
source_description?: string | null;
|
|
11585
|
+
source_index: 'data' | 'web';
|
|
11586
|
+
source_text?: string | null;
|
|
11587
|
+
url?: string | null;
|
|
11588
|
+
}> | null;
|
|
11589
|
+
methodologies?: Array<{
|
|
11590
|
+
methodology_name: string | null;
|
|
11591
|
+
methodology_description: string | null;
|
|
11592
|
+
}> | null;
|
|
11593
|
+
source_indexes?: Array<'data' | 'web'> | null;
|
|
11594
|
+
card_type?: string | null;
|
|
11595
|
+
relevance?: 'High' | 'Low' | 'Medium' | null;
|
|
11596
|
+
content?: TakoResultContent | null;
|
|
11597
|
+
exportable?: boolean;
|
|
11598
|
+
nodes?: Array<{
|
|
11599
|
+
id: string;
|
|
11600
|
+
type: 'entity' | 'metric';
|
|
11601
|
+
name: string;
|
|
11602
|
+
description?: string | null;
|
|
11603
|
+
}> | null;
|
|
11604
|
+
metric_definitions?: Array<{
|
|
11605
|
+
name: string;
|
|
11606
|
+
definition: string;
|
|
11607
|
+
}> | null;
|
|
11608
|
+
data_freshness?: {
|
|
11609
|
+
coverage_end?: string | null;
|
|
11610
|
+
data_as_of?: string | null;
|
|
11611
|
+
last_updated?: string | null;
|
|
11612
|
+
} | null;
|
|
11613
|
+
}
|
|
11614
|
+
|
|
11615
|
+
declare type TakoContentFormat = 'card_json' | 'csv' | 'json_compact' | 'json_records';
|
|
11616
|
+
|
|
11617
|
+
declare type TakoDatasetCell = boolean | number | string | null;
|
|
11618
|
+
|
|
11619
|
+
declare interface TakoDataSourceConfig {
|
|
11620
|
+
/**
|
|
11621
|
+
* Maximum number of data results to return (1-20). When includeContents is
|
|
11622
|
+
* true, each additional result adds its own data surcharge.
|
|
11623
|
+
*/
|
|
11624
|
+
count?: number;
|
|
11625
|
+
/**
|
|
11626
|
+
* Inline rows for each data result. This adds a data surcharge based on row
|
|
11627
|
+
* count and dataset source. To estimate cost, search with includeContents
|
|
11628
|
+
* disabled and inspect cards.content.export_pricing. This applies to every
|
|
11629
|
+
* returned card; limit sources.data.count and sources.data.maxRows to control
|
|
11630
|
+
* cost.
|
|
11631
|
+
*/
|
|
11632
|
+
includeContents?: boolean;
|
|
11633
|
+
/** Requested delivery mode for card data. Search cards are always inlined. */
|
|
11634
|
+
mode?: 'inline' | 'url';
|
|
11635
|
+
/** Serialization for inlined card data. */
|
|
11636
|
+
contentFormat?: TakoContentFormat;
|
|
11637
|
+
/**
|
|
11638
|
+
* Maximum rows to inline per result. Omit to use the allowance in
|
|
11639
|
+
* cards.content.export_pricing. A data surcharge applies per 1,000 exported
|
|
11640
|
+
* rows; lower values reduce cost.
|
|
11641
|
+
*/
|
|
11642
|
+
maxRows?: number;
|
|
11643
|
+
/** Data Graph node IDs to prioritize. */
|
|
11644
|
+
nodeIds?: string[];
|
|
11645
|
+
/** Return only cards matching nodeIds. Requires at least one node ID. */
|
|
11646
|
+
strict?: boolean;
|
|
11647
|
+
}
|
|
11648
|
+
|
|
11649
|
+
declare interface TakoResultContent {
|
|
11650
|
+
content_format?: TakoContentFormat | null;
|
|
11651
|
+
cost?: number;
|
|
11652
|
+
data?: string | null;
|
|
11653
|
+
records?: Array<Record<string, TakoDatasetCell>> | null;
|
|
11654
|
+
dataset?: {
|
|
11655
|
+
columns: Array<{
|
|
11656
|
+
name: string;
|
|
11657
|
+
type: 'boolean' | 'date' | 'datetime' | 'number' | 'string';
|
|
11658
|
+
unit?: string | null;
|
|
11659
|
+
}>;
|
|
11660
|
+
rows: TakoDatasetCell[][];
|
|
11661
|
+
total_rows: number;
|
|
11662
|
+
truncated: boolean;
|
|
11663
|
+
ref: string;
|
|
11664
|
+
sources: Array<{
|
|
11665
|
+
name: string;
|
|
11666
|
+
index?: 'data' | 'web';
|
|
11667
|
+
}>;
|
|
11668
|
+
provenance?: 'query' | 'web_extraction';
|
|
11669
|
+
} | null;
|
|
11670
|
+
card_data?: Record<string, unknown> | null;
|
|
11671
|
+
card_data_schema?: Record<string, unknown> | null;
|
|
11672
|
+
url?: string | null;
|
|
11673
|
+
expires_at?: string | null;
|
|
11674
|
+
total_rows?: number | null;
|
|
11675
|
+
truncated?: boolean;
|
|
11676
|
+
export_pricing?: {
|
|
11677
|
+
baseline_usd: number;
|
|
11678
|
+
free_rows: number;
|
|
11679
|
+
max_rows_ceiling: number;
|
|
11680
|
+
row_cpm_usd: number;
|
|
11681
|
+
} | null;
|
|
11682
|
+
manifest?: Array<{
|
|
11683
|
+
dtype?: 'boolean' | 'date' | 'datetime' | 'number' | 'string' | null;
|
|
11684
|
+
entity?: string | null;
|
|
11685
|
+
metric?: string | null;
|
|
11686
|
+
name?: string | null;
|
|
11687
|
+
unit?: string | null;
|
|
11688
|
+
}> | null;
|
|
11689
|
+
}
|
|
11690
|
+
|
|
11691
|
+
declare interface TakoSearchConfig {
|
|
11692
|
+
/** Search effort. fast is the default balanced option. */
|
|
11693
|
+
effort?: TakoSearchEffort;
|
|
11694
|
+
/** Sources to search. Omit to search both curated data and the web. */
|
|
11695
|
+
sources?: {
|
|
11696
|
+
data?: TakoDataSourceConfig;
|
|
11697
|
+
web?: TakoWebSourceConfig;
|
|
11698
|
+
};
|
|
11699
|
+
/** End-user coordinates for localized results. */
|
|
11700
|
+
location?: {
|
|
11701
|
+
latitude: number;
|
|
11702
|
+
longitude: number;
|
|
11703
|
+
};
|
|
11704
|
+
/** ISO 3166-1 alpha-2 country code. */
|
|
11705
|
+
countryCode?: string;
|
|
11706
|
+
/** BCP-47 locale. */
|
|
11707
|
+
locale?: string;
|
|
11708
|
+
/** IANA timezone. */
|
|
11709
|
+
timezone?: string;
|
|
11710
|
+
/** Settings that control card rendering. */
|
|
11711
|
+
outputSettings?: {
|
|
11712
|
+
imageDarkMode?: boolean;
|
|
11713
|
+
/** Instant-effort only. */
|
|
11714
|
+
forceRefresh?: boolean;
|
|
11715
|
+
};
|
|
11716
|
+
/** Maximum related search suggestions to include (1-20). */
|
|
11717
|
+
includeRelated?: number;
|
|
11718
|
+
}
|
|
11719
|
+
|
|
11720
|
+
declare type TakoSearchEffort = 'deep' | 'fast' | 'instant';
|
|
11721
|
+
|
|
11722
|
+
declare interface TakoSearchError {
|
|
11723
|
+
error: 'api_error' | 'configuration_error' | 'execution_error' | 'invalid_input' | 'rate_limit' | 'timeout' | 'unknown_tool';
|
|
11724
|
+
statusCode?: number;
|
|
11725
|
+
message: string;
|
|
11726
|
+
}
|
|
11727
|
+
|
|
11728
|
+
declare interface TakoSearchInput {
|
|
11729
|
+
query: string;
|
|
11730
|
+
effort?: TakoSearchEffort;
|
|
11731
|
+
sources?: {
|
|
11732
|
+
data?: {
|
|
11733
|
+
count?: number;
|
|
11734
|
+
include_contents?: boolean;
|
|
11735
|
+
mode?: 'inline' | 'url';
|
|
11736
|
+
content_format?: TakoContentFormat;
|
|
11737
|
+
max_rows?: number;
|
|
11738
|
+
node_ids?: string[];
|
|
11739
|
+
strict?: boolean;
|
|
11740
|
+
};
|
|
11741
|
+
web?: {
|
|
11742
|
+
count?: number;
|
|
11743
|
+
include_contents?: boolean;
|
|
11744
|
+
category?: 'finance' | 'news' | 'sports';
|
|
11745
|
+
include_domains?: string[];
|
|
11746
|
+
exclude_domains?: string[];
|
|
11747
|
+
snippet_max_chars?: number;
|
|
11748
|
+
highlights?: boolean;
|
|
11749
|
+
article_content_max_chars?: number;
|
|
11750
|
+
published_after?: string;
|
|
11751
|
+
published_before?: string;
|
|
11752
|
+
};
|
|
11753
|
+
};
|
|
11754
|
+
location?: {
|
|
11755
|
+
latitude: number;
|
|
11756
|
+
longitude: number;
|
|
11757
|
+
};
|
|
11758
|
+
country_code?: string;
|
|
11759
|
+
locale?: string;
|
|
11760
|
+
timezone?: string;
|
|
11761
|
+
output_settings?: {
|
|
11762
|
+
image_dark_mode?: boolean;
|
|
11763
|
+
force_refresh?: boolean;
|
|
11764
|
+
};
|
|
11765
|
+
include_related?: number;
|
|
11766
|
+
}
|
|
11767
|
+
|
|
11768
|
+
declare type TakoSearchOutput = TakoSearchError | TakoSearchResponse;
|
|
11769
|
+
|
|
11770
|
+
declare interface TakoSearchResponse {
|
|
11771
|
+
request_id: string;
|
|
11772
|
+
cards?: TakoCard[];
|
|
11773
|
+
web_results?: TakoWebResult[];
|
|
11774
|
+
usage?: {
|
|
11775
|
+
total_cost_usd: number;
|
|
11776
|
+
compute?: {
|
|
11777
|
+
cost_usd: number;
|
|
11778
|
+
} | null;
|
|
11779
|
+
data?: {
|
|
11780
|
+
cost_usd: number;
|
|
11781
|
+
datasets: number;
|
|
11782
|
+
} | null;
|
|
11783
|
+
} | null;
|
|
11784
|
+
related?: Array<Record<string, unknown>> | null;
|
|
11785
|
+
}
|
|
11786
|
+
|
|
11787
|
+
declare const takoSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<TakoSearchInput, TakoSearchOutput, TakoSearchConfig>;
|
|
11788
|
+
|
|
11789
|
+
declare interface TakoWebResult {
|
|
11790
|
+
title: string;
|
|
11791
|
+
url: string;
|
|
11792
|
+
snippet?: string | null;
|
|
11793
|
+
source_name?: string | null;
|
|
11794
|
+
publish_date?: string | null;
|
|
11795
|
+
content?: TakoResultContent | null;
|
|
11796
|
+
}
|
|
11797
|
+
|
|
11798
|
+
declare interface TakoWebSourceConfig {
|
|
11799
|
+
/** Maximum number of web results to return (1-20). */
|
|
11800
|
+
count?: number;
|
|
11801
|
+
/** Inline extracted web page text. This can add a data charge. */
|
|
11802
|
+
includeContents?: boolean;
|
|
11803
|
+
/** Optional web-result category filter. */
|
|
11804
|
+
category?: 'finance' | 'news' | 'sports';
|
|
11805
|
+
/** Only return results from these bare domains. */
|
|
11806
|
+
includeDomains?: string[];
|
|
11807
|
+
/** Exclude results from these bare domains. */
|
|
11808
|
+
excludeDomains?: string[];
|
|
11809
|
+
/** Maximum characters in each web-result snippet. */
|
|
11810
|
+
snippetMaxChars?: number;
|
|
11811
|
+
/** Include highlighted passages in web results. Defaults to true in AI Gateway. */
|
|
11812
|
+
highlights?: boolean;
|
|
11813
|
+
/** Maximum extracted characters per web page when including contents. */
|
|
11814
|
+
articleContentMaxChars?: number;
|
|
11815
|
+
/** Keep results published on or after this ISO date. */
|
|
11816
|
+
publishedAfter?: string;
|
|
11817
|
+
/** Keep results published on or before this ISO date. */
|
|
11818
|
+
publishedBefore?: string;
|
|
11819
|
+
}
|
|
11820
|
+
|
|
12120
11821
|
/**
|
|
12121
11822
|
* Implement this interface to create custom telemetry integrations.
|
|
12122
11823
|
* Methods can be sync or return a PromiseLike.
|
|
12123
11824
|
*/
|
|
12124
11825
|
export declare interface TelemetryIntegration {
|
|
12125
|
-
onStart?: Listener<OnStartEvent<ToolSet,
|
|
12126
|
-
onStepStart?: Listener<OnStepStartEvent<ToolSet,
|
|
11826
|
+
onStart?: Listener<OnStartEvent<ToolSet, OutputInterface>>;
|
|
11827
|
+
onStepStart?: Listener<OnStepStartEvent<ToolSet, OutputInterface>>;
|
|
12127
11828
|
onToolCallStart?: Listener<OnToolCallStartEvent<ToolSet>>;
|
|
12128
11829
|
onToolCallFinish?: Listener<OnToolCallFinishEvent<ToolSet>>;
|
|
12129
11830
|
onStepFinish?: Listener<OnStepFinishEvent<ToolSet>>;
|
|
@@ -12225,6 +11926,8 @@ export declare type TextStreamPart<TOOLS extends ToolSet> = {
|
|
|
12225
11926
|
type: 'tool-input-start';
|
|
12226
11927
|
id: string;
|
|
12227
11928
|
toolName: string;
|
|
11929
|
+
/** Encoding of the input deltas. Defaults to JSON when omitted. */
|
|
11930
|
+
inputEncoding?: 'json' | 'text';
|
|
12228
11931
|
providerMetadata?: ProviderMetadata;
|
|
12229
11932
|
toolMetadata?: JSONObject;
|
|
12230
11933
|
providerExecuted?: boolean;
|
|
@@ -12329,7 +12032,7 @@ export declare type TimeoutConfiguration = number | {
|
|
|
12329
12032
|
*
|
|
12330
12033
|
* The tool can also contain an optional execute function for the actual execution function of the tool.
|
|
12331
12034
|
*/
|
|
12332
|
-
export declare type Tool<INPUT extends
|
|
12035
|
+
export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTPUT extends JSONValue_2 | unknown | never = any> = {
|
|
12333
12036
|
/**
|
|
12334
12037
|
* An optional description of what the tool does.
|
|
12335
12038
|
* Will be used by the language model to decide whether to use the tool.
|
|
@@ -12355,7 +12058,7 @@ export declare type Tool<INPUT extends JSONValue_3 | unknown | never = any, OUTP
|
|
|
12355
12058
|
* and UI message parts. This is useful for sources of dynamic tools (e.g.
|
|
12356
12059
|
* an MCP server) to identify themselves.
|
|
12357
12060
|
*/
|
|
12358
|
-
metadata?:
|
|
12061
|
+
metadata?: JSONObject;
|
|
12359
12062
|
/**
|
|
12360
12063
|
* The schema of the input that the tool expects.
|
|
12361
12064
|
* The language model will use this to generate the input.
|
|
@@ -12538,6 +12241,13 @@ export declare type ToolApprovalResponse = {
|
|
|
12538
12241
|
approved: boolean;
|
|
12539
12242
|
/**
|
|
12540
12243
|
* Optional reason for the approval or denial.
|
|
12244
|
+
*
|
|
12245
|
+
* For denied tool calls, the reason is included in the `execution-denied`
|
|
12246
|
+
* tool result that is sent to the model. For approved tool calls that are
|
|
12247
|
+
* executed by the SDK, the reason remains in the message history: it is not
|
|
12248
|
+
* included in the model prompt and is not exposed through a dedicated tool
|
|
12249
|
+
* execution option. For provider-executed tools, the approval response
|
|
12250
|
+
* (including the reason) is forwarded to the provider.
|
|
12541
12251
|
*/
|
|
12542
12252
|
reason?: string;
|
|
12543
12253
|
/**
|
|
@@ -12576,7 +12286,7 @@ declare interface ToolCall<NAME extends string, INPUT> {
|
|
|
12576
12286
|
}
|
|
12577
12287
|
|
|
12578
12288
|
export declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
12579
|
-
private readonly [symbol$
|
|
12289
|
+
private readonly [symbol$f];
|
|
12580
12290
|
readonly toolCallId: string;
|
|
12581
12291
|
readonly approvalId: string;
|
|
12582
12292
|
constructor({ toolCallId, approvalId, }: {
|
|
@@ -12668,6 +12378,45 @@ export declare type ToolChoice<TOOLS extends Record<string, unknown>> = 'auto' |
|
|
|
12668
12378
|
toolName: Extract<keyof TOOLS, string>;
|
|
12669
12379
|
};
|
|
12670
12380
|
|
|
12381
|
+
/**
|
|
12382
|
+
* Thrown when a model response does not satisfy an enforced tool choice.
|
|
12383
|
+
*/
|
|
12384
|
+
export declare class ToolChoiceViolationError extends AISDKError {
|
|
12385
|
+
private readonly [symbol$7_2];
|
|
12386
|
+
/**
|
|
12387
|
+
* The tool choice that the model response did not satisfy.
|
|
12388
|
+
*/
|
|
12389
|
+
readonly toolChoice: EnforcedToolChoice;
|
|
12390
|
+
/**
|
|
12391
|
+
* Reason why the model finished generating the response.
|
|
12392
|
+
*/
|
|
12393
|
+
readonly finishReason: FinishReason;
|
|
12394
|
+
/**
|
|
12395
|
+
* The provider that returned the response.
|
|
12396
|
+
*/
|
|
12397
|
+
readonly provider: string;
|
|
12398
|
+
/**
|
|
12399
|
+
* The model that returned the response.
|
|
12400
|
+
*/
|
|
12401
|
+
readonly modelId: string;
|
|
12402
|
+
/**
|
|
12403
|
+
* The normalized content returned by the model.
|
|
12404
|
+
*
|
|
12405
|
+
* This can be inspected to recover a tool call that the provider returned as
|
|
12406
|
+
* text or reasoning instead of a structured tool call.
|
|
12407
|
+
*/
|
|
12408
|
+
readonly content: Array<LanguageModelV3Content>;
|
|
12409
|
+
constructor({ toolChoice, finishReason, provider, modelId, content, message, }: {
|
|
12410
|
+
toolChoice: EnforcedToolChoice;
|
|
12411
|
+
finishReason: FinishReason;
|
|
12412
|
+
provider: string;
|
|
12413
|
+
modelId: string;
|
|
12414
|
+
content: Array<LanguageModelV3Content>;
|
|
12415
|
+
message?: string;
|
|
12416
|
+
});
|
|
12417
|
+
static isInstance(error: unknown): error is ToolChoiceViolationError;
|
|
12418
|
+
}
|
|
12419
|
+
|
|
12671
12420
|
/**
|
|
12672
12421
|
* Content of a tool message. It is an array of tool result parts.
|
|
12673
12422
|
*/
|
|
@@ -12718,7 +12467,7 @@ export declare interface ToolExecutionOptions {
|
|
|
12718
12467
|
* - A tool call needs approval, or
|
|
12719
12468
|
* - A stop condition is met (default stop condition is stepCountIs(20))
|
|
12720
12469
|
*/
|
|
12721
|
-
declare class ToolLoopAgent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends
|
|
12470
|
+
declare class ToolLoopAgent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends OutputInterface = never> implements Agent<CALL_OPTIONS, TOOLS, OUTPUT> {
|
|
12722
12471
|
readonly version = "agent-v1";
|
|
12723
12472
|
private readonly settings;
|
|
12724
12473
|
constructor(settings: ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>);
|
|
@@ -12751,7 +12500,7 @@ export declare type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}
|
|
|
12751
12500
|
/**
|
|
12752
12501
|
* Configuration options for an agent.
|
|
12753
12502
|
*/
|
|
12754
|
-
declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends
|
|
12503
|
+
declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends OutputInterface = never> = Omit<CallSettings, 'abortSignal'> & {
|
|
12755
12504
|
/**
|
|
12756
12505
|
* The id of the agent.
|
|
12757
12506
|
*/
|
|
@@ -12819,6 +12568,12 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
12819
12568
|
* Callback that is called when all steps are finished and the response is complete.
|
|
12820
12569
|
*/
|
|
12821
12570
|
onFinish?: ToolLoopAgentOnFinishCallback<NoInfer<TOOLS>>;
|
|
12571
|
+
/**
|
|
12572
|
+
* Secret for HMAC-signing tool approval requests. When set, the server
|
|
12573
|
+
* signs each approval request at issuance and verifies the signature when
|
|
12574
|
+
* the approval is replayed, preventing client-forged approvals.
|
|
12575
|
+
*/
|
|
12576
|
+
experimental_toolApprovalSecret?: string | Uint8Array;
|
|
12822
12577
|
/**
|
|
12823
12578
|
* Additional provider-specific options. They are passed through
|
|
12824
12579
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -12858,7 +12613,7 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
|
|
|
12858
12613
|
* }),
|
|
12859
12614
|
* ```
|
|
12860
12615
|
*/
|
|
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'>>;
|
|
12616
|
+
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
12617
|
};
|
|
12863
12618
|
export { ToolLoopAgentSettings as Experimental_AgentSettings }
|
|
12864
12619
|
export { ToolLoopAgentSettings }
|
|
@@ -12983,7 +12738,7 @@ declare type ToolResultOutput = {
|
|
|
12983
12738
|
providerOptions?: ProviderOptions;
|
|
12984
12739
|
} | {
|
|
12985
12740
|
type: 'json';
|
|
12986
|
-
value:
|
|
12741
|
+
value: JSONValue_2;
|
|
12987
12742
|
/**
|
|
12988
12743
|
* Provider-specific options.
|
|
12989
12744
|
*/
|
|
@@ -13010,7 +12765,7 @@ declare type ToolResultOutput = {
|
|
|
13010
12765
|
providerOptions?: ProviderOptions;
|
|
13011
12766
|
} | {
|
|
13012
12767
|
type: 'error-json';
|
|
13013
|
-
value:
|
|
12768
|
+
value: JSONValue_2;
|
|
13014
12769
|
/**
|
|
13015
12770
|
* Provider-specific options.
|
|
13016
12771
|
*/
|
|
@@ -13220,6 +12975,11 @@ declare interface Tracer {
|
|
|
13220
12975
|
* Additionally the new span gets set in context and this context is activated
|
|
13221
12976
|
* for the duration of the function call.
|
|
13222
12977
|
*
|
|
12978
|
+
* **Important**: The callback function is responsible for calling `span.end()`
|
|
12979
|
+
* to finish the span. Unlike some other OpenTelemetry implementations, the span
|
|
12980
|
+
* is NOT automatically ended when the callback returns. If `span.end()` is not
|
|
12981
|
+
* called, the span will never be exported and will be silently lost.
|
|
12982
|
+
*
|
|
13223
12983
|
* @param name The name of the span
|
|
13224
12984
|
* @param [options] SpanOptions used for span creation
|
|
13225
12985
|
* @param [context] Context to use to extract parent
|
|
@@ -13643,21 +13403,6 @@ declare interface TypeValidationContext {
|
|
|
13643
13403
|
entityId?: string;
|
|
13644
13404
|
}
|
|
13645
13405
|
|
|
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
13406
|
export declare class TypeValidationError extends AISDKError {
|
|
13662
13407
|
private readonly [symbol$1];
|
|
13663
13408
|
readonly value: unknown;
|
|
@@ -13686,34 +13431,6 @@ export declare class TypeValidationError extends AISDKError {
|
|
|
13686
13431
|
}): TypeValidationError;
|
|
13687
13432
|
}
|
|
13688
13433
|
|
|
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
13434
|
export declare const UI_MESSAGE_STREAM_HEADERS: {
|
|
13718
13435
|
'content-type': string;
|
|
13719
13436
|
'cache-control': string;
|
|
@@ -13816,6 +13533,8 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
13816
13533
|
type: 'tool-approval-request';
|
|
13817
13534
|
approvalId: string;
|
|
13818
13535
|
toolCallId: string;
|
|
13536
|
+
approvalDescriptor?: unknown;
|
|
13537
|
+
inputSchemaInput?: unknown;
|
|
13819
13538
|
signature?: string;
|
|
13820
13539
|
} | {
|
|
13821
13540
|
type: 'tool-output-available';
|
|
@@ -13841,6 +13560,8 @@ export declare type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIData
|
|
|
13841
13560
|
type: 'tool-input-start';
|
|
13842
13561
|
toolCallId: string;
|
|
13843
13562
|
toolName: string;
|
|
13563
|
+
/** Encoding of the input deltas. Defaults to JSON when omitted. */
|
|
13564
|
+
inputEncoding?: 'json' | 'text';
|
|
13844
13565
|
providerExecuted?: boolean;
|
|
13845
13566
|
providerMetadata?: ProviderMetadata;
|
|
13846
13567
|
toolMetadata?: JSONObject;
|
|
@@ -13934,6 +13655,11 @@ export declare type UIMessageStreamOnFinishCallback<UI_MESSAGE extends UIMessage
|
|
|
13934
13655
|
* Indicates whether the stream was aborted.
|
|
13935
13656
|
*/
|
|
13936
13657
|
isAborted: boolean;
|
|
13658
|
+
/**
|
|
13659
|
+
* The operation-level outcome of the stream. Fatal stream-processing
|
|
13660
|
+
* failures override outcomes declared by the stream owner.
|
|
13661
|
+
*/
|
|
13662
|
+
outcome: UIMessageStreamOutcome;
|
|
13937
13663
|
/**
|
|
13938
13664
|
* The message that was sent to the client as a response
|
|
13939
13665
|
* (including the original message if it was extended).
|
|
@@ -14015,16 +13741,45 @@ export declare type UIMessageStreamOptions<UI_MESSAGE extends UIMessage> = {
|
|
|
14015
13741
|
/**
|
|
14016
13742
|
* Process an error, e.g. to log it. Default to `() => 'An error occurred.'`.
|
|
14017
13743
|
*
|
|
13744
|
+
* Tool execution errors marked `providerExecuted: true` bypass this callback.
|
|
13745
|
+
* Their strings pass through unchanged; other values are JSON-stringified to
|
|
13746
|
+
* preserve provider error data for model-message round trips. Stream errors
|
|
13747
|
+
* and invalid tool calls still use it.
|
|
13748
|
+
*
|
|
14018
13749
|
* @returns error message to include in the data stream.
|
|
14019
13750
|
*/
|
|
14020
13751
|
onError?: (error: unknown) => string;
|
|
14021
13752
|
};
|
|
14022
13753
|
|
|
13754
|
+
/**
|
|
13755
|
+
* The operation-level outcome of a UI message stream.
|
|
13756
|
+
*
|
|
13757
|
+
* This is separate from model finish reasons and individual stream chunks.
|
|
13758
|
+
* Fatal stream-processing failures override outcomes declared by the stream
|
|
13759
|
+
* owner.
|
|
13760
|
+
*/
|
|
13761
|
+
export declare type UIMessageStreamOutcome = {
|
|
13762
|
+
status: 'completed';
|
|
13763
|
+
} | {
|
|
13764
|
+
status: 'failed';
|
|
13765
|
+
error?: unknown;
|
|
13766
|
+
} | {
|
|
13767
|
+
status: 'aborted';
|
|
13768
|
+
} | {
|
|
13769
|
+
status: 'unknown';
|
|
13770
|
+
};
|
|
13771
|
+
|
|
14023
13772
|
/**
|
|
14024
13773
|
* Options for creating a UI message stream response.
|
|
14025
13774
|
* Extends the standard `ResponseInit` with additional streaming options.
|
|
14026
13775
|
*/
|
|
14027
13776
|
declare type UIMessageStreamResponseInit = ResponseInit & {
|
|
13777
|
+
/**
|
|
13778
|
+
* Optional interval in milliseconds for sending SSE keep-alive comments.
|
|
13779
|
+
* When set, an opening comment is sent immediately and additional comments
|
|
13780
|
+
* are sent after the stream has been idle for the configured interval.
|
|
13781
|
+
*/
|
|
13782
|
+
keepAliveMs?: number;
|
|
14028
13783
|
/**
|
|
14029
13784
|
* Optional callback to consume a copy of the SSE stream independently.
|
|
14030
13785
|
* This is useful for logging, debugging, or processing the stream in parallel.
|
|
@@ -14052,6 +13807,18 @@ export declare interface UIMessageStreamWriter<UI_MESSAGE extends UIMessage = UI
|
|
|
14052
13807
|
onError: ErrorHandler | undefined;
|
|
14053
13808
|
}
|
|
14054
13809
|
|
|
13810
|
+
export declare interface UIMessageStreamWriterWithOutcome<UI_MESSAGE extends UIMessage = UIMessage> extends UIMessageStreamWriter<UI_MESSAGE> {
|
|
13811
|
+
/**
|
|
13812
|
+
* Declares the operation-level outcome of the composed stream.
|
|
13813
|
+
*
|
|
13814
|
+
* The first outcome declared through this method is retained. Fatal
|
|
13815
|
+
* execution, merge, error-handling, or downstream processing failures
|
|
13816
|
+
* override declared outcomes. Declaring an outcome does not write a chunk or
|
|
13817
|
+
* close the stream.
|
|
13818
|
+
*/
|
|
13819
|
+
setOutcome(outcome: UIMessageStreamOutcome): void;
|
|
13820
|
+
}
|
|
13821
|
+
|
|
14055
13822
|
export declare type UITool = {
|
|
14056
13823
|
input: unknown;
|
|
14057
13824
|
output: unknown | undefined;
|
|
@@ -14076,6 +13843,15 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14076
13843
|
} & ({
|
|
14077
13844
|
state: 'input-streaming';
|
|
14078
13845
|
input?: DeepPartial<asUITool<TOOL>['input']> | undefined;
|
|
13846
|
+
/**
|
|
13847
|
+
* The raw tool input text received so far.
|
|
13848
|
+
*
|
|
13849
|
+
* This is used to continue input streaming when a message is persisted
|
|
13850
|
+
* and later resumed.
|
|
13851
|
+
*/
|
|
13852
|
+
rawInput?: string;
|
|
13853
|
+
/** Encoding of `rawInput`. Defaults to JSON when omitted. */
|
|
13854
|
+
inputEncoding?: 'json' | 'text';
|
|
14079
13855
|
output?: never;
|
|
14080
13856
|
errorText?: never;
|
|
14081
13857
|
callProviderMetadata?: ProviderMetadata;
|
|
@@ -14096,8 +13872,10 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14096
13872
|
approval: {
|
|
14097
13873
|
id: string;
|
|
14098
13874
|
approved?: never;
|
|
13875
|
+
descriptor?: unknown;
|
|
14099
13876
|
reason?: never;
|
|
14100
13877
|
signature?: string;
|
|
13878
|
+
inputSchemaInput?: unknown;
|
|
14101
13879
|
};
|
|
14102
13880
|
} | {
|
|
14103
13881
|
state: 'approval-responded';
|
|
@@ -14108,8 +13886,10 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14108
13886
|
approval: {
|
|
14109
13887
|
id: string;
|
|
14110
13888
|
approved: boolean;
|
|
13889
|
+
descriptor?: unknown;
|
|
14111
13890
|
reason?: string;
|
|
14112
13891
|
signature?: string;
|
|
13892
|
+
inputSchemaInput?: unknown;
|
|
14113
13893
|
};
|
|
14114
13894
|
} | {
|
|
14115
13895
|
state: 'output-available';
|
|
@@ -14122,8 +13902,10 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14122
13902
|
approval?: {
|
|
14123
13903
|
id: string;
|
|
14124
13904
|
approved: true;
|
|
13905
|
+
descriptor?: unknown;
|
|
14125
13906
|
reason?: string;
|
|
14126
13907
|
signature?: string;
|
|
13908
|
+
inputSchemaInput?: unknown;
|
|
14127
13909
|
};
|
|
14128
13910
|
} | {
|
|
14129
13911
|
state: 'output-error';
|
|
@@ -14136,8 +13918,10 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14136
13918
|
approval?: {
|
|
14137
13919
|
id: string;
|
|
14138
13920
|
approved: true;
|
|
13921
|
+
descriptor?: unknown;
|
|
14139
13922
|
reason?: string;
|
|
14140
13923
|
signature?: string;
|
|
13924
|
+
inputSchemaInput?: unknown;
|
|
14141
13925
|
};
|
|
14142
13926
|
} | {
|
|
14143
13927
|
state: 'output-denied';
|
|
@@ -14148,8 +13932,10 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
14148
13932
|
approval: {
|
|
14149
13933
|
id: string;
|
|
14150
13934
|
approved: false;
|
|
13935
|
+
descriptor?: unknown;
|
|
14151
13936
|
reason?: string;
|
|
14152
13937
|
signature?: string;
|
|
13938
|
+
inputSchemaInput?: unknown;
|
|
14153
13939
|
};
|
|
14154
13940
|
});
|
|
14155
13941
|
|
|
@@ -14287,7 +14073,7 @@ declare function validateDownloadUrl(url: string): void;
|
|
|
14287
14073
|
declare function validateTypes<OBJECT>({ value, schema, context, }: {
|
|
14288
14074
|
value: unknown;
|
|
14289
14075
|
schema: FlexibleSchema<OBJECT>;
|
|
14290
|
-
context?:
|
|
14076
|
+
context?: TypeValidationContext;
|
|
14291
14077
|
}): Promise<OBJECT>;
|
|
14292
14078
|
|
|
14293
14079
|
/**
|
|
@@ -14297,7 +14083,9 @@ declare function validateTypes<OBJECT>({ value, schema, context, }: {
|
|
|
14297
14083
|
* the corresponding schemas are provided. Otherwise, they are assumed to be
|
|
14298
14084
|
* valid.
|
|
14299
14085
|
*/
|
|
14300
|
-
export declare function validateUIMessages<UI_MESSAGE extends UIMessage>(
|
|
14086
|
+
export declare function validateUIMessages<UI_MESSAGE extends UIMessage>(options: ValidateUIMessagesOptions<UI_MESSAGE>): Promise<Array<UI_MESSAGE>>;
|
|
14087
|
+
|
|
14088
|
+
declare type ValidateUIMessagesOptions<UI_MESSAGE extends UIMessage> = {
|
|
14301
14089
|
messages: unknown;
|
|
14302
14090
|
metadataSchema?: FlexibleSchema<UIMessage['metadata']>;
|
|
14303
14091
|
dataSchemas?: {
|
|
@@ -14306,7 +14094,7 @@ export declare function validateUIMessages<UI_MESSAGE extends UIMessage>({ messa
|
|
|
14306
14094
|
tools?: {
|
|
14307
14095
|
[NAME in keyof InferUIMessageTools<UI_MESSAGE> & string]?: Tool<InferUIMessageTools<UI_MESSAGE>[NAME]['input'], InferUIMessageTools<UI_MESSAGE>[NAME]['output']>;
|
|
14308
14096
|
};
|
|
14309
|
-
}
|
|
14097
|
+
};
|
|
14310
14098
|
|
|
14311
14099
|
declare type ValidationResult<OBJECT> = {
|
|
14312
14100
|
success: true;
|
|
@@ -14490,11 +14278,12 @@ declare type VideoModelV3CallOptions = {
|
|
|
14490
14278
|
n: number;
|
|
14491
14279
|
/**
|
|
14492
14280
|
* Aspect ratio of the videos to generate.
|
|
14493
|
-
* Must have the format `{width}:{height}
|
|
14281
|
+
* Must have the format `{width}:{height}`, or `'adaptive'` to inherit the
|
|
14282
|
+
* ratio from the input media.
|
|
14494
14283
|
* `undefined` will use the provider's default aspect ratio.
|
|
14495
14284
|
* Common values: '16:9', '9:16', '1:1', '21:9', '4:3'
|
|
14496
14285
|
*/
|
|
14497
|
-
aspectRatio: `${number}:${number}` | undefined;
|
|
14286
|
+
aspectRatio: `${number}:${number}` | 'adaptive' | undefined;
|
|
14498
14287
|
/**
|
|
14499
14288
|
* Resolution of the video to generate.
|
|
14500
14289
|
* Format: `{width}x{height}` (e.g., '1280x720', '1920x1080')
|
|
@@ -14759,5 +14548,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
|
|
|
14759
14548
|
}): Schema<OBJECT>;
|
|
14760
14549
|
|
|
14761
14550
|
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$
|
|
14551
|
+
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 };
|
|
14552
|
+
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 };
|