@mastra/schema-compat 1.2.9-alpha.1 → 1.2.10-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/_types/@internal_ai-sdk-v4/dist/index.d.ts +51 -5
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +487 -1773
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +357 -1772
- package/dist/index.cjs +32 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -28
- package/dist/index.js.map +1 -1
- package/dist/provider-compats/google.d.ts +1 -0
- package/dist/provider-compats/google.d.ts.map +1 -1
- package/package.json +16 -16
|
@@ -116,61 +116,61 @@ declare namespace _ai_sdk_provider {
|
|
|
116
116
|
JSONSchema7Definition,
|
|
117
117
|
AISDKError,
|
|
118
118
|
APICallError,
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
EmbeddingModelV2,
|
|
120
|
+
EmbeddingModelV2Embedding,
|
|
121
121
|
EmptyResponseBodyError,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
ImageModelV2,
|
|
123
|
+
ImageModelV2CallOptions,
|
|
124
|
+
ImageModelV2CallWarning,
|
|
125
|
+
ImageModelV2ProviderMetadata,
|
|
126
126
|
InvalidArgumentError_2 as InvalidArgumentError,
|
|
127
127
|
InvalidPromptError,
|
|
128
128
|
InvalidResponseDataError,
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
JSONArray,
|
|
130
|
+
JSONObject,
|
|
131
131
|
JSONParseError,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
132
|
+
JSONValue_2 as JSONValue,
|
|
133
|
+
LanguageModelV2,
|
|
134
|
+
LanguageModelV2CallOptions,
|
|
135
|
+
LanguageModelV2CallWarning,
|
|
136
|
+
LanguageModelV2Content,
|
|
137
|
+
LanguageModelV2DataContent,
|
|
138
|
+
LanguageModelV2File,
|
|
139
|
+
LanguageModelV2FilePart,
|
|
140
|
+
LanguageModelV2FinishReason,
|
|
141
|
+
LanguageModelV2FunctionTool,
|
|
142
|
+
LanguageModelV2Message,
|
|
143
143
|
LanguageModelV2Middleware,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
144
|
+
LanguageModelV2Prompt,
|
|
145
|
+
LanguageModelV2ProviderDefinedTool,
|
|
146
|
+
LanguageModelV2Reasoning,
|
|
147
|
+
LanguageModelV2ReasoningPart,
|
|
148
|
+
LanguageModelV2ResponseMetadata,
|
|
149
|
+
LanguageModelV2Source,
|
|
150
|
+
LanguageModelV2StreamPart,
|
|
151
|
+
LanguageModelV2Text,
|
|
152
|
+
LanguageModelV2TextPart,
|
|
153
|
+
LanguageModelV2ToolCall,
|
|
154
|
+
LanguageModelV2ToolCallPart,
|
|
155
|
+
LanguageModelV2ToolChoice,
|
|
156
|
+
LanguageModelV2ToolResultOutput,
|
|
157
|
+
LanguageModelV2ToolResultPart,
|
|
158
|
+
LanguageModelV2Usage,
|
|
159
159
|
LoadAPIKeyError,
|
|
160
160
|
LoadSettingError,
|
|
161
161
|
NoContentGeneratedError,
|
|
162
162
|
NoSuchModelError,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
163
|
+
ProviderV2,
|
|
164
|
+
SharedV2Headers,
|
|
165
|
+
SharedV2ProviderMetadata,
|
|
166
|
+
SharedV2ProviderOptions,
|
|
167
|
+
SpeechModelV2,
|
|
168
|
+
SpeechModelV2CallOptions,
|
|
169
|
+
SpeechModelV2CallWarning,
|
|
170
170
|
TooManyEmbeddingValuesForCallError,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
TranscriptionModelV2,
|
|
172
|
+
TranscriptionModelV2CallOptions,
|
|
173
|
+
TranscriptionModelV2CallWarning,
|
|
174
174
|
TypeValidationError,
|
|
175
175
|
UnsupportedFunctionalityError,
|
|
176
176
|
getErrorMessage_2 as getErrorMessage,
|
|
@@ -186,8 +186,10 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
186
186
|
EventSourceParserStream,
|
|
187
187
|
AssistantContent,
|
|
188
188
|
AssistantModelMessage,
|
|
189
|
+
DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
189
190
|
DataContent,
|
|
190
191
|
DelayedPromise,
|
|
192
|
+
DownloadError_2 as DownloadError,
|
|
191
193
|
FetchFunction,
|
|
192
194
|
FilePart,
|
|
193
195
|
FlexibleSchema,
|
|
@@ -268,12 +270,14 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
268
270
|
postFormDataToApi,
|
|
269
271
|
postJsonToApi,
|
|
270
272
|
postToApi,
|
|
273
|
+
readResponseWithSizeLimit,
|
|
271
274
|
removeUndefinedEntries,
|
|
272
275
|
resolve,
|
|
273
276
|
safeParseJSON,
|
|
274
277
|
safeValidateTypes,
|
|
275
278
|
standardSchemaValidator,
|
|
276
279
|
tool,
|
|
280
|
+
validateDownloadUrl,
|
|
277
281
|
validateTypes,
|
|
278
282
|
validator,
|
|
279
283
|
withUserAgentSuffix,
|
|
@@ -290,38 +294,6 @@ declare namespace _ai_sdk_provider_utils {
|
|
|
290
294
|
* @extends Error
|
|
291
295
|
*/
|
|
292
296
|
export declare class AISDKError extends Error {
|
|
293
|
-
private readonly [symbol$d_2];
|
|
294
|
-
/**
|
|
295
|
-
* The underlying cause of the error, if any.
|
|
296
|
-
*/
|
|
297
|
-
readonly cause?: unknown;
|
|
298
|
-
/**
|
|
299
|
-
* Creates an AI SDK Error.
|
|
300
|
-
*
|
|
301
|
-
* @param {Object} params - The parameters for creating the error.
|
|
302
|
-
* @param {string} params.name - The name of the error.
|
|
303
|
-
* @param {string} params.message - The error message.
|
|
304
|
-
* @param {unknown} [params.cause] - The underlying cause of the error.
|
|
305
|
-
*/
|
|
306
|
-
constructor({ name, message, cause, }: {
|
|
307
|
-
name: string;
|
|
308
|
-
message: string;
|
|
309
|
-
cause?: unknown;
|
|
310
|
-
});
|
|
311
|
-
/**
|
|
312
|
-
* Checks if the given error is an AI SDK Error.
|
|
313
|
-
* @param {unknown} error - The error to check.
|
|
314
|
-
* @returns {boolean} True if the error is an AI SDK Error, false otherwise.
|
|
315
|
-
*/
|
|
316
|
-
static isInstance(error: unknown): error is AISDKError;
|
|
317
|
-
protected static hasMarker(error: unknown, marker: string): boolean;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Custom error class for AI SDK related errors.
|
|
322
|
-
* @extends Error
|
|
323
|
-
*/
|
|
324
|
-
declare class AISDKError_2 extends Error {
|
|
325
297
|
private readonly [symbol$d];
|
|
326
298
|
/**
|
|
327
299
|
* The underlying cause of the error, if any.
|
|
@@ -345,35 +317,11 @@ declare class AISDKError_2 extends Error {
|
|
|
345
317
|
* @param {unknown} error - The error to check.
|
|
346
318
|
* @returns {boolean} True if the error is an AI SDK Error, false otherwise.
|
|
347
319
|
*/
|
|
348
|
-
static isInstance(error: unknown): error is
|
|
320
|
+
static isInstance(error: unknown): error is AISDKError;
|
|
349
321
|
protected static hasMarker(error: unknown, marker: string): boolean;
|
|
350
322
|
}
|
|
351
323
|
|
|
352
324
|
export declare class APICallError extends AISDKError {
|
|
353
|
-
private readonly [symbol$c_2];
|
|
354
|
-
readonly url: string;
|
|
355
|
-
readonly requestBodyValues: unknown;
|
|
356
|
-
readonly statusCode?: number;
|
|
357
|
-
readonly responseHeaders?: Record<string, string>;
|
|
358
|
-
readonly responseBody?: string;
|
|
359
|
-
readonly isRetryable: boolean;
|
|
360
|
-
readonly data?: unknown;
|
|
361
|
-
constructor({ message, url, requestBodyValues, statusCode, responseHeaders, responseBody, cause, isRetryable, // server error
|
|
362
|
-
data, }: {
|
|
363
|
-
message: string;
|
|
364
|
-
url: string;
|
|
365
|
-
requestBodyValues: unknown;
|
|
366
|
-
statusCode?: number;
|
|
367
|
-
responseHeaders?: Record<string, string>;
|
|
368
|
-
responseBody?: string;
|
|
369
|
-
cause?: unknown;
|
|
370
|
-
isRetryable?: boolean;
|
|
371
|
-
data?: unknown;
|
|
372
|
-
});
|
|
373
|
-
static isInstance(error: unknown): error is APICallError;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
declare class APICallError_2 extends AISDKError_2 {
|
|
377
325
|
private readonly [symbol$c];
|
|
378
326
|
readonly url: string;
|
|
379
327
|
readonly requestBodyValues: unknown;
|
|
@@ -394,7 +342,7 @@ declare class APICallError_2 extends AISDKError_2 {
|
|
|
394
342
|
isRetryable?: boolean;
|
|
395
343
|
data?: unknown;
|
|
396
344
|
});
|
|
397
|
-
static isInstance(error: unknown): error is
|
|
345
|
+
static isInstance(error: unknown): error is APICallError;
|
|
398
346
|
}
|
|
399
347
|
|
|
400
348
|
export declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
|
|
@@ -435,6 +383,8 @@ export declare type AsyncIterableStream<T> = AsyncIterable<T> & ReadableStream<T
|
|
|
435
383
|
* Attributes is a map from string to attribute values.
|
|
436
384
|
*
|
|
437
385
|
* Note: only the own enumerable keys are counted as valid attribute keys.
|
|
386
|
+
*
|
|
387
|
+
* @since 1.3.0
|
|
438
388
|
*/
|
|
439
389
|
declare interface Attributes {
|
|
440
390
|
[attributeKey: string]: AttributeValue | undefined;
|
|
@@ -444,6 +394,8 @@ declare interface Attributes {
|
|
|
444
394
|
* Attribute values may be any non-nullish primitive value except an object.
|
|
445
395
|
*
|
|
446
396
|
* null or undefined attribute values are invalid and will result in undefined behavior.
|
|
397
|
+
*
|
|
398
|
+
* @since 1.3.0
|
|
447
399
|
*/
|
|
448
400
|
declare type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
|
|
449
401
|
|
|
@@ -538,7 +490,7 @@ export declare type CallSettings = {
|
|
|
538
490
|
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
539
491
|
some settings might not be supported, which can lead to suboptimal results.
|
|
540
492
|
*/
|
|
541
|
-
export declare type CallWarning =
|
|
493
|
+
export declare type CallWarning = LanguageModelV2CallWarning;
|
|
542
494
|
|
|
543
495
|
export declare interface ChatInit<UI_MESSAGE extends UIMessage> {
|
|
544
496
|
/**
|
|
@@ -778,6 +730,9 @@ export declare type ContentPart<TOOLS extends ToolSet> = {
|
|
|
778
730
|
providerMetadata?: ProviderMetadata;
|
|
779
731
|
});
|
|
780
732
|
|
|
733
|
+
/**
|
|
734
|
+
* @since 1.0.0
|
|
735
|
+
*/
|
|
781
736
|
declare interface Context {
|
|
782
737
|
/**
|
|
783
738
|
* Get a value from the context.
|
|
@@ -952,7 +907,7 @@ declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage,
|
|
|
952
907
|
errorSchema: FlexibleValidator<T>;
|
|
953
908
|
errorToMessage: (error: T) => string;
|
|
954
909
|
isRetryable?: (response: Response, error?: T) => boolean;
|
|
955
|
-
}) => ResponseHandler<
|
|
910
|
+
}) => ResponseHandler<APICallError>;
|
|
956
911
|
|
|
957
912
|
declare const createJsonResponseHandler: <T>(responseSchema: FlexibleValidator<T>) => ResponseHandler<T>;
|
|
958
913
|
|
|
@@ -983,12 +938,12 @@ declare function createProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT,
|
|
|
983
938
|
* @param options.languageModelMiddleware - Optional middleware to be applied to all language models from the registry. When multiple middlewares are provided, the first middleware will transform the input first, and the last middleware will be wrapped directly around the model.
|
|
984
939
|
* @returns A new ProviderRegistryProvider instance that provides access to all registered providers with optional middleware applied to language models.
|
|
985
940
|
*/
|
|
986
|
-
export declare function createProviderRegistry<PROVIDERS extends Record<string,
|
|
941
|
+
export declare function createProviderRegistry<PROVIDERS extends Record<string, ProviderV2>, SEPARATOR extends string = ':'>(providers: PROVIDERS, { separator, languageModelMiddleware, }?: {
|
|
987
942
|
separator?: SEPARATOR;
|
|
988
943
|
languageModelMiddleware?: LanguageModelMiddleware | LanguageModelMiddleware[];
|
|
989
944
|
}): ProviderRegistryProvider<PROVIDERS, SEPARATOR>;
|
|
990
945
|
|
|
991
|
-
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<
|
|
946
|
+
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
|
|
992
947
|
|
|
993
948
|
export declare function createTextStreamResponse({ status, statusText, headers, textStream, }: ResponseInit & {
|
|
994
949
|
textStream: ReadableStream<string>;
|
|
@@ -1031,19 +986,19 @@ export declare function createUIMessageStreamResponse({ status, statusText, head
|
|
|
1031
986
|
*
|
|
1032
987
|
* @throws {NoSuchModelError} Throws when a requested model is not found and no fallback provider is available.
|
|
1033
988
|
*/
|
|
1034
|
-
export declare function customProvider<LANGUAGE_MODELS extends Record<string,
|
|
989
|
+
export declare function customProvider<LANGUAGE_MODELS extends Record<string, LanguageModelV2>, EMBEDDING_MODELS extends Record<string, EmbeddingModelV2<string>>, IMAGE_MODELS extends Record<string, ImageModelV2>, TRANSCRIPTION_MODELS extends Record<string, TranscriptionModelV2>, SPEECH_MODELS extends Record<string, SpeechModelV2>>({ languageModels, textEmbeddingModels, imageModels, transcriptionModels, speechModels, fallbackProvider, }: {
|
|
1035
990
|
languageModels?: LANGUAGE_MODELS;
|
|
1036
991
|
textEmbeddingModels?: EMBEDDING_MODELS;
|
|
1037
992
|
imageModels?: IMAGE_MODELS;
|
|
1038
993
|
transcriptionModels?: TRANSCRIPTION_MODELS;
|
|
1039
994
|
speechModels?: SPEECH_MODELS;
|
|
1040
|
-
fallbackProvider?:
|
|
1041
|
-
}):
|
|
1042
|
-
languageModel(modelId: ExtractModelId<LANGUAGE_MODELS>):
|
|
1043
|
-
textEmbeddingModel(modelId: ExtractModelId<EMBEDDING_MODELS>):
|
|
1044
|
-
imageModel(modelId: ExtractModelId<IMAGE_MODELS>):
|
|
1045
|
-
transcriptionModel(modelId: ExtractModelId<TRANSCRIPTION_MODELS>):
|
|
1046
|
-
speechModel(modelId: ExtractModelId<SPEECH_MODELS>):
|
|
995
|
+
fallbackProvider?: ProviderV2;
|
|
996
|
+
}): ProviderV2 & {
|
|
997
|
+
languageModel(modelId: ExtractModelId<LANGUAGE_MODELS>): LanguageModelV2;
|
|
998
|
+
textEmbeddingModel(modelId: ExtractModelId<EMBEDDING_MODELS>): EmbeddingModelV2<string>;
|
|
999
|
+
imageModel(modelId: ExtractModelId<IMAGE_MODELS>): ImageModelV2;
|
|
1000
|
+
transcriptionModel(modelId: ExtractModelId<TRANSCRIPTION_MODELS>): TranscriptionModelV2;
|
|
1001
|
+
speechModel(modelId: ExtractModelId<SPEECH_MODELS>): SpeechModelV2;
|
|
1047
1002
|
};
|
|
1048
1003
|
|
|
1049
1004
|
/**
|
|
@@ -1079,6 +1034,19 @@ export declare type DeepPartial<T> = T extends z3.ZodTypeAny ? DeepPartialIntern
|
|
|
1079
1034
|
|
|
1080
1035
|
declare type DeepPartialInternal<T> = T extends null | undefined | string | number | boolean | symbol | bigint | void | Date | RegExp | ((...arguments_: any[]) => unknown) | (new (...arguments_: any[]) => unknown) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMap<KeyType, ValueType> : T extends Set<infer ItemType> ? PartialSet<ItemType> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMap<KeyType, ValueType> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySet<ItemType> : T extends object ? T extends ReadonlyArray<infer ItemType> ? ItemType[] extends T ? readonly ItemType[] extends T ? ReadonlyArray<DeepPartialInternal<ItemType | undefined>> : Array<DeepPartialInternal<ItemType | undefined>> : PartialObject<T> : PartialObject<T> : unknown;
|
|
1081
1036
|
|
|
1037
|
+
/**
|
|
1038
|
+
* Default maximum download size: 2 GiB.
|
|
1039
|
+
*
|
|
1040
|
+
* `fetch().arrayBuffer()` has ~2x peak memory overhead (undici buffers the
|
|
1041
|
+
* body internally, then creates the JS ArrayBuffer), so very large downloads
|
|
1042
|
+
* risk exceeding the default V8 heap limit on 64-bit systems and terminating
|
|
1043
|
+
* the process with an out-of-memory error.
|
|
1044
|
+
*
|
|
1045
|
+
* Setting this limit converts an unrecoverable OOM crash into a catchable
|
|
1046
|
+
* `DownloadError`.
|
|
1047
|
+
*/
|
|
1048
|
+
declare const DEFAULT_MAX_DOWNLOAD_SIZE: number;
|
|
1049
|
+
|
|
1082
1050
|
export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends HttpChatTransport<UI_MESSAGE> {
|
|
1083
1051
|
constructor(options?: HttpChatTransportInitOptions<UI_MESSAGE>);
|
|
1084
1052
|
protected processResponseStream(stream: ReadableStream<Uint8Array<ArrayBufferLike>>): ReadableStream<UIMessageChunk>;
|
|
@@ -1089,19 +1057,19 @@ export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends
|
|
|
1089
1057
|
*/
|
|
1090
1058
|
export declare function defaultSettingsMiddleware({ settings, }: {
|
|
1091
1059
|
settings: Partial<{
|
|
1092
|
-
maxOutputTokens?:
|
|
1093
|
-
temperature?:
|
|
1094
|
-
stopSequences?:
|
|
1095
|
-
topP?:
|
|
1096
|
-
topK?:
|
|
1097
|
-
presencePenalty?:
|
|
1098
|
-
frequencyPenalty?:
|
|
1099
|
-
responseFormat?:
|
|
1100
|
-
seed?:
|
|
1101
|
-
tools?:
|
|
1102
|
-
toolChoice?:
|
|
1103
|
-
headers?:
|
|
1104
|
-
providerOptions?:
|
|
1060
|
+
maxOutputTokens?: LanguageModelV2CallOptions['maxOutputTokens'];
|
|
1061
|
+
temperature?: LanguageModelV2CallOptions['temperature'];
|
|
1062
|
+
stopSequences?: LanguageModelV2CallOptions['stopSequences'];
|
|
1063
|
+
topP?: LanguageModelV2CallOptions['topP'];
|
|
1064
|
+
topK?: LanguageModelV2CallOptions['topK'];
|
|
1065
|
+
presencePenalty?: LanguageModelV2CallOptions['presencePenalty'];
|
|
1066
|
+
frequencyPenalty?: LanguageModelV2CallOptions['frequencyPenalty'];
|
|
1067
|
+
responseFormat?: LanguageModelV2CallOptions['responseFormat'];
|
|
1068
|
+
seed?: LanguageModelV2CallOptions['seed'];
|
|
1069
|
+
tools?: LanguageModelV2CallOptions['tools'];
|
|
1070
|
+
toolChoice?: LanguageModelV2CallOptions['toolChoice'];
|
|
1071
|
+
headers?: LanguageModelV2CallOptions['headers'];
|
|
1072
|
+
providerOptions?: LanguageModelV2CallOptions['providerOptions'];
|
|
1105
1073
|
}>;
|
|
1106
1074
|
}): LanguageModelMiddleware;
|
|
1107
1075
|
|
|
@@ -1149,6 +1117,21 @@ export declare class DownloadError extends AISDKError {
|
|
|
1149
1117
|
static isInstance(error: unknown): error is DownloadError;
|
|
1150
1118
|
}
|
|
1151
1119
|
|
|
1120
|
+
declare class DownloadError_2 extends AISDKError {
|
|
1121
|
+
private readonly [symbol_2];
|
|
1122
|
+
readonly url: string;
|
|
1123
|
+
readonly statusCode?: number;
|
|
1124
|
+
readonly statusText?: string;
|
|
1125
|
+
constructor({ url, statusCode, statusText, cause, message, }: {
|
|
1126
|
+
url: string;
|
|
1127
|
+
statusCode?: number;
|
|
1128
|
+
statusText?: string;
|
|
1129
|
+
message?: string;
|
|
1130
|
+
cause?: unknown;
|
|
1131
|
+
});
|
|
1132
|
+
static isInstance(error: unknown): error is DownloadError_2;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1152
1135
|
/**
|
|
1153
1136
|
Helper function for defining a dynamic tool.
|
|
1154
1137
|
*/
|
|
@@ -1296,12 +1279,12 @@ export declare function embed<VALUE = string>({ model: modelArg, value, provider
|
|
|
1296
1279
|
/**
|
|
1297
1280
|
Embedding.
|
|
1298
1281
|
*/
|
|
1299
|
-
export declare type Embedding =
|
|
1282
|
+
export declare type Embedding = EmbeddingModelV2Embedding;
|
|
1300
1283
|
|
|
1301
1284
|
/**
|
|
1302
1285
|
Embedding model that is used by the AI SDK Core functions.
|
|
1303
1286
|
*/
|
|
1304
|
-
export declare type EmbeddingModel<VALUE = string> = string |
|
|
1287
|
+
export declare type EmbeddingModel<VALUE = string> = string | EmbeddingModelV2<VALUE>;
|
|
1305
1288
|
|
|
1306
1289
|
/**
|
|
1307
1290
|
Represents the number of tokens used in an embedding.
|
|
@@ -1407,112 +1390,12 @@ declare type EmbeddingModelV2<VALUE> = {
|
|
|
1407
1390
|
}>;
|
|
1408
1391
|
};
|
|
1409
1392
|
|
|
1410
|
-
/**
|
|
1411
|
-
Specification for an embedding model that implements the embedding model
|
|
1412
|
-
interface version 1.
|
|
1413
|
-
|
|
1414
|
-
VALUE is the type of the values that the model can embed.
|
|
1415
|
-
This will allow us to go beyond text embeddings in the future,
|
|
1416
|
-
e.g. to support image embeddings
|
|
1417
|
-
*/
|
|
1418
|
-
declare type EmbeddingModelV2_2<VALUE> = {
|
|
1419
|
-
/**
|
|
1420
|
-
The embedding model must specify which embedding model interface
|
|
1421
|
-
version it implements. This will allow us to evolve the embedding
|
|
1422
|
-
model interface and retain backwards compatibility. The different
|
|
1423
|
-
implementation versions can be handled as a discriminated union
|
|
1424
|
-
on our side.
|
|
1425
|
-
*/
|
|
1426
|
-
readonly specificationVersion: 'v2';
|
|
1427
|
-
/**
|
|
1428
|
-
Name of the provider for logging purposes.
|
|
1429
|
-
*/
|
|
1430
|
-
readonly provider: string;
|
|
1431
|
-
/**
|
|
1432
|
-
Provider-specific model ID for logging purposes.
|
|
1433
|
-
*/
|
|
1434
|
-
readonly modelId: string;
|
|
1435
|
-
/**
|
|
1436
|
-
Limit of how many embeddings can be generated in a single API call.
|
|
1437
|
-
|
|
1438
|
-
Use Infinity for models that do not have a limit.
|
|
1439
|
-
*/
|
|
1440
|
-
readonly maxEmbeddingsPerCall: PromiseLike<number | undefined> | number | undefined;
|
|
1441
|
-
/**
|
|
1442
|
-
True if the model can handle multiple embedding calls in parallel.
|
|
1443
|
-
*/
|
|
1444
|
-
readonly supportsParallelCalls: PromiseLike<boolean> | boolean;
|
|
1445
|
-
/**
|
|
1446
|
-
Generates a list of embeddings for the given input text.
|
|
1447
|
-
|
|
1448
|
-
Naming: "do" prefix to prevent accidental direct usage of the method
|
|
1449
|
-
by the user.
|
|
1450
|
-
*/
|
|
1451
|
-
doEmbed(options: {
|
|
1452
|
-
/**
|
|
1453
|
-
List of values to embed.
|
|
1454
|
-
*/
|
|
1455
|
-
values: Array<VALUE>;
|
|
1456
|
-
/**
|
|
1457
|
-
Abort signal for cancelling the operation.
|
|
1458
|
-
*/
|
|
1459
|
-
abortSignal?: AbortSignal;
|
|
1460
|
-
/**
|
|
1461
|
-
Additional provider-specific options. They are passed through
|
|
1462
|
-
to the provider from the AI SDK and enable provider-specific
|
|
1463
|
-
functionality that can be fully encapsulated in the provider.
|
|
1464
|
-
*/
|
|
1465
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
1466
|
-
/**
|
|
1467
|
-
Additional HTTP headers to be sent with the request.
|
|
1468
|
-
Only applicable for HTTP-based providers.
|
|
1469
|
-
*/
|
|
1470
|
-
headers?: Record<string, string | undefined>;
|
|
1471
|
-
}): PromiseLike<{
|
|
1472
|
-
/**
|
|
1473
|
-
Generated embeddings. They are in the same order as the input values.
|
|
1474
|
-
*/
|
|
1475
|
-
embeddings: Array<EmbeddingModelV2Embedding_2>;
|
|
1476
|
-
/**
|
|
1477
|
-
Token usage. We only have input tokens for embeddings.
|
|
1478
|
-
*/
|
|
1479
|
-
usage?: {
|
|
1480
|
-
tokens: number;
|
|
1481
|
-
};
|
|
1482
|
-
/**
|
|
1483
|
-
Additional provider-specific metadata. They are passed through
|
|
1484
|
-
from the provider to the AI SDK and enable provider-specific
|
|
1485
|
-
results that can be fully encapsulated in the provider.
|
|
1486
|
-
*/
|
|
1487
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
1488
|
-
/**
|
|
1489
|
-
Optional response information for debugging purposes.
|
|
1490
|
-
*/
|
|
1491
|
-
response?: {
|
|
1492
|
-
/**
|
|
1493
|
-
Response headers.
|
|
1494
|
-
*/
|
|
1495
|
-
headers?: SharedV2Headers_2;
|
|
1496
|
-
/**
|
|
1497
|
-
The response body.
|
|
1498
|
-
*/
|
|
1499
|
-
body?: unknown;
|
|
1500
|
-
};
|
|
1501
|
-
}>;
|
|
1502
|
-
};
|
|
1503
|
-
|
|
1504
1393
|
/**
|
|
1505
1394
|
An embedding is a vector, i.e. an array of numbers.
|
|
1506
1395
|
It is e.g. used to represent a text as a vector of word embeddings.
|
|
1507
1396
|
*/
|
|
1508
1397
|
declare type EmbeddingModelV2Embedding = Array<number>;
|
|
1509
1398
|
|
|
1510
|
-
/**
|
|
1511
|
-
An embedding is a vector, i.e. an array of numbers.
|
|
1512
|
-
It is e.g. used to represent a text as a vector of word embeddings.
|
|
1513
|
-
*/
|
|
1514
|
-
declare type EmbeddingModelV2Embedding_2 = Array<number>;
|
|
1515
|
-
|
|
1516
1399
|
/**
|
|
1517
1400
|
Embed several values using an embedding model. The type of the value is defined
|
|
1518
1401
|
by the embedding model.
|
|
@@ -1664,16 +1547,16 @@ declare interface EventSourceMessage {
|
|
|
1664
1547
|
* implementation in that browsers will default this to `message`, whereas this parser will
|
|
1665
1548
|
* leave this as `undefined` if not explicitly declared.
|
|
1666
1549
|
*/
|
|
1667
|
-
event?: string | undefined
|
|
1550
|
+
event?: string | undefined;
|
|
1668
1551
|
/**
|
|
1669
1552
|
* ID of the message, if any was provided by the server. Can be used by clients to keep the
|
|
1670
1553
|
* last received message ID in sync when reconnecting.
|
|
1671
1554
|
*/
|
|
1672
|
-
id?: string | undefined
|
|
1555
|
+
id?: string | undefined;
|
|
1673
1556
|
/**
|
|
1674
1557
|
* The data received for this message
|
|
1675
1558
|
*/
|
|
1676
|
-
data: string
|
|
1559
|
+
data: string;
|
|
1677
1560
|
}
|
|
1678
1561
|
|
|
1679
1562
|
/**
|
|
@@ -1697,14 +1580,19 @@ declare interface EventSourceMessage {
|
|
|
1697
1580
|
*
|
|
1698
1581
|
* @public
|
|
1699
1582
|
*/
|
|
1700
|
-
declare class EventSourceParserStream extends TransformStream<
|
|
1701
|
-
|
|
1583
|
+
declare class EventSourceParserStream extends TransformStream<
|
|
1584
|
+
string,
|
|
1585
|
+
EventSourceMessage
|
|
1586
|
+
> {
|
|
1587
|
+
constructor({ onError, onRetry, onComment }?: StreamOptions);
|
|
1702
1588
|
}
|
|
1703
1589
|
|
|
1704
1590
|
/**
|
|
1705
1591
|
* Defines Exception.
|
|
1706
1592
|
*
|
|
1707
1593
|
* string or an object with one of (message or name or code) and optional stack
|
|
1594
|
+
*
|
|
1595
|
+
* @since 1.0.0
|
|
1708
1596
|
*/
|
|
1709
1597
|
declare type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
|
|
1710
1598
|
|
|
@@ -2013,7 +1901,7 @@ export declare function experimental_generateSpeech({ model, text, voice, output
|
|
|
2013
1901
|
/**
|
|
2014
1902
|
The speech model to use.
|
|
2015
1903
|
*/
|
|
2016
|
-
model:
|
|
1904
|
+
model: SpeechModelV2;
|
|
2017
1905
|
/**
|
|
2018
1906
|
The text to convert to speech.
|
|
2019
1907
|
*/
|
|
@@ -2096,14 +1984,14 @@ export declare interface Experimental_SpeechResult {
|
|
|
2096
1984
|
/**
|
|
2097
1985
|
Provider metadata from the provider.
|
|
2098
1986
|
*/
|
|
2099
|
-
readonly providerMetadata: Record<string, Record<string,
|
|
1987
|
+
readonly providerMetadata: Record<string, Record<string, JSONValue_2>>;
|
|
2100
1988
|
}
|
|
2101
1989
|
|
|
2102
1990
|
export declare function experimental_transcribe({ model, audio, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, download: downloadFn, }: {
|
|
2103
1991
|
/**
|
|
2104
1992
|
The transcription model to use.
|
|
2105
1993
|
*/
|
|
2106
|
-
model:
|
|
1994
|
+
model: TranscriptionModelV2;
|
|
2107
1995
|
/**
|
|
2108
1996
|
The audio data to transcribe.
|
|
2109
1997
|
*/
|
|
@@ -2201,10 +2089,10 @@ export declare interface Experimental_TranscriptionResult {
|
|
|
2201
2089
|
/**
|
|
2202
2090
|
Provider metadata from the provider.
|
|
2203
2091
|
*/
|
|
2204
|
-
readonly providerMetadata: Record<string, Record<string,
|
|
2092
|
+
readonly providerMetadata: Record<string, Record<string, JSONValue_2>>;
|
|
2205
2093
|
}
|
|
2206
2094
|
|
|
2207
|
-
export declare type Experimental_Warning =
|
|
2095
|
+
export declare type Experimental_Warning = LanguageModelV2CallWarning | ImageModelV2CallWarning | SpeechModelV2CallWarning | TranscriptionModelV2CallWarning;
|
|
2208
2096
|
|
|
2209
2097
|
declare type ExtractLiteralUnion<T> = T extends string ? string extends T ? never : T : never;
|
|
2210
2098
|
|
|
@@ -2306,7 +2194,7 @@ export declare type FileUIPart = {
|
|
|
2306
2194
|
- `error`: model stopped because of an error
|
|
2307
2195
|
- `other`: model stopped for other reasons
|
|
2308
2196
|
*/
|
|
2309
|
-
export declare type FinishReason =
|
|
2197
|
+
export declare type FinishReason = LanguageModelV2FinishReason;
|
|
2310
2198
|
|
|
2311
2199
|
declare type FlexibleSchema<SCHEMA> = z4.core.$ZodType<SCHEMA, any> | z3.Schema<SCHEMA, z3.ZodTypeDef, any> | Schema<SCHEMA> | LazySchema<SCHEMA>;
|
|
2312
2200
|
|
|
@@ -2321,13 +2209,57 @@ declare interface GatewayCreditsResponse {
|
|
|
2321
2209
|
totalUsed: string;
|
|
2322
2210
|
}
|
|
2323
2211
|
|
|
2324
|
-
declare type GatewayEmbeddingModelId = 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-
|
|
2212
|
+
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 & {});
|
|
2325
2213
|
|
|
2326
2214
|
declare interface GatewayFetchMetadataResponse {
|
|
2327
2215
|
models: GatewayLanguageModelEntry[];
|
|
2328
2216
|
}
|
|
2329
2217
|
|
|
2330
|
-
declare
|
|
2218
|
+
declare interface GatewayGenerationInfo {
|
|
2219
|
+
/** The generation ID */
|
|
2220
|
+
id: string;
|
|
2221
|
+
/** Total cost in USD */
|
|
2222
|
+
totalCost: number;
|
|
2223
|
+
/** Upstream inference cost in USD (BYOK only) */
|
|
2224
|
+
upstreamInferenceCost: number;
|
|
2225
|
+
/** Usage cost in USD (same as totalCost) */
|
|
2226
|
+
usage: number;
|
|
2227
|
+
/** ISO 8601 timestamp when the generation was created */
|
|
2228
|
+
createdAt: string;
|
|
2229
|
+
/** Model identifier */
|
|
2230
|
+
model: string;
|
|
2231
|
+
/** Whether BYOK credentials were used */
|
|
2232
|
+
isByok: boolean;
|
|
2233
|
+
/** Provider that served this generation */
|
|
2234
|
+
providerName: string;
|
|
2235
|
+
/** Whether streaming was used */
|
|
2236
|
+
streamed: boolean;
|
|
2237
|
+
/** Finish reason (e.g. 'stop') */
|
|
2238
|
+
finishReason: string;
|
|
2239
|
+
/** Time to first token in milliseconds */
|
|
2240
|
+
latency: number;
|
|
2241
|
+
/** Total generation time in milliseconds */
|
|
2242
|
+
generationTime: number;
|
|
2243
|
+
/** Number of prompt tokens */
|
|
2244
|
+
promptTokens: number;
|
|
2245
|
+
/** Number of completion tokens */
|
|
2246
|
+
completionTokens: number;
|
|
2247
|
+
/** Reasoning tokens used */
|
|
2248
|
+
reasoningTokens: number;
|
|
2249
|
+
/** Cached tokens used */
|
|
2250
|
+
cachedTokens: number;
|
|
2251
|
+
/** Cache creation input tokens */
|
|
2252
|
+
cacheCreationTokens: number;
|
|
2253
|
+
/** Billable web search calls */
|
|
2254
|
+
billableWebSearchCalls: number;
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
declare interface GatewayGenerationInfoParams {
|
|
2258
|
+
/** The generation ID to look up (format: gen_<ulid>) */
|
|
2259
|
+
id: string;
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
declare type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'prodia/flux-fast-schnell' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'xai/grok-imagine-image' | 'xai/grok-imagine-image-pro' | (string & {});
|
|
2331
2263
|
|
|
2332
2264
|
declare interface GatewayLanguageModelEntry {
|
|
2333
2265
|
/**
|
|
@@ -2373,12 +2305,12 @@ declare interface GatewayLanguageModelEntry {
|
|
|
2373
2305
|
/**
|
|
2374
2306
|
* Optional field to differentiate between model types.
|
|
2375
2307
|
*/
|
|
2376
|
-
modelType?:
|
|
2308
|
+
modelType?: KnownModelType | null;
|
|
2377
2309
|
}
|
|
2378
2310
|
|
|
2379
2311
|
declare type GatewayLanguageModelSpecification = Pick<LanguageModelV2, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
2380
2312
|
|
|
2381
|
-
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'amazon/nova-lite' | 'amazon/nova-
|
|
2313
|
+
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.7-sonnet' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'arcee-ai/trinity-large-preview' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking-2601' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/mixtral-8x22b-instruct' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-0905' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'xai/grok-3' | 'xai/grok-3-fast' | 'xai/grok-3-mini' | 'xai/grok-3-mini-fast' | 'xai/grok-4' | 'xai/grok-4-fast-non-reasoning' | 'xai/grok-4-fast-reasoning' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-code-fast-1' | 'xiaomi/mimo-v2-flash' | 'xiaomi/mimo-v2-pro' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5v-turbo' | (string & {});
|
|
2382
2314
|
|
|
2383
2315
|
declare interface GatewayProvider extends ProviderV2 {
|
|
2384
2316
|
(modelId: GatewayModelId): LanguageModelV2;
|
|
@@ -2394,6 +2326,16 @@ declare interface GatewayProvider extends ProviderV2 {
|
|
|
2394
2326
|
Returns credit information for the authenticated user.
|
|
2395
2327
|
*/
|
|
2396
2328
|
getCredits(): Promise<GatewayCreditsResponse>;
|
|
2329
|
+
/**
|
|
2330
|
+
* Returns a spend report with cost, token, and request count data,
|
|
2331
|
+
* aggregated by the specified dimension.
|
|
2332
|
+
*/
|
|
2333
|
+
getSpendReport(params: GatewaySpendReportParams): Promise<GatewaySpendReportResponse>;
|
|
2334
|
+
/**
|
|
2335
|
+
* Returns detailed information about a specific generation by its ID,
|
|
2336
|
+
* including cost, token usage, latency, and provider details.
|
|
2337
|
+
*/
|
|
2338
|
+
getGenerationInfo(params: GatewayGenerationInfoParams): Promise<GatewayGenerationInfo>;
|
|
2397
2339
|
/**
|
|
2398
2340
|
Creates a model for generating text embeddings.
|
|
2399
2341
|
*/
|
|
@@ -2432,6 +2374,64 @@ declare interface GatewayProviderSettings {
|
|
|
2432
2374
|
metadataCacheRefreshMillis?: number;
|
|
2433
2375
|
}
|
|
2434
2376
|
|
|
2377
|
+
declare interface GatewaySpendReportParams {
|
|
2378
|
+
/** Start date in YYYY-MM-DD format (inclusive) */
|
|
2379
|
+
startDate: string;
|
|
2380
|
+
/** End date in YYYY-MM-DD format (inclusive) */
|
|
2381
|
+
endDate: string;
|
|
2382
|
+
/** Primary aggregation dimension. Defaults to 'day'. */
|
|
2383
|
+
groupBy?: 'day' | 'user' | 'model' | 'tag' | 'provider' | 'credential_type';
|
|
2384
|
+
/** Time granularity when groupBy is 'day'. */
|
|
2385
|
+
datePart?: 'day' | 'hour';
|
|
2386
|
+
/** Filter to a specific user's spend. */
|
|
2387
|
+
userId?: string;
|
|
2388
|
+
/** Filter to a specific model (e.g. 'anthropic/claude-sonnet-4.5'). */
|
|
2389
|
+
model?: string;
|
|
2390
|
+
/** Filter to a specific provider (e.g. 'anthropic'). */
|
|
2391
|
+
provider?: string;
|
|
2392
|
+
/** Filter to BYOK or system credentials. */
|
|
2393
|
+
credentialType?: 'byok' | 'system';
|
|
2394
|
+
/** Filter to requests with these tags. */
|
|
2395
|
+
tags?: string[];
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2398
|
+
declare interface GatewaySpendReportResponse {
|
|
2399
|
+
results: GatewaySpendReportRow[];
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
declare interface GatewaySpendReportRow {
|
|
2403
|
+
/** Date string (present when groupBy is 'day') */
|
|
2404
|
+
day?: string;
|
|
2405
|
+
/** Hour timestamp (present when groupBy is 'day' and datePart is 'hour') */
|
|
2406
|
+
hour?: string;
|
|
2407
|
+
/** User identifier (present when groupBy is 'user') */
|
|
2408
|
+
user?: string;
|
|
2409
|
+
/** Model identifier (present when groupBy is 'model') */
|
|
2410
|
+
model?: string;
|
|
2411
|
+
/** Tag value (present when groupBy is 'tag') */
|
|
2412
|
+
tag?: string;
|
|
2413
|
+
/** Provider name (present when groupBy is 'provider') */
|
|
2414
|
+
provider?: string;
|
|
2415
|
+
/** Credential type (present when groupBy is 'credential_type') */
|
|
2416
|
+
credentialType?: 'byok' | 'system';
|
|
2417
|
+
/** Total cost in USD */
|
|
2418
|
+
totalCost: number;
|
|
2419
|
+
/** Market cost in USD */
|
|
2420
|
+
marketCost?: number;
|
|
2421
|
+
/** Number of input tokens */
|
|
2422
|
+
inputTokens?: number;
|
|
2423
|
+
/** Number of output tokens */
|
|
2424
|
+
outputTokens?: number;
|
|
2425
|
+
/** Number of cached input tokens */
|
|
2426
|
+
cachedInputTokens?: number;
|
|
2427
|
+
/** Number of cache creation input tokens */
|
|
2428
|
+
cacheCreationInputTokens?: number;
|
|
2429
|
+
/** Number of reasoning tokens */
|
|
2430
|
+
reasoningTokens?: number;
|
|
2431
|
+
/** Number of requests */
|
|
2432
|
+
requestCount?: number;
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
2435
|
/**
|
|
2436
2436
|
* Gateway-specific provider-defined tools.
|
|
2437
2437
|
*/
|
|
@@ -2557,7 +2557,7 @@ export declare const generateId: IdGenerator;
|
|
|
2557
2557
|
@returns
|
|
2558
2558
|
A result object that contains the generated object, the finish reason, the token usage, and additional information.
|
|
2559
2559
|
*/
|
|
2560
|
-
export declare function generateObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<
|
|
2560
|
+
export declare function generateObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue_2>, OUTPUT extends 'object' | 'array' | 'enum' | 'no-schema' = InferSchema<SCHEMA> extends string ? 'enum' : 'object', RESULT = OUTPUT extends 'array' ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>>(options: Omit<CallSettings, 'stopSequences'> & Prompt & (OUTPUT extends 'enum' ? {
|
|
2561
2561
|
/**
|
|
2562
2562
|
The enum values that the model should use.
|
|
2563
2563
|
*/
|
|
@@ -2713,7 +2713,7 @@ export declare interface GenerateObjectResult<OBJECT> {
|
|
|
2713
2713
|
@returns
|
|
2714
2714
|
A result object that contains the generated text, the results of the tool calls, and additional information.
|
|
2715
2715
|
*/
|
|
2716
|
-
export declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, _internal: { generateId, currentDate, }, onStepFinish, ...settings }: CallSettings & Prompt & {
|
|
2716
|
+
export declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model: modelArg, tools, toolChoice, system, prompt, messages, allowSystemInMessages, maxRetries: maxRetriesArg, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, _internal: { generateId, currentDate, }, onStepFinish, ...settings }: CallSettings & Prompt & {
|
|
2717
2717
|
/**
|
|
2718
2718
|
The language model to use.
|
|
2719
2719
|
*/
|
|
@@ -2935,10 +2935,6 @@ declare type GetMaxImagesPerCallFunction = (options: {
|
|
|
2935
2935
|
modelId: string;
|
|
2936
2936
|
}) => PromiseLike<number | undefined> | number | undefined;
|
|
2937
2937
|
|
|
2938
|
-
declare type GetMaxImagesPerCallFunction_2 = (options: {
|
|
2939
|
-
modelId: string;
|
|
2940
|
-
}) => PromiseLike<number | undefined> | number | undefined;
|
|
2941
|
-
|
|
2942
2938
|
declare const getOriginalFetch: () => typeof fetch;
|
|
2943
2939
|
|
|
2944
2940
|
declare function getRuntimeEnvironmentUserAgent(globalThisAny?: any): string;
|
|
@@ -2973,6 +2969,8 @@ export declare function hasToolCall(toolName: string): StopCondition<any>;
|
|
|
2973
2969
|
* The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
|
|
2974
2970
|
* HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
|
|
2975
2971
|
* This is represented in HrTime format as [1609504210, 150000000].
|
|
2972
|
+
*
|
|
2973
|
+
* @since 1.0.0
|
|
2976
2974
|
*/
|
|
2977
2975
|
declare type HrTime = [number, number];
|
|
2978
2976
|
|
|
@@ -3059,18 +3057,18 @@ export declare type IdGenerator = () => string;
|
|
|
3059
3057
|
/**
|
|
3060
3058
|
Image model that is used by the AI SDK Core functions.
|
|
3061
3059
|
*/
|
|
3062
|
-
export declare type ImageModel = string |
|
|
3060
|
+
export declare type ImageModel = string | ImageModelV2;
|
|
3063
3061
|
|
|
3064
3062
|
/**
|
|
3065
3063
|
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
3066
3064
|
some settings might not be supported, which can lead to suboptimal results.
|
|
3067
3065
|
*/
|
|
3068
|
-
export declare type ImageModelCallWarning =
|
|
3066
|
+
export declare type ImageModelCallWarning = ImageModelV2CallWarning;
|
|
3069
3067
|
|
|
3070
3068
|
/**
|
|
3071
3069
|
Metadata from the model provider for this call
|
|
3072
3070
|
*/
|
|
3073
|
-
export declare type ImageModelProviderMetadata =
|
|
3071
|
+
export declare type ImageModelProviderMetadata = ImageModelV2ProviderMetadata;
|
|
3074
3072
|
|
|
3075
3073
|
export declare type ImageModelResponseMetadata = {
|
|
3076
3074
|
/**
|
|
@@ -3168,116 +3166,35 @@ declare type ImageModelV2 = {
|
|
|
3168
3166
|
}>;
|
|
3169
3167
|
};
|
|
3170
3168
|
|
|
3171
|
-
|
|
3172
|
-
Image generation model specification version 2.
|
|
3173
|
-
*/
|
|
3174
|
-
declare type ImageModelV2_2 = {
|
|
3169
|
+
declare type ImageModelV2CallOptions = {
|
|
3175
3170
|
/**
|
|
3176
|
-
|
|
3177
|
-
version it implements. This will allow us to evolve the image
|
|
3178
|
-
model interface and retain backwards compatibility. The different
|
|
3179
|
-
implementation versions can be handled as a discriminated union
|
|
3180
|
-
on our side.
|
|
3171
|
+
Prompt for the image generation.
|
|
3181
3172
|
*/
|
|
3182
|
-
|
|
3173
|
+
prompt: string;
|
|
3183
3174
|
/**
|
|
3184
|
-
|
|
3175
|
+
Number of images to generate.
|
|
3185
3176
|
*/
|
|
3186
|
-
|
|
3177
|
+
n: number;
|
|
3187
3178
|
/**
|
|
3188
|
-
|
|
3179
|
+
Size of the images to generate.
|
|
3180
|
+
Must have the format `{width}x{height}`.
|
|
3181
|
+
`undefined` will use the provider's default size.
|
|
3189
3182
|
*/
|
|
3190
|
-
|
|
3183
|
+
size: `${number}x${number}` | undefined;
|
|
3191
3184
|
/**
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
optionally as a promise.
|
|
3185
|
+
Aspect ratio of the images to generate.
|
|
3186
|
+
Must have the format `{width}:{height}`.
|
|
3187
|
+
`undefined` will use the provider's default aspect ratio.
|
|
3196
3188
|
*/
|
|
3197
|
-
|
|
3189
|
+
aspectRatio: `${number}:${number}` | undefined;
|
|
3198
3190
|
/**
|
|
3199
|
-
|
|
3191
|
+
Seed for the image generation.
|
|
3192
|
+
`undefined` will use the provider's default seed.
|
|
3200
3193
|
*/
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
If the API returns base64 encoded strings, the images should be returned
|
|
3206
|
-
as base64 encoded strings. If the API returns binary data, the images should
|
|
3207
|
-
be returned as binary data.
|
|
3208
|
-
*/
|
|
3209
|
-
images: Array<string> | Array<Uint8Array>;
|
|
3210
|
-
/**
|
|
3211
|
-
Warnings for the call, e.g. unsupported settings.
|
|
3212
|
-
*/
|
|
3213
|
-
warnings: Array<ImageModelV2CallWarning_2>;
|
|
3214
|
-
/**
|
|
3215
|
-
Additional provider-specific metadata. They are passed through
|
|
3216
|
-
from the provider to the AI SDK and enable provider-specific
|
|
3217
|
-
results that can be fully encapsulated in the provider.
|
|
3218
|
-
|
|
3219
|
-
The outer record is keyed by the provider name, and the inner
|
|
3220
|
-
record is provider-specific metadata. It always includes an
|
|
3221
|
-
`images` key with image-specific metadata
|
|
3222
|
-
|
|
3223
|
-
```ts
|
|
3224
|
-
{
|
|
3225
|
-
"openai": {
|
|
3226
|
-
"images": ["revisedPrompt": "Revised prompt here."]
|
|
3227
|
-
}
|
|
3228
|
-
}
|
|
3229
|
-
```
|
|
3230
|
-
*/
|
|
3231
|
-
providerMetadata?: ImageModelV2ProviderMetadata_2;
|
|
3232
|
-
/**
|
|
3233
|
-
Response information for telemetry and debugging purposes.
|
|
3234
|
-
*/
|
|
3235
|
-
response: {
|
|
3236
|
-
/**
|
|
3237
|
-
Timestamp for the start of the generated response.
|
|
3238
|
-
*/
|
|
3239
|
-
timestamp: Date;
|
|
3240
|
-
/**
|
|
3241
|
-
The ID of the response model that was used to generate the response.
|
|
3242
|
-
*/
|
|
3243
|
-
modelId: string;
|
|
3244
|
-
/**
|
|
3245
|
-
Response headers.
|
|
3246
|
-
*/
|
|
3247
|
-
headers: Record<string, string> | undefined;
|
|
3248
|
-
};
|
|
3249
|
-
}>;
|
|
3250
|
-
};
|
|
3251
|
-
|
|
3252
|
-
declare type ImageModelV2CallOptions = {
|
|
3253
|
-
/**
|
|
3254
|
-
Prompt for the image generation.
|
|
3255
|
-
*/
|
|
3256
|
-
prompt: string;
|
|
3257
|
-
/**
|
|
3258
|
-
Number of images to generate.
|
|
3259
|
-
*/
|
|
3260
|
-
n: number;
|
|
3261
|
-
/**
|
|
3262
|
-
Size of the images to generate.
|
|
3263
|
-
Must have the format `{width}x{height}`.
|
|
3264
|
-
`undefined` will use the provider's default size.
|
|
3265
|
-
*/
|
|
3266
|
-
size: `${number}x${number}` | undefined;
|
|
3267
|
-
/**
|
|
3268
|
-
Aspect ratio of the images to generate.
|
|
3269
|
-
Must have the format `{width}:{height}`.
|
|
3270
|
-
`undefined` will use the provider's default aspect ratio.
|
|
3271
|
-
*/
|
|
3272
|
-
aspectRatio: `${number}:${number}` | undefined;
|
|
3273
|
-
/**
|
|
3274
|
-
Seed for the image generation.
|
|
3275
|
-
`undefined` will use the provider's default seed.
|
|
3276
|
-
*/
|
|
3277
|
-
seed: number | undefined;
|
|
3278
|
-
/**
|
|
3279
|
-
Additional provider-specific options that are passed through to the provider
|
|
3280
|
-
as body parameters.
|
|
3194
|
+
seed: number | undefined;
|
|
3195
|
+
/**
|
|
3196
|
+
Additional provider-specific options that are passed through to the provider
|
|
3197
|
+
as body parameters.
|
|
3281
3198
|
|
|
3282
3199
|
The outer record is keyed by the provider name, and the inner
|
|
3283
3200
|
record is keyed by the provider-specific metadata key.
|
|
@@ -3301,58 +3218,6 @@ declare type ImageModelV2CallOptions = {
|
|
|
3301
3218
|
headers?: Record<string, string | undefined>;
|
|
3302
3219
|
};
|
|
3303
3220
|
|
|
3304
|
-
declare type ImageModelV2CallOptions_2 = {
|
|
3305
|
-
/**
|
|
3306
|
-
Prompt for the image generation.
|
|
3307
|
-
*/
|
|
3308
|
-
prompt: string;
|
|
3309
|
-
/**
|
|
3310
|
-
Number of images to generate.
|
|
3311
|
-
*/
|
|
3312
|
-
n: number;
|
|
3313
|
-
/**
|
|
3314
|
-
Size of the images to generate.
|
|
3315
|
-
Must have the format `{width}x{height}`.
|
|
3316
|
-
`undefined` will use the provider's default size.
|
|
3317
|
-
*/
|
|
3318
|
-
size: `${number}x${number}` | undefined;
|
|
3319
|
-
/**
|
|
3320
|
-
Aspect ratio of the images to generate.
|
|
3321
|
-
Must have the format `{width}:{height}`.
|
|
3322
|
-
`undefined` will use the provider's default aspect ratio.
|
|
3323
|
-
*/
|
|
3324
|
-
aspectRatio: `${number}:${number}` | undefined;
|
|
3325
|
-
/**
|
|
3326
|
-
Seed for the image generation.
|
|
3327
|
-
`undefined` will use the provider's default seed.
|
|
3328
|
-
*/
|
|
3329
|
-
seed: number | undefined;
|
|
3330
|
-
/**
|
|
3331
|
-
Additional provider-specific options that are passed through to the provider
|
|
3332
|
-
as body parameters.
|
|
3333
|
-
|
|
3334
|
-
The outer record is keyed by the provider name, and the inner
|
|
3335
|
-
record is keyed by the provider-specific metadata key.
|
|
3336
|
-
```ts
|
|
3337
|
-
{
|
|
3338
|
-
"openai": {
|
|
3339
|
-
"style": "vivid"
|
|
3340
|
-
}
|
|
3341
|
-
}
|
|
3342
|
-
```
|
|
3343
|
-
*/
|
|
3344
|
-
providerOptions: SharedV2ProviderOptions_2;
|
|
3345
|
-
/**
|
|
3346
|
-
Abort signal for cancelling the operation.
|
|
3347
|
-
*/
|
|
3348
|
-
abortSignal?: AbortSignal;
|
|
3349
|
-
/**
|
|
3350
|
-
Additional HTTP headers to be sent with the request.
|
|
3351
|
-
Only applicable for HTTP-based providers.
|
|
3352
|
-
*/
|
|
3353
|
-
headers?: Record<string, string | undefined>;
|
|
3354
|
-
};
|
|
3355
|
-
|
|
3356
3221
|
/**
|
|
3357
3222
|
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
3358
3223
|
some settings might not be supported, which can lead to suboptimal results.
|
|
@@ -3366,27 +3231,10 @@ declare type ImageModelV2CallWarning = {
|
|
|
3366
3231
|
message: string;
|
|
3367
3232
|
};
|
|
3368
3233
|
|
|
3369
|
-
/**
|
|
3370
|
-
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
3371
|
-
some settings might not be supported, which can lead to suboptimal results.
|
|
3372
|
-
*/
|
|
3373
|
-
declare type ImageModelV2CallWarning_2 = {
|
|
3374
|
-
type: 'unsupported-setting';
|
|
3375
|
-
setting: keyof ImageModelV2CallOptions_2;
|
|
3376
|
-
details?: string;
|
|
3377
|
-
} | {
|
|
3378
|
-
type: 'other';
|
|
3379
|
-
message: string;
|
|
3380
|
-
};
|
|
3381
|
-
|
|
3382
3234
|
declare type ImageModelV2ProviderMetadata = Record<string, {
|
|
3383
3235
|
images: JSONArray;
|
|
3384
3236
|
} & JSONValue_2>;
|
|
3385
3237
|
|
|
3386
|
-
declare type ImageModelV2ProviderMetadata_2 = Record<string, {
|
|
3387
|
-
images: JSONArray_2;
|
|
3388
|
-
} & JSONValue_3>;
|
|
3389
|
-
|
|
3390
3238
|
/**
|
|
3391
3239
|
Image content part of a prompt. It contains an image.
|
|
3392
3240
|
*/
|
|
@@ -3474,7 +3322,7 @@ declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPre
|
|
|
3474
3322
|
}): LanguageModelV2Prompt;
|
|
3475
3323
|
|
|
3476
3324
|
export declare class InvalidArgumentError extends AISDKError {
|
|
3477
|
-
private readonly [symbol$
|
|
3325
|
+
private readonly [symbol$c_2];
|
|
3478
3326
|
readonly parameter: string;
|
|
3479
3327
|
readonly value: unknown;
|
|
3480
3328
|
constructor({ parameter, value, message, }: {
|
|
@@ -3593,11 +3441,11 @@ export declare function isDeepEqualData(obj1: any, obj2: any): boolean;
|
|
|
3593
3441
|
*/
|
|
3594
3442
|
export declare function isFileUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is FileUIPart;
|
|
3595
3443
|
|
|
3596
|
-
declare function isJSONArray(value: unknown): value is
|
|
3444
|
+
declare function isJSONArray(value: unknown): value is JSONArray;
|
|
3597
3445
|
|
|
3598
|
-
declare function isJSONObject(value: unknown): value is
|
|
3446
|
+
declare function isJSONObject(value: unknown): value is JSONObject;
|
|
3599
3447
|
|
|
3600
|
-
declare function isJSONValue(value: unknown): value is
|
|
3448
|
+
declare function isJSONValue(value: unknown): value is JSONValue_2;
|
|
3601
3449
|
|
|
3602
3450
|
declare function isParsableJson(input: string): boolean;
|
|
3603
3451
|
|
|
@@ -3638,34 +3486,18 @@ declare type Job = () => Promise<void>;
|
|
|
3638
3486
|
|
|
3639
3487
|
declare type JSONArray = JSONValue_2[];
|
|
3640
3488
|
|
|
3641
|
-
declare type JSONArray_2 = JSONValue_3[];
|
|
3642
|
-
|
|
3643
3489
|
declare type JSONObject = {
|
|
3644
3490
|
[key: string]: JSONValue_2;
|
|
3645
3491
|
};
|
|
3646
3492
|
|
|
3647
|
-
declare type JSONObject_2 = {
|
|
3648
|
-
[key: string]: JSONValue_3;
|
|
3649
|
-
};
|
|
3650
|
-
|
|
3651
3493
|
export declare class JSONParseError extends AISDKError {
|
|
3652
|
-
private readonly [symbol$7_2];
|
|
3653
|
-
readonly text: string;
|
|
3654
|
-
constructor({ text, cause }: {
|
|
3655
|
-
text: string;
|
|
3656
|
-
cause: unknown;
|
|
3657
|
-
});
|
|
3658
|
-
static isInstance(error: unknown): error is JSONParseError;
|
|
3659
|
-
}
|
|
3660
|
-
|
|
3661
|
-
declare class JSONParseError_2 extends AISDKError_2 {
|
|
3662
3494
|
private readonly [symbol$7];
|
|
3663
3495
|
readonly text: string;
|
|
3664
3496
|
constructor({ text, cause }: {
|
|
3665
3497
|
text: string;
|
|
3666
3498
|
cause: unknown;
|
|
3667
3499
|
});
|
|
3668
|
-
static isInstance(error: unknown): error is
|
|
3500
|
+
static isInstance(error: unknown): error is JSONParseError;
|
|
3669
3501
|
}
|
|
3670
3502
|
|
|
3671
3503
|
/**
|
|
@@ -3841,7 +3673,7 @@ export declare class JsonToSseTransformStream extends TransformStream<unknown, s
|
|
|
3841
3673
|
constructor();
|
|
3842
3674
|
}
|
|
3843
3675
|
|
|
3844
|
-
export declare type JSONValue =
|
|
3676
|
+
export declare type JSONValue = JSONValue_2;
|
|
3845
3677
|
|
|
3846
3678
|
/**
|
|
3847
3679
|
A JSON value can be a string, number, boolean, object, array, or null.
|
|
@@ -3849,16 +3681,14 @@ export declare type JSONValue = JSONValue_3;
|
|
|
3849
3681
|
*/
|
|
3850
3682
|
declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
|
|
3851
3683
|
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
*/
|
|
3856
|
-
declare type JSONValue_3 = null | string | number | boolean | JSONObject_2 | JSONArray_2;
|
|
3684
|
+
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language"];
|
|
3685
|
+
|
|
3686
|
+
declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
|
|
3857
3687
|
|
|
3858
3688
|
/**
|
|
3859
3689
|
Language model that is used by the AI SDK Core functions.
|
|
3860
3690
|
*/
|
|
3861
|
-
export declare type LanguageModel = GlobalProviderModelId |
|
|
3691
|
+
export declare type LanguageModel = GlobalProviderModelId | LanguageModelV2;
|
|
3862
3692
|
|
|
3863
3693
|
export declare type LanguageModelMiddleware = LanguageModelV2Middleware;
|
|
3864
3694
|
|
|
@@ -3891,7 +3721,7 @@ export declare type LanguageModelResponseMetadata = {
|
|
|
3891
3721
|
/**
|
|
3892
3722
|
Represents the number of tokens used in a prompt and completion.
|
|
3893
3723
|
*/
|
|
3894
|
-
export declare type LanguageModelUsage =
|
|
3724
|
+
export declare type LanguageModelUsage = LanguageModelV2Usage;
|
|
3895
3725
|
|
|
3896
3726
|
/**
|
|
3897
3727
|
Specification for a language model that implements the language model interface version 2.
|
|
@@ -4005,118 +3835,6 @@ declare type LanguageModelV2 = {
|
|
|
4005
3835
|
}>;
|
|
4006
3836
|
};
|
|
4007
3837
|
|
|
4008
|
-
/**
|
|
4009
|
-
Specification for a language model that implements the language model interface version 2.
|
|
4010
|
-
*/
|
|
4011
|
-
declare type LanguageModelV2_2 = {
|
|
4012
|
-
/**
|
|
4013
|
-
The language model must specify which language model interface version it implements.
|
|
4014
|
-
*/
|
|
4015
|
-
readonly specificationVersion: 'v2';
|
|
4016
|
-
/**
|
|
4017
|
-
Name of the provider for logging purposes.
|
|
4018
|
-
*/
|
|
4019
|
-
readonly provider: string;
|
|
4020
|
-
/**
|
|
4021
|
-
Provider-specific model ID for logging purposes.
|
|
4022
|
-
*/
|
|
4023
|
-
readonly modelId: string;
|
|
4024
|
-
/**
|
|
4025
|
-
Supported URL patterns by media type for the provider.
|
|
4026
|
-
|
|
4027
|
-
The keys are media type patterns or full media types (e.g. `*\/*` for everything, `audio/*`, `video/*`, or `application/pdf`).
|
|
4028
|
-
and the values are arrays of regular expressions that match the URL paths.
|
|
4029
|
-
|
|
4030
|
-
The matching should be against lower-case URLs.
|
|
4031
|
-
|
|
4032
|
-
Matched URLs are supported natively by the model and are not downloaded.
|
|
4033
|
-
|
|
4034
|
-
@returns A map of supported URL patterns by media type (as a promise or a plain object).
|
|
4035
|
-
*/
|
|
4036
|
-
supportedUrls: PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>;
|
|
4037
|
-
/**
|
|
4038
|
-
Generates a language model output (non-streaming).
|
|
4039
|
-
|
|
4040
|
-
Naming: "do" prefix to prevent accidental direct usage of the method
|
|
4041
|
-
by the user.
|
|
4042
|
-
*/
|
|
4043
|
-
doGenerate(options: LanguageModelV2CallOptions_2): PromiseLike<{
|
|
4044
|
-
/**
|
|
4045
|
-
Ordered content that the model has generated.
|
|
4046
|
-
*/
|
|
4047
|
-
content: Array<LanguageModelV2Content_2>;
|
|
4048
|
-
/**
|
|
4049
|
-
Finish reason.
|
|
4050
|
-
*/
|
|
4051
|
-
finishReason: LanguageModelV2FinishReason_2;
|
|
4052
|
-
/**
|
|
4053
|
-
Usage information.
|
|
4054
|
-
*/
|
|
4055
|
-
usage: LanguageModelV2Usage_2;
|
|
4056
|
-
/**
|
|
4057
|
-
Additional provider-specific metadata. They are passed through
|
|
4058
|
-
from the provider to the AI SDK and enable provider-specific
|
|
4059
|
-
results that can be fully encapsulated in the provider.
|
|
4060
|
-
*/
|
|
4061
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4062
|
-
/**
|
|
4063
|
-
Optional request information for telemetry and debugging purposes.
|
|
4064
|
-
*/
|
|
4065
|
-
request?: {
|
|
4066
|
-
/**
|
|
4067
|
-
Request HTTP body that was sent to the provider API.
|
|
4068
|
-
*/
|
|
4069
|
-
body?: unknown;
|
|
4070
|
-
};
|
|
4071
|
-
/**
|
|
4072
|
-
Optional response information for telemetry and debugging purposes.
|
|
4073
|
-
*/
|
|
4074
|
-
response?: LanguageModelV2ResponseMetadata_2 & {
|
|
4075
|
-
/**
|
|
4076
|
-
Response headers.
|
|
4077
|
-
*/
|
|
4078
|
-
headers?: SharedV2Headers_2;
|
|
4079
|
-
/**
|
|
4080
|
-
Response HTTP body.
|
|
4081
|
-
*/
|
|
4082
|
-
body?: unknown;
|
|
4083
|
-
};
|
|
4084
|
-
/**
|
|
4085
|
-
Warnings for the call, e.g. unsupported settings.
|
|
4086
|
-
*/
|
|
4087
|
-
warnings: Array<LanguageModelV2CallWarning_2>;
|
|
4088
|
-
}>;
|
|
4089
|
-
/**
|
|
4090
|
-
Generates a language model output (streaming).
|
|
4091
|
-
|
|
4092
|
-
Naming: "do" prefix to prevent accidental direct usage of the method
|
|
4093
|
-
by the user.
|
|
4094
|
-
*
|
|
4095
|
-
@return A stream of higher-level language model output parts.
|
|
4096
|
-
*/
|
|
4097
|
-
doStream(options: LanguageModelV2CallOptions_2): PromiseLike<{
|
|
4098
|
-
stream: ReadableStream<LanguageModelV2StreamPart_2>;
|
|
4099
|
-
/**
|
|
4100
|
-
Optional request information for telemetry and debugging purposes.
|
|
4101
|
-
*/
|
|
4102
|
-
request?: {
|
|
4103
|
-
/**
|
|
4104
|
-
Request HTTP body that was sent to the provider API.
|
|
4105
|
-
*/
|
|
4106
|
-
body?: unknown;
|
|
4107
|
-
};
|
|
4108
|
-
/**
|
|
4109
|
-
Optional response data.
|
|
4110
|
-
*/
|
|
4111
|
-
response?: {
|
|
4112
|
-
/**
|
|
4113
|
-
Response headers.
|
|
4114
|
-
*/
|
|
4115
|
-
headers?: SharedV2Headers_2;
|
|
4116
|
-
};
|
|
4117
|
-
}>;
|
|
4118
|
-
};
|
|
4119
|
-
|
|
4120
3838
|
declare type LanguageModelV2CallOptions = {
|
|
4121
3839
|
/**
|
|
4122
3840
|
A language mode prompt is a standardized prompt type.
|
|
@@ -4218,155 +3936,30 @@ declare type LanguageModelV2CallOptions = {
|
|
|
4218
3936
|
providerOptions?: SharedV2ProviderOptions;
|
|
4219
3937
|
};
|
|
4220
3938
|
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
*/
|
|
4238
|
-
temperature?: number;
|
|
4239
|
-
/**
|
|
4240
|
-
Stop sequences.
|
|
4241
|
-
If set, the model will stop generating text when one of the stop sequences is generated.
|
|
4242
|
-
Providers may have limits on the number of stop sequences.
|
|
4243
|
-
*/
|
|
4244
|
-
stopSequences?: string[];
|
|
4245
|
-
/**
|
|
4246
|
-
Nucleus sampling.
|
|
4247
|
-
*/
|
|
4248
|
-
topP?: number;
|
|
4249
|
-
/**
|
|
4250
|
-
Only sample from the top K options for each subsequent token.
|
|
4251
|
-
|
|
4252
|
-
Used to remove "long tail" low probability responses.
|
|
4253
|
-
Recommended for advanced use cases only. You usually only need to use temperature.
|
|
4254
|
-
*/
|
|
4255
|
-
topK?: number;
|
|
4256
|
-
/**
|
|
4257
|
-
Presence penalty setting. It affects the likelihood of the model to
|
|
4258
|
-
repeat information that is already in the prompt.
|
|
4259
|
-
*/
|
|
4260
|
-
presencePenalty?: number;
|
|
4261
|
-
/**
|
|
4262
|
-
Frequency penalty setting. It affects the likelihood of the model
|
|
4263
|
-
to repeatedly use the same words or phrases.
|
|
4264
|
-
*/
|
|
4265
|
-
frequencyPenalty?: number;
|
|
4266
|
-
/**
|
|
4267
|
-
Response format. The output can either be text or JSON. Default is text.
|
|
4268
|
-
|
|
4269
|
-
If JSON is selected, a schema can optionally be provided to guide the LLM.
|
|
4270
|
-
*/
|
|
4271
|
-
responseFormat?: {
|
|
4272
|
-
type: 'text';
|
|
4273
|
-
} | {
|
|
4274
|
-
type: 'json';
|
|
4275
|
-
/**
|
|
4276
|
-
* JSON schema that the generated output should conform to.
|
|
4277
|
-
*/
|
|
4278
|
-
schema?: JSONSchema7;
|
|
4279
|
-
/**
|
|
4280
|
-
* Name of output that should be generated. Used by some providers for additional LLM guidance.
|
|
4281
|
-
*/
|
|
4282
|
-
name?: string;
|
|
4283
|
-
/**
|
|
4284
|
-
* Description of the output that should be generated. Used by some providers for additional LLM guidance.
|
|
4285
|
-
*/
|
|
4286
|
-
description?: string;
|
|
4287
|
-
};
|
|
4288
|
-
/**
|
|
4289
|
-
The seed (integer) to use for random sampling. If set and supported
|
|
4290
|
-
by the model, calls will generate deterministic results.
|
|
4291
|
-
*/
|
|
4292
|
-
seed?: number;
|
|
4293
|
-
/**
|
|
4294
|
-
The tools that are available for the model.
|
|
4295
|
-
*/
|
|
4296
|
-
tools?: Array<LanguageModelV2FunctionTool_2 | LanguageModelV2ProviderDefinedTool_2>;
|
|
4297
|
-
/**
|
|
4298
|
-
Specifies how the tool should be selected. Defaults to 'auto'.
|
|
4299
|
-
*/
|
|
4300
|
-
toolChoice?: LanguageModelV2ToolChoice_2;
|
|
4301
|
-
/**
|
|
4302
|
-
Include raw chunks in the stream. Only applicable for streaming calls.
|
|
4303
|
-
*/
|
|
4304
|
-
includeRawChunks?: boolean;
|
|
4305
|
-
/**
|
|
4306
|
-
Abort signal for cancelling the operation.
|
|
4307
|
-
*/
|
|
4308
|
-
abortSignal?: AbortSignal;
|
|
4309
|
-
/**
|
|
4310
|
-
Additional HTTP headers to be sent with the request.
|
|
4311
|
-
Only applicable for HTTP-based providers.
|
|
4312
|
-
*/
|
|
4313
|
-
headers?: Record<string, string | undefined>;
|
|
4314
|
-
/**
|
|
4315
|
-
* Additional provider-specific options. They are passed through
|
|
4316
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
4317
|
-
* functionality that can be fully encapsulated in the provider.
|
|
4318
|
-
*/
|
|
4319
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
4320
|
-
};
|
|
4321
|
-
|
|
4322
|
-
/**
|
|
4323
|
-
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
4324
|
-
some settings might not be supported, which can lead to suboptimal results.
|
|
4325
|
-
*/
|
|
4326
|
-
declare type LanguageModelV2CallWarning = {
|
|
4327
|
-
type: 'unsupported-setting';
|
|
4328
|
-
setting: Omit<keyof LanguageModelV2CallOptions, 'prompt'>;
|
|
4329
|
-
details?: string;
|
|
4330
|
-
} | {
|
|
4331
|
-
type: 'unsupported-tool';
|
|
4332
|
-
tool: LanguageModelV2FunctionTool | LanguageModelV2ProviderDefinedTool;
|
|
4333
|
-
details?: string;
|
|
4334
|
-
} | {
|
|
4335
|
-
type: 'other';
|
|
4336
|
-
message: string;
|
|
4337
|
-
};
|
|
4338
|
-
|
|
4339
|
-
/**
|
|
4340
|
-
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
4341
|
-
some settings might not be supported, which can lead to suboptimal results.
|
|
4342
|
-
*/
|
|
4343
|
-
declare type LanguageModelV2CallWarning_2 = {
|
|
4344
|
-
type: 'unsupported-setting';
|
|
4345
|
-
setting: Omit<keyof LanguageModelV2CallOptions_2, 'prompt'>;
|
|
4346
|
-
details?: string;
|
|
4347
|
-
} | {
|
|
4348
|
-
type: 'unsupported-tool';
|
|
4349
|
-
tool: LanguageModelV2FunctionTool_2 | LanguageModelV2ProviderDefinedTool_2;
|
|
4350
|
-
details?: string;
|
|
4351
|
-
} | {
|
|
4352
|
-
type: 'other';
|
|
4353
|
-
message: string;
|
|
4354
|
-
};
|
|
3939
|
+
/**
|
|
3940
|
+
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
3941
|
+
some settings might not be supported, which can lead to suboptimal results.
|
|
3942
|
+
*/
|
|
3943
|
+
declare type LanguageModelV2CallWarning = {
|
|
3944
|
+
type: 'unsupported-setting';
|
|
3945
|
+
setting: Omit<keyof LanguageModelV2CallOptions, 'prompt'>;
|
|
3946
|
+
details?: string;
|
|
3947
|
+
} | {
|
|
3948
|
+
type: 'unsupported-tool';
|
|
3949
|
+
tool: LanguageModelV2FunctionTool | LanguageModelV2ProviderDefinedTool;
|
|
3950
|
+
details?: string;
|
|
3951
|
+
} | {
|
|
3952
|
+
type: 'other';
|
|
3953
|
+
message: string;
|
|
3954
|
+
};
|
|
4355
3955
|
|
|
4356
3956
|
declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reasoning | LanguageModelV2File | LanguageModelV2Source | LanguageModelV2ToolCall | LanguageModelV2ToolResult;
|
|
4357
3957
|
|
|
4358
|
-
declare type LanguageModelV2Content_2 = LanguageModelV2Text_2 | LanguageModelV2Reasoning_2 | LanguageModelV2File_2 | LanguageModelV2Source_2 | LanguageModelV2ToolCall_2 | LanguageModelV2ToolResult_2;
|
|
4359
|
-
|
|
4360
3958
|
/**
|
|
4361
3959
|
Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
4362
3960
|
*/
|
|
4363
3961
|
declare type LanguageModelV2DataContent = Uint8Array | string | URL;
|
|
4364
3962
|
|
|
4365
|
-
/**
|
|
4366
|
-
Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
4367
|
-
*/
|
|
4368
|
-
declare type LanguageModelV2DataContent_2 = Uint8Array | string | URL;
|
|
4369
|
-
|
|
4370
3963
|
/**
|
|
4371
3964
|
A file that has been generated by the model.
|
|
4372
3965
|
Generated files as base64 encoded strings or binary data.
|
|
@@ -4391,30 +3984,6 @@ declare type LanguageModelV2File = {
|
|
|
4391
3984
|
data: string | Uint8Array;
|
|
4392
3985
|
};
|
|
4393
3986
|
|
|
4394
|
-
/**
|
|
4395
|
-
A file that has been generated by the model.
|
|
4396
|
-
Generated files as base64 encoded strings or binary data.
|
|
4397
|
-
The files should be returned without any unnecessary conversion.
|
|
4398
|
-
*/
|
|
4399
|
-
declare type LanguageModelV2File_2 = {
|
|
4400
|
-
type: 'file';
|
|
4401
|
-
/**
|
|
4402
|
-
The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
|
|
4403
|
-
|
|
4404
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4405
|
-
*/
|
|
4406
|
-
mediaType: string;
|
|
4407
|
-
/**
|
|
4408
|
-
Generated file data as base64 encoded strings or binary data.
|
|
4409
|
-
|
|
4410
|
-
The file data should be returned without any unnecessary conversion.
|
|
4411
|
-
If the API returns base64 encoded strings, the file data should be returned
|
|
4412
|
-
as base64 encoded strings. If the API returns binary data, the file data should
|
|
4413
|
-
be returned as binary data.
|
|
4414
|
-
*/
|
|
4415
|
-
data: string | Uint8Array;
|
|
4416
|
-
};
|
|
4417
|
-
|
|
4418
3987
|
/**
|
|
4419
3988
|
File content part of a prompt. It contains a file.
|
|
4420
3989
|
*/
|
|
@@ -4444,35 +4013,6 @@ declare interface LanguageModelV2FilePart {
|
|
|
4444
4013
|
providerOptions?: SharedV2ProviderOptions;
|
|
4445
4014
|
}
|
|
4446
4015
|
|
|
4447
|
-
/**
|
|
4448
|
-
File content part of a prompt. It contains a file.
|
|
4449
|
-
*/
|
|
4450
|
-
declare interface LanguageModelV2FilePart_2 {
|
|
4451
|
-
type: 'file';
|
|
4452
|
-
/**
|
|
4453
|
-
* Optional filename of the file.
|
|
4454
|
-
*/
|
|
4455
|
-
filename?: string;
|
|
4456
|
-
/**
|
|
4457
|
-
File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
4458
|
-
*/
|
|
4459
|
-
data: LanguageModelV2DataContent_2;
|
|
4460
|
-
/**
|
|
4461
|
-
IANA media type of the file.
|
|
4462
|
-
|
|
4463
|
-
Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
|
|
4464
|
-
|
|
4465
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4466
|
-
*/
|
|
4467
|
-
mediaType: string;
|
|
4468
|
-
/**
|
|
4469
|
-
* Additional provider-specific options. They are passed through
|
|
4470
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
4471
|
-
* functionality that can be fully encapsulated in the provider.
|
|
4472
|
-
*/
|
|
4473
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
4474
|
-
}
|
|
4475
|
-
|
|
4476
4016
|
/**
|
|
4477
4017
|
Reason why a language model finished generating a response.
|
|
4478
4018
|
|
|
@@ -4487,20 +4027,6 @@ declare interface LanguageModelV2FilePart_2 {
|
|
|
4487
4027
|
*/
|
|
4488
4028
|
declare type LanguageModelV2FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
|
|
4489
4029
|
|
|
4490
|
-
/**
|
|
4491
|
-
Reason why a language model finished generating a response.
|
|
4492
|
-
|
|
4493
|
-
Can be one of the following:
|
|
4494
|
-
- `stop`: model generated stop sequence
|
|
4495
|
-
- `length`: model generated maximum number of tokens
|
|
4496
|
-
- `content-filter`: content filter violation stopped the model
|
|
4497
|
-
- `tool-calls`: model triggered tool calls
|
|
4498
|
-
- `error`: model stopped because of an error
|
|
4499
|
-
- `other`: model stopped for other reasons
|
|
4500
|
-
- `unknown`: the model has not transmitted a finish reason
|
|
4501
|
-
*/
|
|
4502
|
-
declare type LanguageModelV2FinishReason_2 = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
|
|
4503
|
-
|
|
4504
4030
|
/**
|
|
4505
4031
|
A tool has a name, a description, and a set of parameters.
|
|
4506
4032
|
|
|
@@ -4532,37 +4058,6 @@ declare type LanguageModelV2FunctionTool = {
|
|
|
4532
4058
|
providerOptions?: SharedV2ProviderOptions;
|
|
4533
4059
|
};
|
|
4534
4060
|
|
|
4535
|
-
/**
|
|
4536
|
-
A tool has a name, a description, and a set of parameters.
|
|
4537
|
-
|
|
4538
|
-
Note: this is **not** the user-facing tool definition. The AI SDK methods will
|
|
4539
|
-
map the user-facing tool definitions to this format.
|
|
4540
|
-
*/
|
|
4541
|
-
declare type LanguageModelV2FunctionTool_2 = {
|
|
4542
|
-
/**
|
|
4543
|
-
The type of the tool (always 'function').
|
|
4544
|
-
*/
|
|
4545
|
-
type: 'function';
|
|
4546
|
-
/**
|
|
4547
|
-
The name of the tool. Unique within this model call.
|
|
4548
|
-
*/
|
|
4549
|
-
name: string;
|
|
4550
|
-
/**
|
|
4551
|
-
A description of the tool. The language model uses this to understand the
|
|
4552
|
-
tool's purpose and to provide better completion suggestions.
|
|
4553
|
-
*/
|
|
4554
|
-
description?: string;
|
|
4555
|
-
/**
|
|
4556
|
-
The parameters that the tool expects. The language model uses this to
|
|
4557
|
-
understand the tool's input requirements and to provide matching suggestions.
|
|
4558
|
-
*/
|
|
4559
|
-
inputSchema: JSONSchema7;
|
|
4560
|
-
/**
|
|
4561
|
-
The provider-specific options for the tool.
|
|
4562
|
-
*/
|
|
4563
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
4564
|
-
};
|
|
4565
|
-
|
|
4566
4061
|
declare type LanguageModelV2Message = ({
|
|
4567
4062
|
role: 'system';
|
|
4568
4063
|
content: string;
|
|
@@ -4584,27 +4079,6 @@ declare type LanguageModelV2Message = ({
|
|
|
4584
4079
|
providerOptions?: SharedV2ProviderOptions;
|
|
4585
4080
|
};
|
|
4586
4081
|
|
|
4587
|
-
declare type LanguageModelV2Message_2 = ({
|
|
4588
|
-
role: 'system';
|
|
4589
|
-
content: string;
|
|
4590
|
-
} | {
|
|
4591
|
-
role: 'user';
|
|
4592
|
-
content: Array<LanguageModelV2TextPart_2 | LanguageModelV2FilePart_2>;
|
|
4593
|
-
} | {
|
|
4594
|
-
role: 'assistant';
|
|
4595
|
-
content: Array<LanguageModelV2TextPart_2 | LanguageModelV2FilePart_2 | LanguageModelV2ReasoningPart_2 | LanguageModelV2ToolCallPart_2 | LanguageModelV2ToolResultPart_2>;
|
|
4596
|
-
} | {
|
|
4597
|
-
role: 'tool';
|
|
4598
|
-
content: Array<LanguageModelV2ToolResultPart_2>;
|
|
4599
|
-
}) & {
|
|
4600
|
-
/**
|
|
4601
|
-
* Additional provider-specific options. They are passed through
|
|
4602
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
4603
|
-
* functionality that can be fully encapsulated in the provider.
|
|
4604
|
-
*/
|
|
4605
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
4606
|
-
};
|
|
4607
|
-
|
|
4608
4082
|
/**
|
|
4609
4083
|
* Experimental middleware for LanguageModelV2.
|
|
4610
4084
|
* This type defines the structure for middleware that can be used to modify
|
|
@@ -4620,21 +4094,21 @@ declare type LanguageModelV2Middleware = {
|
|
|
4620
4094
|
* @param options.model - The language model instance.
|
|
4621
4095
|
*/
|
|
4622
4096
|
overrideProvider?: (options: {
|
|
4623
|
-
model:
|
|
4097
|
+
model: LanguageModelV2;
|
|
4624
4098
|
}) => string;
|
|
4625
4099
|
/**
|
|
4626
4100
|
* Override the model ID if desired.
|
|
4627
4101
|
* @param options.model - The language model instance.
|
|
4628
4102
|
*/
|
|
4629
4103
|
overrideModelId?: (options: {
|
|
4630
|
-
model:
|
|
4104
|
+
model: LanguageModelV2;
|
|
4631
4105
|
}) => string;
|
|
4632
4106
|
/**
|
|
4633
4107
|
* Override the supported URLs if desired.
|
|
4634
4108
|
* @param options.model - The language model instance.
|
|
4635
4109
|
*/
|
|
4636
4110
|
overrideSupportedUrls?: (options: {
|
|
4637
|
-
model:
|
|
4111
|
+
model: LanguageModelV2;
|
|
4638
4112
|
}) => PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>;
|
|
4639
4113
|
/**
|
|
4640
4114
|
* Transforms the parameters before they are passed to the language model.
|
|
@@ -4645,9 +4119,9 @@ declare type LanguageModelV2Middleware = {
|
|
|
4645
4119
|
*/
|
|
4646
4120
|
transformParams?: (options: {
|
|
4647
4121
|
type: 'generate' | 'stream';
|
|
4648
|
-
params:
|
|
4649
|
-
model:
|
|
4650
|
-
}) => PromiseLike<
|
|
4122
|
+
params: LanguageModelV2CallOptions;
|
|
4123
|
+
model: LanguageModelV2;
|
|
4124
|
+
}) => PromiseLike<LanguageModelV2CallOptions>;
|
|
4651
4125
|
/**
|
|
4652
4126
|
* Wraps the generate operation of the language model.
|
|
4653
4127
|
* @param options - Object containing the generate function, parameters, and model.
|
|
@@ -4659,11 +4133,11 @@ declare type LanguageModelV2Middleware = {
|
|
|
4659
4133
|
* @returns A promise that resolves to the result of the generate operation.
|
|
4660
4134
|
*/
|
|
4661
4135
|
wrapGenerate?: (options: {
|
|
4662
|
-
doGenerate: () => ReturnType<
|
|
4663
|
-
doStream: () => ReturnType<
|
|
4664
|
-
params:
|
|
4665
|
-
model:
|
|
4666
|
-
}) => Promise<Awaited<ReturnType<
|
|
4136
|
+
doGenerate: () => ReturnType<LanguageModelV2['doGenerate']>;
|
|
4137
|
+
doStream: () => ReturnType<LanguageModelV2['doStream']>;
|
|
4138
|
+
params: LanguageModelV2CallOptions;
|
|
4139
|
+
model: LanguageModelV2;
|
|
4140
|
+
}) => Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
|
|
4667
4141
|
/**
|
|
4668
4142
|
* Wraps the stream operation of the language model.
|
|
4669
4143
|
*
|
|
@@ -4676,11 +4150,11 @@ declare type LanguageModelV2Middleware = {
|
|
|
4676
4150
|
* @returns A promise that resolves to the result of the stream operation.
|
|
4677
4151
|
*/
|
|
4678
4152
|
wrapStream?: (options: {
|
|
4679
|
-
doGenerate: () => ReturnType<
|
|
4680
|
-
doStream: () => ReturnType<
|
|
4681
|
-
params:
|
|
4682
|
-
model:
|
|
4683
|
-
}) => PromiseLike<Awaited<ReturnType<
|
|
4153
|
+
doGenerate: () => ReturnType<LanguageModelV2['doGenerate']>;
|
|
4154
|
+
doStream: () => ReturnType<LanguageModelV2['doStream']>;
|
|
4155
|
+
params: LanguageModelV2CallOptions;
|
|
4156
|
+
model: LanguageModelV2;
|
|
4157
|
+
}) => PromiseLike<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
|
|
4684
4158
|
};
|
|
4685
4159
|
|
|
4686
4160
|
/**
|
|
@@ -4694,17 +4168,6 @@ declare type LanguageModelV2Middleware = {
|
|
|
4694
4168
|
*/
|
|
4695
4169
|
declare type LanguageModelV2Prompt = Array<LanguageModelV2Message>;
|
|
4696
4170
|
|
|
4697
|
-
/**
|
|
4698
|
-
A prompt is a list of messages.
|
|
4699
|
-
|
|
4700
|
-
Note: Not all models and prompt formats support multi-modal inputs and
|
|
4701
|
-
tool calls. The validation happens at runtime.
|
|
4702
|
-
|
|
4703
|
-
Note: This is not a user-facing prompt. The AI SDK methods will map the
|
|
4704
|
-
user-facing prompt types such as chat or instruction prompts to this format.
|
|
4705
|
-
*/
|
|
4706
|
-
declare type LanguageModelV2Prompt_2 = Array<LanguageModelV2Message_2>;
|
|
4707
|
-
|
|
4708
4171
|
/**
|
|
4709
4172
|
The configuration of a tool that is defined by the provider.
|
|
4710
4173
|
*/
|
|
@@ -4727,28 +4190,6 @@ declare type LanguageModelV2ProviderDefinedTool = {
|
|
|
4727
4190
|
args: Record<string, unknown>;
|
|
4728
4191
|
};
|
|
4729
4192
|
|
|
4730
|
-
/**
|
|
4731
|
-
The configuration of a tool that is defined by the provider.
|
|
4732
|
-
*/
|
|
4733
|
-
declare type LanguageModelV2ProviderDefinedTool_2 = {
|
|
4734
|
-
/**
|
|
4735
|
-
The type of the tool (always 'provider-defined').
|
|
4736
|
-
*/
|
|
4737
|
-
type: 'provider-defined';
|
|
4738
|
-
/**
|
|
4739
|
-
The ID of the tool. Should follow the format `<provider-name>.<unique-tool-name>`.
|
|
4740
|
-
*/
|
|
4741
|
-
id: `${string}.${string}`;
|
|
4742
|
-
/**
|
|
4743
|
-
The name of the tool that the user must use in the tool set.
|
|
4744
|
-
*/
|
|
4745
|
-
name: string;
|
|
4746
|
-
/**
|
|
4747
|
-
The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
|
|
4748
|
-
*/
|
|
4749
|
-
args: Record<string, unknown>;
|
|
4750
|
-
};
|
|
4751
|
-
|
|
4752
4193
|
/**
|
|
4753
4194
|
Reasoning that the model has generated.
|
|
4754
4195
|
*/
|
|
@@ -4762,138 +4203,41 @@ declare type LanguageModelV2Reasoning = {
|
|
|
4762
4203
|
};
|
|
4763
4204
|
|
|
4764
4205
|
/**
|
|
4765
|
-
Reasoning
|
|
4766
|
-
*/
|
|
4767
|
-
declare
|
|
4768
|
-
type: 'reasoning';
|
|
4769
|
-
text: string;
|
|
4770
|
-
/**
|
|
4771
|
-
* Optional provider-specific metadata for the reasoning part.
|
|
4772
|
-
*/
|
|
4773
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4774
|
-
};
|
|
4775
|
-
|
|
4776
|
-
/**
|
|
4777
|
-
Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
4778
|
-
*/
|
|
4779
|
-
declare interface LanguageModelV2ReasoningPart {
|
|
4780
|
-
type: 'reasoning';
|
|
4781
|
-
/**
|
|
4782
|
-
The reasoning text.
|
|
4783
|
-
*/
|
|
4784
|
-
text: string;
|
|
4785
|
-
/**
|
|
4786
|
-
* Additional provider-specific options. They are passed through
|
|
4787
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
4788
|
-
* functionality that can be fully encapsulated in the provider.
|
|
4789
|
-
*/
|
|
4790
|
-
providerOptions?: SharedV2ProviderOptions;
|
|
4791
|
-
}
|
|
4792
|
-
|
|
4793
|
-
/**
|
|
4794
|
-
Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
4795
|
-
*/
|
|
4796
|
-
declare interface LanguageModelV2ReasoningPart_2 {
|
|
4797
|
-
type: 'reasoning';
|
|
4798
|
-
/**
|
|
4799
|
-
The reasoning text.
|
|
4800
|
-
*/
|
|
4801
|
-
text: string;
|
|
4802
|
-
/**
|
|
4803
|
-
* Additional provider-specific options. They are passed through
|
|
4804
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
4805
|
-
* functionality that can be fully encapsulated in the provider.
|
|
4806
|
-
*/
|
|
4807
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
4808
|
-
}
|
|
4809
|
-
|
|
4810
|
-
declare interface LanguageModelV2ResponseMetadata {
|
|
4811
|
-
/**
|
|
4812
|
-
ID for the generated response, if the provider sends one.
|
|
4813
|
-
*/
|
|
4814
|
-
id?: string;
|
|
4815
|
-
/**
|
|
4816
|
-
Timestamp for the start of the generated response, if the provider sends one.
|
|
4817
|
-
*/
|
|
4818
|
-
timestamp?: Date;
|
|
4819
|
-
/**
|
|
4820
|
-
The ID of the response model that was used to generate the response, if the provider sends one.
|
|
4821
|
-
*/
|
|
4822
|
-
modelId?: string;
|
|
4823
|
-
}
|
|
4824
|
-
|
|
4825
|
-
declare interface LanguageModelV2ResponseMetadata_2 {
|
|
4826
|
-
/**
|
|
4827
|
-
ID for the generated response, if the provider sends one.
|
|
4828
|
-
*/
|
|
4829
|
-
id?: string;
|
|
4830
|
-
/**
|
|
4831
|
-
Timestamp for the start of the generated response, if the provider sends one.
|
|
4832
|
-
*/
|
|
4833
|
-
timestamp?: Date;
|
|
4834
|
-
/**
|
|
4835
|
-
The ID of the response model that was used to generate the response, if the provider sends one.
|
|
4836
|
-
*/
|
|
4837
|
-
modelId?: string;
|
|
4838
|
-
}
|
|
4839
|
-
|
|
4840
|
-
/**
|
|
4841
|
-
A source that has been used as input to generate the response.
|
|
4842
|
-
*/
|
|
4843
|
-
declare type LanguageModelV2Source = {
|
|
4844
|
-
type: 'source';
|
|
4845
|
-
/**
|
|
4846
|
-
* The type of source - URL sources reference web content.
|
|
4847
|
-
*/
|
|
4848
|
-
sourceType: 'url';
|
|
4849
|
-
/**
|
|
4850
|
-
* The ID of the source.
|
|
4851
|
-
*/
|
|
4852
|
-
id: string;
|
|
4853
|
-
/**
|
|
4854
|
-
* The URL of the source.
|
|
4855
|
-
*/
|
|
4856
|
-
url: string;
|
|
4857
|
-
/**
|
|
4858
|
-
* The title of the source.
|
|
4859
|
-
*/
|
|
4860
|
-
title?: string;
|
|
4861
|
-
/**
|
|
4862
|
-
* Additional provider metadata for the source.
|
|
4863
|
-
*/
|
|
4864
|
-
providerMetadata?: SharedV2ProviderMetadata;
|
|
4865
|
-
} | {
|
|
4866
|
-
type: 'source';
|
|
4867
|
-
/**
|
|
4868
|
-
* The type of source - document sources reference files/documents.
|
|
4869
|
-
*/
|
|
4870
|
-
sourceType: 'document';
|
|
4206
|
+
Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
4207
|
+
*/
|
|
4208
|
+
declare interface LanguageModelV2ReasoningPart {
|
|
4209
|
+
type: 'reasoning';
|
|
4871
4210
|
/**
|
|
4872
|
-
|
|
4211
|
+
The reasoning text.
|
|
4873
4212
|
*/
|
|
4874
|
-
|
|
4213
|
+
text: string;
|
|
4875
4214
|
/**
|
|
4876
|
-
*
|
|
4215
|
+
* Additional provider-specific options. They are passed through
|
|
4216
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
4217
|
+
* functionality that can be fully encapsulated in the provider.
|
|
4877
4218
|
*/
|
|
4878
|
-
|
|
4219
|
+
providerOptions?: SharedV2ProviderOptions;
|
|
4220
|
+
}
|
|
4221
|
+
|
|
4222
|
+
declare interface LanguageModelV2ResponseMetadata {
|
|
4879
4223
|
/**
|
|
4880
|
-
|
|
4224
|
+
ID for the generated response, if the provider sends one.
|
|
4881
4225
|
*/
|
|
4882
|
-
|
|
4226
|
+
id?: string;
|
|
4883
4227
|
/**
|
|
4884
|
-
|
|
4228
|
+
Timestamp for the start of the generated response, if the provider sends one.
|
|
4885
4229
|
*/
|
|
4886
|
-
|
|
4230
|
+
timestamp?: Date;
|
|
4887
4231
|
/**
|
|
4888
|
-
|
|
4232
|
+
The ID of the response model that was used to generate the response, if the provider sends one.
|
|
4889
4233
|
*/
|
|
4890
|
-
|
|
4891
|
-
}
|
|
4234
|
+
modelId?: string;
|
|
4235
|
+
}
|
|
4892
4236
|
|
|
4893
4237
|
/**
|
|
4894
4238
|
A source that has been used as input to generate the response.
|
|
4895
4239
|
*/
|
|
4896
|
-
declare type
|
|
4240
|
+
declare type LanguageModelV2Source = {
|
|
4897
4241
|
type: 'source';
|
|
4898
4242
|
/**
|
|
4899
4243
|
* The type of source - URL sources reference web content.
|
|
@@ -4914,7 +4258,7 @@ declare type LanguageModelV2Source_2 = {
|
|
|
4914
4258
|
/**
|
|
4915
4259
|
* Additional provider metadata for the source.
|
|
4916
4260
|
*/
|
|
4917
|
-
providerMetadata?:
|
|
4261
|
+
providerMetadata?: SharedV2ProviderMetadata;
|
|
4918
4262
|
} | {
|
|
4919
4263
|
type: 'source';
|
|
4920
4264
|
/**
|
|
@@ -4940,7 +4284,7 @@ declare type LanguageModelV2Source_2 = {
|
|
|
4940
4284
|
/**
|
|
4941
4285
|
* Additional provider metadata for the source.
|
|
4942
4286
|
*/
|
|
4943
|
-
providerMetadata?:
|
|
4287
|
+
providerMetadata?: SharedV2ProviderMetadata;
|
|
4944
4288
|
};
|
|
4945
4289
|
|
|
4946
4290
|
declare type LanguageModelV2StreamPart = {
|
|
@@ -5002,65 +4346,6 @@ declare type LanguageModelV2StreamPart = {
|
|
|
5002
4346
|
error: unknown;
|
|
5003
4347
|
};
|
|
5004
4348
|
|
|
5005
|
-
declare type LanguageModelV2StreamPart_2 = {
|
|
5006
|
-
type: 'text-start';
|
|
5007
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5008
|
-
id: string;
|
|
5009
|
-
} | {
|
|
5010
|
-
type: 'text-delta';
|
|
5011
|
-
id: string;
|
|
5012
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5013
|
-
delta: string;
|
|
5014
|
-
} | {
|
|
5015
|
-
type: 'text-end';
|
|
5016
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5017
|
-
id: string;
|
|
5018
|
-
} | {
|
|
5019
|
-
type: 'reasoning-start';
|
|
5020
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5021
|
-
id: string;
|
|
5022
|
-
} | {
|
|
5023
|
-
type: 'reasoning-delta';
|
|
5024
|
-
id: string;
|
|
5025
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5026
|
-
delta: string;
|
|
5027
|
-
} | {
|
|
5028
|
-
type: 'reasoning-end';
|
|
5029
|
-
id: string;
|
|
5030
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5031
|
-
} | {
|
|
5032
|
-
type: 'tool-input-start';
|
|
5033
|
-
id: string;
|
|
5034
|
-
toolName: string;
|
|
5035
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5036
|
-
providerExecuted?: boolean;
|
|
5037
|
-
} | {
|
|
5038
|
-
type: 'tool-input-delta';
|
|
5039
|
-
id: string;
|
|
5040
|
-
delta: string;
|
|
5041
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5042
|
-
} | {
|
|
5043
|
-
type: 'tool-input-end';
|
|
5044
|
-
id: string;
|
|
5045
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5046
|
-
} | LanguageModelV2ToolCall_2 | LanguageModelV2ToolResult_2 | LanguageModelV2File_2 | LanguageModelV2Source_2 | {
|
|
5047
|
-
type: 'stream-start';
|
|
5048
|
-
warnings: Array<LanguageModelV2CallWarning_2>;
|
|
5049
|
-
} | ({
|
|
5050
|
-
type: 'response-metadata';
|
|
5051
|
-
} & LanguageModelV2ResponseMetadata_2) | {
|
|
5052
|
-
type: 'finish';
|
|
5053
|
-
usage: LanguageModelV2Usage_2;
|
|
5054
|
-
finishReason: LanguageModelV2FinishReason_2;
|
|
5055
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5056
|
-
} | {
|
|
5057
|
-
type: 'raw';
|
|
5058
|
-
rawValue: unknown;
|
|
5059
|
-
} | {
|
|
5060
|
-
type: 'error';
|
|
5061
|
-
error: unknown;
|
|
5062
|
-
};
|
|
5063
|
-
|
|
5064
4349
|
/**
|
|
5065
4350
|
Text that the model has generated.
|
|
5066
4351
|
*/
|
|
@@ -5073,18 +4358,6 @@ declare type LanguageModelV2Text = {
|
|
|
5073
4358
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
5074
4359
|
};
|
|
5075
4360
|
|
|
5076
|
-
/**
|
|
5077
|
-
Text that the model has generated.
|
|
5078
|
-
*/
|
|
5079
|
-
declare type LanguageModelV2Text_2 = {
|
|
5080
|
-
type: 'text';
|
|
5081
|
-
/**
|
|
5082
|
-
The text content.
|
|
5083
|
-
*/
|
|
5084
|
-
text: string;
|
|
5085
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5086
|
-
};
|
|
5087
|
-
|
|
5088
4361
|
/**
|
|
5089
4362
|
Text content part of a prompt. It contains a string of text.
|
|
5090
4363
|
*/
|
|
@@ -5102,23 +4375,6 @@ declare interface LanguageModelV2TextPart {
|
|
|
5102
4375
|
providerOptions?: SharedV2ProviderOptions;
|
|
5103
4376
|
}
|
|
5104
4377
|
|
|
5105
|
-
/**
|
|
5106
|
-
Text content part of a prompt. It contains a string of text.
|
|
5107
|
-
*/
|
|
5108
|
-
declare interface LanguageModelV2TextPart_2 {
|
|
5109
|
-
type: 'text';
|
|
5110
|
-
/**
|
|
5111
|
-
The text content.
|
|
5112
|
-
*/
|
|
5113
|
-
text: string;
|
|
5114
|
-
/**
|
|
5115
|
-
* Additional provider-specific options. They are passed through
|
|
5116
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
5117
|
-
* functionality that can be fully encapsulated in the provider.
|
|
5118
|
-
*/
|
|
5119
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
5120
|
-
}
|
|
5121
|
-
|
|
5122
4378
|
/**
|
|
5123
4379
|
* Tool calls that the model has generated.
|
|
5124
4380
|
*/
|
|
@@ -5148,29 +4404,6 @@ declare type LanguageModelV2ToolCall = {
|
|
|
5148
4404
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
5149
4405
|
};
|
|
5150
4406
|
|
|
5151
|
-
/**
|
|
5152
|
-
Tool calls that the model has generated.
|
|
5153
|
-
*/
|
|
5154
|
-
declare type LanguageModelV2ToolCall_2 = {
|
|
5155
|
-
type: 'tool-call';
|
|
5156
|
-
toolCallId: string;
|
|
5157
|
-
toolName: string;
|
|
5158
|
-
/**
|
|
5159
|
-
Stringified JSON object with the tool call arguments. Must match the
|
|
5160
|
-
parameters schema of the tool.
|
|
5161
|
-
*/
|
|
5162
|
-
input: string;
|
|
5163
|
-
/**
|
|
5164
|
-
* Whether the tool call will be executed by the provider.
|
|
5165
|
-
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
5166
|
-
*/
|
|
5167
|
-
providerExecuted?: boolean;
|
|
5168
|
-
/**
|
|
5169
|
-
* Additional provider-specific metadata for the tool call.
|
|
5170
|
-
*/
|
|
5171
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5172
|
-
};
|
|
5173
|
-
|
|
5174
4407
|
/**
|
|
5175
4408
|
Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
5176
4409
|
*/
|
|
@@ -5201,36 +4434,6 @@ declare interface LanguageModelV2ToolCallPart {
|
|
|
5201
4434
|
providerOptions?: SharedV2ProviderOptions;
|
|
5202
4435
|
}
|
|
5203
4436
|
|
|
5204
|
-
/**
|
|
5205
|
-
Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
5206
|
-
*/
|
|
5207
|
-
declare interface LanguageModelV2ToolCallPart_2 {
|
|
5208
|
-
type: 'tool-call';
|
|
5209
|
-
/**
|
|
5210
|
-
ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
5211
|
-
*/
|
|
5212
|
-
toolCallId: string;
|
|
5213
|
-
/**
|
|
5214
|
-
Name of the tool that is being called.
|
|
5215
|
-
*/
|
|
5216
|
-
toolName: string;
|
|
5217
|
-
/**
|
|
5218
|
-
Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
5219
|
-
*/
|
|
5220
|
-
input: unknown;
|
|
5221
|
-
/**
|
|
5222
|
-
* Whether the tool call will be executed by the provider.
|
|
5223
|
-
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
5224
|
-
*/
|
|
5225
|
-
providerExecuted?: boolean;
|
|
5226
|
-
/**
|
|
5227
|
-
* Additional provider-specific options. They are passed through
|
|
5228
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
5229
|
-
* functionality that can be fully encapsulated in the provider.
|
|
5230
|
-
*/
|
|
5231
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
5232
|
-
}
|
|
5233
|
-
|
|
5234
4437
|
declare type LanguageModelV2ToolChoice = {
|
|
5235
4438
|
type: 'auto';
|
|
5236
4439
|
} | {
|
|
@@ -5242,17 +4445,6 @@ declare type LanguageModelV2ToolChoice = {
|
|
|
5242
4445
|
toolName: string;
|
|
5243
4446
|
};
|
|
5244
4447
|
|
|
5245
|
-
declare type LanguageModelV2ToolChoice_2 = {
|
|
5246
|
-
type: 'auto';
|
|
5247
|
-
} | {
|
|
5248
|
-
type: 'none';
|
|
5249
|
-
} | {
|
|
5250
|
-
type: 'required';
|
|
5251
|
-
} | {
|
|
5252
|
-
type: 'tool';
|
|
5253
|
-
toolName: string;
|
|
5254
|
-
};
|
|
5255
|
-
|
|
5256
4448
|
/**
|
|
5257
4449
|
Result of a tool call that has been executed by the provider.
|
|
5258
4450
|
*/
|
|
@@ -5286,39 +4478,6 @@ declare type LanguageModelV2ToolResult = {
|
|
|
5286
4478
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
5287
4479
|
};
|
|
5288
4480
|
|
|
5289
|
-
/**
|
|
5290
|
-
Result of a tool call that has been executed by the provider.
|
|
5291
|
-
*/
|
|
5292
|
-
declare type LanguageModelV2ToolResult_2 = {
|
|
5293
|
-
type: 'tool-result';
|
|
5294
|
-
/**
|
|
5295
|
-
* The ID of the tool call that this result is associated with.
|
|
5296
|
-
*/
|
|
5297
|
-
toolCallId: string;
|
|
5298
|
-
/**
|
|
5299
|
-
* Name of the tool that generated this result.
|
|
5300
|
-
*/
|
|
5301
|
-
toolName: string;
|
|
5302
|
-
/**
|
|
5303
|
-
* Result of the tool call. This is a JSON-serializable object.
|
|
5304
|
-
*/
|
|
5305
|
-
result: unknown;
|
|
5306
|
-
/**
|
|
5307
|
-
* Optional flag if the result is an error or an error message.
|
|
5308
|
-
*/
|
|
5309
|
-
isError?: boolean;
|
|
5310
|
-
/**
|
|
5311
|
-
* Whether the tool result was generated by the provider.
|
|
5312
|
-
* If this flag is set to true, the tool result was generated by the provider.
|
|
5313
|
-
* If this flag is not set or is false, the tool result was generated by the client.
|
|
5314
|
-
*/
|
|
5315
|
-
providerExecuted?: boolean;
|
|
5316
|
-
/**
|
|
5317
|
-
* Additional provider-specific metadata for the tool result.
|
|
5318
|
-
*/
|
|
5319
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5320
|
-
};
|
|
5321
|
-
|
|
5322
4481
|
declare type LanguageModelV2ToolResultOutput = {
|
|
5323
4482
|
type: 'text';
|
|
5324
4483
|
value: string;
|
|
@@ -5341,81 +4500,22 @@ declare type LanguageModelV2ToolResultOutput = {
|
|
|
5341
4500
|
text: string;
|
|
5342
4501
|
} | {
|
|
5343
4502
|
type: 'media';
|
|
5344
|
-
/**
|
|
5345
|
-
Base-64 encoded media data.
|
|
5346
|
-
*/
|
|
5347
|
-
data: string;
|
|
5348
|
-
/**
|
|
5349
|
-
IANA media type.
|
|
5350
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
5351
|
-
*/
|
|
5352
|
-
mediaType: string;
|
|
5353
|
-
}>;
|
|
5354
|
-
};
|
|
5355
|
-
|
|
5356
|
-
declare type LanguageModelV2ToolResultOutput_2 = {
|
|
5357
|
-
type: 'text';
|
|
5358
|
-
value: string;
|
|
5359
|
-
} | {
|
|
5360
|
-
type: 'json';
|
|
5361
|
-
value: JSONValue_3;
|
|
5362
|
-
} | {
|
|
5363
|
-
type: 'error-text';
|
|
5364
|
-
value: string;
|
|
5365
|
-
} | {
|
|
5366
|
-
type: 'error-json';
|
|
5367
|
-
value: JSONValue_3;
|
|
5368
|
-
} | {
|
|
5369
|
-
type: 'content';
|
|
5370
|
-
value: Array<{
|
|
5371
|
-
type: 'text';
|
|
5372
|
-
/**
|
|
5373
|
-
Text content.
|
|
5374
|
-
*/
|
|
5375
|
-
text: string;
|
|
5376
|
-
} | {
|
|
5377
|
-
type: 'media';
|
|
5378
|
-
/**
|
|
5379
|
-
Base-64 encoded media data.
|
|
5380
|
-
*/
|
|
5381
|
-
data: string;
|
|
5382
|
-
/**
|
|
5383
|
-
IANA media type.
|
|
5384
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
5385
|
-
*/
|
|
5386
|
-
mediaType: string;
|
|
5387
|
-
}>;
|
|
5388
|
-
};
|
|
5389
|
-
|
|
5390
|
-
/**
|
|
5391
|
-
Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
5392
|
-
*/
|
|
5393
|
-
declare interface LanguageModelV2ToolResultPart {
|
|
5394
|
-
type: 'tool-result';
|
|
5395
|
-
/**
|
|
5396
|
-
ID of the tool call that this result is associated with.
|
|
5397
|
-
*/
|
|
5398
|
-
toolCallId: string;
|
|
5399
|
-
/**
|
|
5400
|
-
Name of the tool that generated this result.
|
|
5401
|
-
*/
|
|
5402
|
-
toolName: string;
|
|
5403
|
-
/**
|
|
5404
|
-
Result of the tool call.
|
|
5405
|
-
*/
|
|
5406
|
-
output: LanguageModelV2ToolResultOutput;
|
|
5407
|
-
/**
|
|
5408
|
-
* Additional provider-specific options. They are passed through
|
|
5409
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
5410
|
-
* functionality that can be fully encapsulated in the provider.
|
|
5411
|
-
*/
|
|
5412
|
-
providerOptions?: SharedV2ProviderOptions;
|
|
5413
|
-
}
|
|
4503
|
+
/**
|
|
4504
|
+
Base-64 encoded media data.
|
|
4505
|
+
*/
|
|
4506
|
+
data: string;
|
|
4507
|
+
/**
|
|
4508
|
+
IANA media type.
|
|
4509
|
+
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4510
|
+
*/
|
|
4511
|
+
mediaType: string;
|
|
4512
|
+
}>;
|
|
4513
|
+
};
|
|
5414
4514
|
|
|
5415
4515
|
/**
|
|
5416
4516
|
Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
5417
4517
|
*/
|
|
5418
|
-
declare interface
|
|
4518
|
+
declare interface LanguageModelV2ToolResultPart {
|
|
5419
4519
|
type: 'tool-result';
|
|
5420
4520
|
/**
|
|
5421
4521
|
ID of the tool call that this result is associated with.
|
|
@@ -5428,13 +4528,13 @@ declare interface LanguageModelV2ToolResultPart_2 {
|
|
|
5428
4528
|
/**
|
|
5429
4529
|
Result of the tool call.
|
|
5430
4530
|
*/
|
|
5431
|
-
output:
|
|
4531
|
+
output: LanguageModelV2ToolResultOutput;
|
|
5432
4532
|
/**
|
|
5433
4533
|
* Additional provider-specific options. They are passed through
|
|
5434
4534
|
* to the provider from the AI SDK and enable provider-specific
|
|
5435
4535
|
* functionality that can be fully encapsulated in the provider.
|
|
5436
4536
|
*/
|
|
5437
|
-
providerOptions?:
|
|
4537
|
+
providerOptions?: SharedV2ProviderOptions;
|
|
5438
4538
|
}
|
|
5439
4539
|
|
|
5440
4540
|
/**
|
|
@@ -5468,37 +4568,6 @@ declare type LanguageModelV2Usage = {
|
|
|
5468
4568
|
cachedInputTokens?: number | undefined;
|
|
5469
4569
|
};
|
|
5470
4570
|
|
|
5471
|
-
/**
|
|
5472
|
-
Usage information for a language model call.
|
|
5473
|
-
|
|
5474
|
-
If your API return additional usage information, you can add it to the
|
|
5475
|
-
provider metadata under your provider's key.
|
|
5476
|
-
*/
|
|
5477
|
-
declare type LanguageModelV2Usage_2 = {
|
|
5478
|
-
/**
|
|
5479
|
-
The number of input (prompt) tokens used.
|
|
5480
|
-
*/
|
|
5481
|
-
inputTokens: number | undefined;
|
|
5482
|
-
/**
|
|
5483
|
-
The number of output (completion) tokens used.
|
|
5484
|
-
*/
|
|
5485
|
-
outputTokens: number | undefined;
|
|
5486
|
-
/**
|
|
5487
|
-
The total number of tokens as reported by the provider.
|
|
5488
|
-
This number might be different from the sum of `inputTokens` and `outputTokens`
|
|
5489
|
-
and e.g. include reasoning tokens or other overhead.
|
|
5490
|
-
*/
|
|
5491
|
-
totalTokens: number | undefined;
|
|
5492
|
-
/**
|
|
5493
|
-
The number of reasoning tokens used.
|
|
5494
|
-
*/
|
|
5495
|
-
reasoningTokens?: number | undefined;
|
|
5496
|
-
/**
|
|
5497
|
-
The number of cached input tokens.
|
|
5498
|
-
*/
|
|
5499
|
-
cachedInputTokens?: number | undefined;
|
|
5500
|
-
};
|
|
5501
|
-
|
|
5502
4571
|
/**
|
|
5503
4572
|
Check if the message is an assistant message with completed tool calls.
|
|
5504
4573
|
The last step of the message must have at least one tool invocation and
|
|
@@ -5546,6 +4615,8 @@ declare function lazyValidator<OBJECT>(createValidator: () => Validator<OBJECT>)
|
|
|
5546
4615
|
* However, it is desirable to associate incoming SpanContext to new trace
|
|
5547
4616
|
* initiated on service provider side so two traces (from Client and from
|
|
5548
4617
|
* Service Provider) can be correlated.
|
|
4618
|
+
*
|
|
4619
|
+
* @since 1.0.0
|
|
5549
4620
|
*/
|
|
5550
4621
|
declare interface Link {
|
|
5551
4622
|
/** The {@link SpanContext} of a linked span. */
|
|
@@ -5725,7 +4796,7 @@ export declare class NoOutputGeneratedError extends AISDKError {
|
|
|
5725
4796
|
Thrown when no output type is specified and output-related methods are called.
|
|
5726
4797
|
*/
|
|
5727
4798
|
export declare class NoOutputSpecifiedError extends AISDKError {
|
|
5728
|
-
private readonly [symbol$
|
|
4799
|
+
private readonly [symbol$7_2];
|
|
5729
4800
|
constructor({ message }?: {
|
|
5730
4801
|
message?: string;
|
|
5731
4802
|
});
|
|
@@ -5765,7 +4836,7 @@ export declare class NoSuchModelError extends AISDKError {
|
|
|
5765
4836
|
}
|
|
5766
4837
|
|
|
5767
4838
|
export declare class NoSuchProviderError extends NoSuchModelError {
|
|
5768
|
-
private readonly [
|
|
4839
|
+
private readonly [symbol_3];
|
|
5769
4840
|
readonly providerId: string;
|
|
5770
4841
|
readonly availableProviders: string[];
|
|
5771
4842
|
constructor({ modelId, modelType, providerId, availableProviders, message, }: {
|
|
@@ -5779,7 +4850,7 @@ export declare class NoSuchProviderError extends NoSuchModelError {
|
|
|
5779
4850
|
}
|
|
5780
4851
|
|
|
5781
4852
|
export declare class NoSuchToolError extends AISDKError {
|
|
5782
|
-
private readonly [symbol$
|
|
4853
|
+
private readonly [symbol$d_2];
|
|
5783
4854
|
readonly toolName: string;
|
|
5784
4855
|
readonly availableTools: string[] | undefined;
|
|
5785
4856
|
constructor({ toolName, availableTools, message, }: {
|
|
@@ -5817,7 +4888,7 @@ export declare namespace Output {
|
|
|
5817
4888
|
|
|
5818
4889
|
declare interface Output_2<OUTPUT, PARTIAL> {
|
|
5819
4890
|
readonly type: 'object' | 'text';
|
|
5820
|
-
responseFormat:
|
|
4891
|
+
responseFormat: LanguageModelV2CallOptions['responseFormat'];
|
|
5821
4892
|
parsePartial(options: {
|
|
5822
4893
|
text: string;
|
|
5823
4894
|
}): Promise<{
|
|
@@ -6007,7 +5078,7 @@ export declare function parseJsonEventStream<T>({ stream, schema, }: {
|
|
|
6007
5078
|
}): ReadableStream<ParseResult<T>>;
|
|
6008
5079
|
|
|
6009
5080
|
export declare function parsePartialJson(jsonText: string | undefined): Promise<{
|
|
6010
|
-
value:
|
|
5081
|
+
value: JSONValue_2 | undefined;
|
|
6011
5082
|
state: 'undefined-input' | 'successful-parse' | 'repaired-parse' | 'failed-parse';
|
|
6012
5083
|
}>;
|
|
6013
5084
|
|
|
@@ -6023,7 +5094,7 @@ declare type ParseResult<T> = {
|
|
|
6023
5094
|
rawValue: unknown;
|
|
6024
5095
|
} | {
|
|
6025
5096
|
success: false;
|
|
6026
|
-
error:
|
|
5097
|
+
error: JSONParseError | TypeValidationError;
|
|
6027
5098
|
rawValue: unknown;
|
|
6028
5099
|
};
|
|
6029
5100
|
|
|
@@ -6187,7 +5258,7 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
|
|
|
6187
5258
|
url: string;
|
|
6188
5259
|
headers?: Record<string, string | undefined>;
|
|
6189
5260
|
formData: FormData;
|
|
6190
|
-
failedResponseHandler: ResponseHandler<
|
|
5261
|
+
failedResponseHandler: ResponseHandler<APICallError>;
|
|
6191
5262
|
successfulResponseHandler: ResponseHandler<T>;
|
|
6192
5263
|
abortSignal?: AbortSignal;
|
|
6193
5264
|
fetch?: FetchFunction;
|
|
@@ -6201,7 +5272,7 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
|
|
|
6201
5272
|
url: string;
|
|
6202
5273
|
headers?: Record<string, string | undefined>;
|
|
6203
5274
|
body: unknown;
|
|
6204
|
-
failedResponseHandler: ResponseHandler<
|
|
5275
|
+
failedResponseHandler: ResponseHandler<APICallError>;
|
|
6205
5276
|
successfulResponseHandler: ResponseHandler<T>;
|
|
6206
5277
|
abortSignal?: AbortSignal;
|
|
6207
5278
|
fetch?: FetchFunction;
|
|
@@ -6303,6 +5374,15 @@ export declare type Prompt = {
|
|
|
6303
5374
|
System message to include in the prompt. Can be used with `prompt` or `messages`.
|
|
6304
5375
|
*/
|
|
6305
5376
|
system?: string;
|
|
5377
|
+
/**
|
|
5378
|
+
* Whether system messages are allowed in the `prompt` or `messages` fields.
|
|
5379
|
+
*
|
|
5380
|
+
* When disabled, system messages must be provided through the `system`
|
|
5381
|
+
* option. When unset, system messages are allowed with a warning.
|
|
5382
|
+
*
|
|
5383
|
+
* @default undefined
|
|
5384
|
+
*/
|
|
5385
|
+
allowSystemInMessages?: boolean;
|
|
6306
5386
|
} & ({
|
|
6307
5387
|
/**
|
|
6308
5388
|
A prompt. It can be either a text prompt or a list of messages.
|
|
@@ -6390,7 +5470,7 @@ declare type ProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS exte
|
|
|
6390
5470
|
This is needed to enable provider-specific functionality that can be
|
|
6391
5471
|
fully encapsulated in the provider.
|
|
6392
5472
|
*/
|
|
6393
|
-
export declare type ProviderMetadata =
|
|
5473
|
+
export declare type ProviderMetadata = SharedV2ProviderMetadata;
|
|
6394
5474
|
|
|
6395
5475
|
/**
|
|
6396
5476
|
Additional provider-specific options.
|
|
@@ -6400,17 +5480,17 @@ export declare type ProviderMetadata = SharedV2ProviderMetadata_2;
|
|
|
6400
5480
|
*/
|
|
6401
5481
|
declare type ProviderOptions = SharedV2ProviderOptions;
|
|
6402
5482
|
|
|
6403
|
-
export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string,
|
|
6404
|
-
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never):
|
|
6405
|
-
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never):
|
|
6406
|
-
textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['textEmbeddingModel']>>[0]>}` : never):
|
|
6407
|
-
textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never):
|
|
6408
|
-
imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['imageModel']>>[0]>}` : never):
|
|
6409
|
-
imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never):
|
|
6410
|
-
transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['transcriptionModel']>>[0]>}` : never):
|
|
6411
|
-
transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never):
|
|
6412
|
-
speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['speechModel']>>[0]>}` : never):
|
|
6413
|
-
speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never):
|
|
5483
|
+
export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV2> = Record<string, ProviderV2>, SEPARATOR extends string = ':'> {
|
|
5484
|
+
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV2;
|
|
5485
|
+
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): LanguageModelV2;
|
|
5486
|
+
textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['textEmbeddingModel']>>[0]>}` : never): EmbeddingModelV2<string>;
|
|
5487
|
+
textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): EmbeddingModelV2<string>;
|
|
5488
|
+
imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['imageModel']>>[0]>}` : never): ImageModelV2;
|
|
5489
|
+
imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): ImageModelV2;
|
|
5490
|
+
transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['transcriptionModel']>>[0]>}` : never): TranscriptionModelV2;
|
|
5491
|
+
transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): TranscriptionModelV2;
|
|
5492
|
+
speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['speechModel']>>[0]>}` : never): SpeechModelV2;
|
|
5493
|
+
speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): SpeechModelV2;
|
|
6414
5494
|
}
|
|
6415
5495
|
|
|
6416
5496
|
/**
|
|
@@ -6468,61 +5548,6 @@ declare interface ProviderV2 {
|
|
|
6468
5548
|
speechModel?(modelId: string): SpeechModelV2;
|
|
6469
5549
|
}
|
|
6470
5550
|
|
|
6471
|
-
/**
|
|
6472
|
-
* Provider for language, text embedding, and image generation models.
|
|
6473
|
-
*/
|
|
6474
|
-
declare interface ProviderV2_2 {
|
|
6475
|
-
/**
|
|
6476
|
-
Returns the language model with the given id.
|
|
6477
|
-
The model id is then passed to the provider function to get the model.
|
|
6478
|
-
|
|
6479
|
-
@param {string} modelId - The id of the model to return.
|
|
6480
|
-
|
|
6481
|
-
@returns {LanguageModel} The language model associated with the id
|
|
6482
|
-
|
|
6483
|
-
@throws {NoSuchModelError} If no such model exists.
|
|
6484
|
-
*/
|
|
6485
|
-
languageModel(modelId: string): LanguageModelV2_2;
|
|
6486
|
-
/**
|
|
6487
|
-
Returns the text embedding model with the given id.
|
|
6488
|
-
The model id is then passed to the provider function to get the model.
|
|
6489
|
-
|
|
6490
|
-
@param {string} modelId - The id of the model to return.
|
|
6491
|
-
|
|
6492
|
-
@returns {LanguageModel} The language model associated with the id
|
|
6493
|
-
|
|
6494
|
-
@throws {NoSuchModelError} If no such model exists.
|
|
6495
|
-
*/
|
|
6496
|
-
textEmbeddingModel(modelId: string): EmbeddingModelV2_2<string>;
|
|
6497
|
-
/**
|
|
6498
|
-
Returns the image model with the given id.
|
|
6499
|
-
The model id is then passed to the provider function to get the model.
|
|
6500
|
-
|
|
6501
|
-
@param {string} modelId - The id of the model to return.
|
|
6502
|
-
|
|
6503
|
-
@returns {ImageModel} The image model associated with the id
|
|
6504
|
-
*/
|
|
6505
|
-
imageModel(modelId: string): ImageModelV2_2;
|
|
6506
|
-
/**
|
|
6507
|
-
Returns the transcription model with the given id.
|
|
6508
|
-
The model id is then passed to the provider function to get the model.
|
|
6509
|
-
|
|
6510
|
-
@param {string} modelId - The id of the model to return.
|
|
6511
|
-
|
|
6512
|
-
@returns {TranscriptionModel} The transcription model associated with the id
|
|
6513
|
-
*/
|
|
6514
|
-
transcriptionModel?(modelId: string): TranscriptionModelV2_2;
|
|
6515
|
-
/**
|
|
6516
|
-
Returns the speech model with the given id.
|
|
6517
|
-
The model id is then passed to the provider function to get the model.
|
|
6518
|
-
|
|
6519
|
-
@param {string} modelId - The id of the model to return.
|
|
6520
|
-
|
|
6521
|
-
@returns {SpeechModel} The speech model associated with the id
|
|
6522
|
-
*/
|
|
6523
|
-
speechModel?(modelId: string): SpeechModelV2_2;
|
|
6524
|
-
}
|
|
6525
|
-
|
|
6526
5551
|
/**
|
|
6527
5552
|
* Prunes model messages from a list of model messages.
|
|
6528
5553
|
*
|
|
@@ -6543,6 +5568,25 @@ export declare function pruneMessages({ messages, reasoning, toolCalls, emptyMes
|
|
|
6543
5568
|
emptyMessages?: 'keep' | 'remove';
|
|
6544
5569
|
}): ModelMessage[];
|
|
6545
5570
|
|
|
5571
|
+
/**
|
|
5572
|
+
* Reads a fetch Response body with a size limit to prevent memory exhaustion.
|
|
5573
|
+
*
|
|
5574
|
+
* Checks the Content-Length header for early rejection, then reads the body
|
|
5575
|
+
* incrementally via ReadableStream and aborts with a DownloadError when the
|
|
5576
|
+
* limit is exceeded.
|
|
5577
|
+
*
|
|
5578
|
+
* @param response - The fetch Response to read.
|
|
5579
|
+
* @param url - The URL being downloaded (used in error messages).
|
|
5580
|
+
* @param maxBytes - Maximum allowed bytes. Defaults to DEFAULT_MAX_DOWNLOAD_SIZE.
|
|
5581
|
+
* @returns A Uint8Array containing the response body.
|
|
5582
|
+
* @throws DownloadError if the response exceeds maxBytes.
|
|
5583
|
+
*/
|
|
5584
|
+
declare function readResponseWithSizeLimit({ response, url, maxBytes, }: {
|
|
5585
|
+
response: Response;
|
|
5586
|
+
url: string;
|
|
5587
|
+
maxBytes?: number;
|
|
5588
|
+
}): Promise<Uint8Array>;
|
|
5589
|
+
|
|
6546
5590
|
/**
|
|
6547
5591
|
* Transforms a stream of `UIMessageChunk`s into an `AsyncIterableStream` of `UIMessage`s.
|
|
6548
5592
|
*
|
|
@@ -6657,7 +5701,7 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
|
|
|
6657
5701
|
declare type ResponseMessage = AssistantModelMessage | ToolModelMessage;
|
|
6658
5702
|
|
|
6659
5703
|
export declare class RetryError extends AISDKError {
|
|
6660
|
-
private readonly [symbol$
|
|
5704
|
+
private readonly [symbol$1_2];
|
|
6661
5705
|
readonly reason: RetryErrorReason;
|
|
6662
5706
|
readonly lastError: unknown;
|
|
6663
5707
|
readonly errors: Array<unknown>;
|
|
@@ -6713,7 +5757,7 @@ declare function safeValidateTypes<OBJECT>({ value, schema, }: {
|
|
|
6713
5757
|
rawValue: unknown;
|
|
6714
5758
|
} | {
|
|
6715
5759
|
success: false;
|
|
6716
|
-
error:
|
|
5760
|
+
error: TypeValidationError;
|
|
6717
5761
|
rawValue: unknown;
|
|
6718
5762
|
}>;
|
|
6719
5763
|
|
|
@@ -6770,8 +5814,6 @@ export declare class SerialJobExecutor {
|
|
|
6770
5814
|
|
|
6771
5815
|
declare type SharedV2Headers = Record<string, string>;
|
|
6772
5816
|
|
|
6773
|
-
declare type SharedV2Headers_2 = Record<string, string>;
|
|
6774
|
-
|
|
6775
5817
|
/**
|
|
6776
5818
|
* Additional provider-specific metadata.
|
|
6777
5819
|
* Metadata are additional outputs from the provider.
|
|
@@ -6795,29 +5837,6 @@ declare type SharedV2Headers_2 = Record<string, string>;
|
|
|
6795
5837
|
*/
|
|
6796
5838
|
declare type SharedV2ProviderMetadata = Record<string, Record<string, JSONValue_2>>;
|
|
6797
5839
|
|
|
6798
|
-
/**
|
|
6799
|
-
* Additional provider-specific metadata.
|
|
6800
|
-
* Metadata are additional outputs from the provider.
|
|
6801
|
-
* They are passed through to the provider from the AI SDK
|
|
6802
|
-
* and enable provider-specific functionality
|
|
6803
|
-
* that can be fully encapsulated in the provider.
|
|
6804
|
-
*
|
|
6805
|
-
* This enables us to quickly ship provider-specific functionality
|
|
6806
|
-
* without affecting the core AI SDK.
|
|
6807
|
-
*
|
|
6808
|
-
* The outer record is keyed by the provider name, and the inner
|
|
6809
|
-
* record is keyed by the provider-specific metadata key.
|
|
6810
|
-
*
|
|
6811
|
-
* ```ts
|
|
6812
|
-
* {
|
|
6813
|
-
* "anthropic": {
|
|
6814
|
-
* "cacheControl": { "type": "ephemeral" }
|
|
6815
|
-
* }
|
|
6816
|
-
* }
|
|
6817
|
-
* ```
|
|
6818
|
-
*/
|
|
6819
|
-
declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValue_3>>;
|
|
6820
|
-
|
|
6821
5840
|
/**
|
|
6822
5841
|
* Additional provider-specific options.
|
|
6823
5842
|
* Options are additional input to the provider.
|
|
@@ -6841,29 +5860,6 @@ declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValu
|
|
|
6841
5860
|
*/
|
|
6842
5861
|
declare type SharedV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
|
|
6843
5862
|
|
|
6844
|
-
/**
|
|
6845
|
-
* Additional provider-specific options.
|
|
6846
|
-
* Options are additional input to the provider.
|
|
6847
|
-
* They are passed through to the provider from the AI SDK
|
|
6848
|
-
* and enable provider-specific functionality
|
|
6849
|
-
* that can be fully encapsulated in the provider.
|
|
6850
|
-
*
|
|
6851
|
-
* This enables us to quickly ship provider-specific functionality
|
|
6852
|
-
* without affecting the core AI SDK.
|
|
6853
|
-
*
|
|
6854
|
-
* The outer record is keyed by the provider name, and the inner
|
|
6855
|
-
* record is keyed by the provider-specific metadata key.
|
|
6856
|
-
*
|
|
6857
|
-
* ```ts
|
|
6858
|
-
* {
|
|
6859
|
-
* "anthropic": {
|
|
6860
|
-
* "cacheControl": { "type": "ephemeral" }
|
|
6861
|
-
* }
|
|
6862
|
-
* }
|
|
6863
|
-
* ```
|
|
6864
|
-
*/
|
|
6865
|
-
declare type SharedV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
|
|
6866
|
-
|
|
6867
5863
|
/**
|
|
6868
5864
|
* Creates a ReadableStream that emits the provided values with an optional delay between each value.
|
|
6869
5865
|
*
|
|
@@ -6943,7 +5939,7 @@ declare type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
6943
5939
|
file: GeneratedFile;
|
|
6944
5940
|
} | {
|
|
6945
5941
|
type: 'stream-start';
|
|
6946
|
-
warnings:
|
|
5942
|
+
warnings: LanguageModelV2CallWarning[];
|
|
6947
5943
|
} | {
|
|
6948
5944
|
type: 'response-metadata';
|
|
6949
5945
|
id?: string;
|
|
@@ -6986,7 +5982,7 @@ export declare function smoothStream<TOOLS extends ToolSet>({ delayInMs, chunkin
|
|
|
6986
5982
|
/**
|
|
6987
5983
|
A source that has been used as input to generate the response.
|
|
6988
5984
|
*/
|
|
6989
|
-
declare type Source =
|
|
5985
|
+
declare type Source = LanguageModelV2Source;
|
|
6990
5986
|
|
|
6991
5987
|
/**
|
|
6992
5988
|
* A document source part of a message.
|
|
@@ -7019,6 +6015,8 @@ export declare type SourceUrlUIPart = {
|
|
|
7019
6015
|
* may have children.
|
|
7020
6016
|
*
|
|
7021
6017
|
* Spans are created by the {@link Tracer.startSpan} method.
|
|
6018
|
+
*
|
|
6019
|
+
* @since 1.0.0
|
|
7022
6020
|
*/
|
|
7023
6021
|
declare interface Span {
|
|
7024
6022
|
/**
|
|
@@ -7078,11 +6076,21 @@ declare interface Span {
|
|
|
7078
6076
|
*/
|
|
7079
6077
|
addLinks(links: Link[]): this;
|
|
7080
6078
|
/**
|
|
7081
|
-
* Sets
|
|
7082
|
-
*
|
|
7083
|
-
*
|
|
6079
|
+
* Sets the status of the span.
|
|
6080
|
+
*
|
|
6081
|
+
* By default, a span has status {@link SpanStatusCode.UNSET}.
|
|
6082
|
+
* Calling this method overrides that default.
|
|
6083
|
+
*
|
|
6084
|
+
* The status codes have a total order: `OK > ERROR > UNSET`.
|
|
7084
6085
|
*
|
|
7085
|
-
* @
|
|
6086
|
+
* - Once {@link SpanStatusCode.OK} is set, any further attempts to change
|
|
6087
|
+
* the status are ignored.
|
|
6088
|
+
* - Any attempt to set {@link SpanStatusCode.UNSET} is always ignored.
|
|
6089
|
+
*
|
|
6090
|
+
* The `message` field is only used when {@link SpanStatusCode.ERROR} is set.
|
|
6091
|
+
* For all other status codes, `message` is ignored.
|
|
6092
|
+
*
|
|
6093
|
+
* @param status The {@link SpanStatus} to set.
|
|
7086
6094
|
*/
|
|
7087
6095
|
setStatus(status: SpanStatus): this;
|
|
7088
6096
|
/**
|
|
@@ -7127,17 +6135,21 @@ declare interface Span {
|
|
|
7127
6135
|
|
|
7128
6136
|
/**
|
|
7129
6137
|
* @deprecated please use {@link Attributes}
|
|
6138
|
+
* @since 1.0.0
|
|
7130
6139
|
*/
|
|
7131
6140
|
declare type SpanAttributes = Attributes;
|
|
7132
6141
|
|
|
7133
6142
|
/**
|
|
7134
6143
|
* @deprecated please use {@link AttributeValue}
|
|
6144
|
+
* @since 1.0.0
|
|
7135
6145
|
*/
|
|
7136
6146
|
declare type SpanAttributeValue = AttributeValue;
|
|
7137
6147
|
|
|
7138
6148
|
/**
|
|
7139
6149
|
* A SpanContext represents the portion of a {@link Span} which must be
|
|
7140
6150
|
* serialized and propagated along side of a {@link Baggage}.
|
|
6151
|
+
*
|
|
6152
|
+
* @since 1.0.0
|
|
7141
6153
|
*/
|
|
7142
6154
|
declare interface SpanContext {
|
|
7143
6155
|
/**
|
|
@@ -7187,6 +6199,9 @@ declare interface SpanContext {
|
|
|
7187
6199
|
traceState?: TraceState;
|
|
7188
6200
|
}
|
|
7189
6201
|
|
|
6202
|
+
/**
|
|
6203
|
+
* @since 1.0.0
|
|
6204
|
+
*/
|
|
7190
6205
|
declare enum SpanKind {
|
|
7191
6206
|
/** Default value. Indicates that the span is used internally. */
|
|
7192
6207
|
INTERNAL = 0,
|
|
@@ -7216,6 +6231,8 @@ declare enum SpanKind {
|
|
|
7216
6231
|
|
|
7217
6232
|
/**
|
|
7218
6233
|
* Options needed for span creation
|
|
6234
|
+
*
|
|
6235
|
+
* @since 1.0.0
|
|
7219
6236
|
*/
|
|
7220
6237
|
declare interface SpanOptions {
|
|
7221
6238
|
/**
|
|
@@ -7224,7 +6241,7 @@ declare interface SpanOptions {
|
|
|
7224
6241
|
*/
|
|
7225
6242
|
kind?: SpanKind;
|
|
7226
6243
|
/** A span's attributes */
|
|
7227
|
-
attributes?:
|
|
6244
|
+
attributes?: Attributes;
|
|
7228
6245
|
/** {@link Link}s span to other spans */
|
|
7229
6246
|
links?: Link[];
|
|
7230
6247
|
/** A manually specified start time for the created `Span` object. */
|
|
@@ -7233,6 +6250,9 @@ declare interface SpanOptions {
|
|
|
7233
6250
|
root?: boolean;
|
|
7234
6251
|
}
|
|
7235
6252
|
|
|
6253
|
+
/**
|
|
6254
|
+
* @since 1.0.0
|
|
6255
|
+
*/
|
|
7236
6256
|
declare interface SpanStatus {
|
|
7237
6257
|
/** The status code of this message. */
|
|
7238
6258
|
code: SpanStatusCode;
|
|
@@ -7242,6 +6262,8 @@ declare interface SpanStatus {
|
|
|
7242
6262
|
|
|
7243
6263
|
/**
|
|
7244
6264
|
* An enumeration of status codes.
|
|
6265
|
+
*
|
|
6266
|
+
* @since 1.0.0
|
|
7245
6267
|
*/
|
|
7246
6268
|
declare enum SpanStatusCode {
|
|
7247
6269
|
/**
|
|
@@ -7262,7 +6284,7 @@ declare enum SpanStatusCode {
|
|
|
7262
6284
|
/**
|
|
7263
6285
|
Speech model that is used by the AI SDK Core functions.
|
|
7264
6286
|
*/
|
|
7265
|
-
export declare type SpeechModel =
|
|
6287
|
+
export declare type SpeechModel = SpeechModelV2;
|
|
7266
6288
|
|
|
7267
6289
|
export declare type SpeechModelResponseMetadata = {
|
|
7268
6290
|
/**
|
|
@@ -7270,98 +6292,23 @@ export declare type SpeechModelResponseMetadata = {
|
|
|
7270
6292
|
*/
|
|
7271
6293
|
timestamp: Date;
|
|
7272
6294
|
/**
|
|
7273
|
-
The ID of the response model that was used to generate the response.
|
|
7274
|
-
*/
|
|
7275
|
-
modelId: string;
|
|
7276
|
-
/**
|
|
7277
|
-
Response headers.
|
|
7278
|
-
*/
|
|
7279
|
-
headers?: Record<string, string>;
|
|
7280
|
-
/**
|
|
7281
|
-
Response body.
|
|
7282
|
-
*/
|
|
7283
|
-
body?: unknown;
|
|
7284
|
-
};
|
|
7285
|
-
|
|
7286
|
-
/**
|
|
7287
|
-
* Speech model specification version 2.
|
|
7288
|
-
*/
|
|
7289
|
-
declare type SpeechModelV2 = {
|
|
7290
|
-
/**
|
|
7291
|
-
* The speech model must specify which speech model interface
|
|
7292
|
-
* version it implements. This will allow us to evolve the speech
|
|
7293
|
-
* model interface and retain backwards compatibility. The different
|
|
7294
|
-
* implementation versions can be handled as a discriminated union
|
|
7295
|
-
* on our side.
|
|
7296
|
-
*/
|
|
7297
|
-
readonly specificationVersion: 'v2';
|
|
7298
|
-
/**
|
|
7299
|
-
* Name of the provider for logging purposes.
|
|
7300
|
-
*/
|
|
7301
|
-
readonly provider: string;
|
|
7302
|
-
/**
|
|
7303
|
-
* Provider-specific model ID for logging purposes.
|
|
7304
|
-
*/
|
|
7305
|
-
readonly modelId: string;
|
|
7306
|
-
/**
|
|
7307
|
-
* Generates speech audio from text.
|
|
7308
|
-
*/
|
|
7309
|
-
doGenerate(options: SpeechModelV2CallOptions): PromiseLike<{
|
|
7310
|
-
/**
|
|
7311
|
-
* Generated audio as an ArrayBuffer.
|
|
7312
|
-
* The audio should be returned without any unnecessary conversion.
|
|
7313
|
-
* If the API returns base64 encoded strings, the audio should be returned
|
|
7314
|
-
* as base64 encoded strings. If the API returns binary data, the audio
|
|
7315
|
-
* should be returned as binary data.
|
|
7316
|
-
*/
|
|
7317
|
-
audio: string | Uint8Array;
|
|
7318
|
-
/**
|
|
7319
|
-
* Warnings for the call, e.g. unsupported settings.
|
|
7320
|
-
*/
|
|
7321
|
-
warnings: Array<SpeechModelV2CallWarning>;
|
|
7322
|
-
/**
|
|
7323
|
-
* Optional request information for telemetry and debugging purposes.
|
|
7324
|
-
*/
|
|
7325
|
-
request?: {
|
|
7326
|
-
/**
|
|
7327
|
-
* Response body (available only for providers that use HTTP requests).
|
|
7328
|
-
*/
|
|
7329
|
-
body?: unknown;
|
|
7330
|
-
};
|
|
7331
|
-
/**
|
|
7332
|
-
* Response information for telemetry and debugging purposes.
|
|
7333
|
-
*/
|
|
7334
|
-
response: {
|
|
7335
|
-
/**
|
|
7336
|
-
* Timestamp for the start of the generated response.
|
|
7337
|
-
*/
|
|
7338
|
-
timestamp: Date;
|
|
7339
|
-
/**
|
|
7340
|
-
* The ID of the response model that was used to generate the response.
|
|
7341
|
-
*/
|
|
7342
|
-
modelId: string;
|
|
7343
|
-
/**
|
|
7344
|
-
* Response headers.
|
|
7345
|
-
*/
|
|
7346
|
-
headers?: SharedV2Headers;
|
|
7347
|
-
/**
|
|
7348
|
-
* Response body.
|
|
7349
|
-
*/
|
|
7350
|
-
body?: unknown;
|
|
7351
|
-
};
|
|
7352
|
-
/**
|
|
7353
|
-
* Additional provider-specific metadata. They are passed through
|
|
7354
|
-
* from the provider to the AI SDK and enable provider-specific
|
|
7355
|
-
* results that can be fully encapsulated in the provider.
|
|
7356
|
-
*/
|
|
7357
|
-
providerMetadata?: Record<string, Record<string, JSONValue_2>>;
|
|
7358
|
-
}>;
|
|
6295
|
+
The ID of the response model that was used to generate the response.
|
|
6296
|
+
*/
|
|
6297
|
+
modelId: string;
|
|
6298
|
+
/**
|
|
6299
|
+
Response headers.
|
|
6300
|
+
*/
|
|
6301
|
+
headers?: Record<string, string>;
|
|
6302
|
+
/**
|
|
6303
|
+
Response body.
|
|
6304
|
+
*/
|
|
6305
|
+
body?: unknown;
|
|
7359
6306
|
};
|
|
7360
6307
|
|
|
7361
6308
|
/**
|
|
7362
6309
|
* Speech model specification version 2.
|
|
7363
6310
|
*/
|
|
7364
|
-
declare type
|
|
6311
|
+
declare type SpeechModelV2 = {
|
|
7365
6312
|
/**
|
|
7366
6313
|
* The speech model must specify which speech model interface
|
|
7367
6314
|
* version it implements. This will allow us to evolve the speech
|
|
@@ -7381,7 +6328,7 @@ declare type SpeechModelV2_2 = {
|
|
|
7381
6328
|
/**
|
|
7382
6329
|
* Generates speech audio from text.
|
|
7383
6330
|
*/
|
|
7384
|
-
doGenerate(options:
|
|
6331
|
+
doGenerate(options: SpeechModelV2CallOptions): PromiseLike<{
|
|
7385
6332
|
/**
|
|
7386
6333
|
* Generated audio as an ArrayBuffer.
|
|
7387
6334
|
* The audio should be returned without any unnecessary conversion.
|
|
@@ -7393,7 +6340,7 @@ declare type SpeechModelV2_2 = {
|
|
|
7393
6340
|
/**
|
|
7394
6341
|
* Warnings for the call, e.g. unsupported settings.
|
|
7395
6342
|
*/
|
|
7396
|
-
warnings: Array<
|
|
6343
|
+
warnings: Array<SpeechModelV2CallWarning>;
|
|
7397
6344
|
/**
|
|
7398
6345
|
* Optional request information for telemetry and debugging purposes.
|
|
7399
6346
|
*/
|
|
@@ -7418,7 +6365,7 @@ declare type SpeechModelV2_2 = {
|
|
|
7418
6365
|
/**
|
|
7419
6366
|
* Response headers.
|
|
7420
6367
|
*/
|
|
7421
|
-
headers?:
|
|
6368
|
+
headers?: SharedV2Headers;
|
|
7422
6369
|
/**
|
|
7423
6370
|
* Response body.
|
|
7424
6371
|
*/
|
|
@@ -7429,7 +6376,7 @@ declare type SpeechModelV2_2 = {
|
|
|
7429
6376
|
* from the provider to the AI SDK and enable provider-specific
|
|
7430
6377
|
* results that can be fully encapsulated in the provider.
|
|
7431
6378
|
*/
|
|
7432
|
-
providerMetadata?: Record<string, Record<string,
|
|
6379
|
+
providerMetadata?: Record<string, Record<string, JSONValue_2>>;
|
|
7433
6380
|
}>;
|
|
7434
6381
|
};
|
|
7435
6382
|
|
|
@@ -7484,57 +6431,6 @@ declare type SpeechModelV2CallOptions = {
|
|
|
7484
6431
|
headers?: Record<string, string | undefined>;
|
|
7485
6432
|
};
|
|
7486
6433
|
|
|
7487
|
-
declare type SpeechModelV2CallOptions_2 = {
|
|
7488
|
-
/**
|
|
7489
|
-
* Text to convert to speech.
|
|
7490
|
-
*/
|
|
7491
|
-
text: string;
|
|
7492
|
-
/**
|
|
7493
|
-
* The voice to use for speech synthesis.
|
|
7494
|
-
* This is provider-specific and may be a voice ID, name, or other identifier.
|
|
7495
|
-
*/
|
|
7496
|
-
voice?: string;
|
|
7497
|
-
/**
|
|
7498
|
-
* The desired output format for the audio e.g. "mp3", "wav", etc.
|
|
7499
|
-
*/
|
|
7500
|
-
outputFormat?: string;
|
|
7501
|
-
/**
|
|
7502
|
-
* Instructions for the speech generation e.g. "Speak in a slow and steady tone".
|
|
7503
|
-
*/
|
|
7504
|
-
instructions?: string;
|
|
7505
|
-
/**
|
|
7506
|
-
* The speed of the speech generation.
|
|
7507
|
-
*/
|
|
7508
|
-
speed?: number;
|
|
7509
|
-
/**
|
|
7510
|
-
* The language for speech generation. This should be an ISO 639-1 language code (e.g. "en", "es", "fr")
|
|
7511
|
-
* or "auto" for automatic language detection. Provider support varies.
|
|
7512
|
-
*/
|
|
7513
|
-
language?: string;
|
|
7514
|
-
/**
|
|
7515
|
-
* Additional provider-specific options that are passed through to the provider
|
|
7516
|
-
* as body parameters.
|
|
7517
|
-
*
|
|
7518
|
-
* The outer record is keyed by the provider name, and the inner
|
|
7519
|
-
* record is keyed by the provider-specific metadata key.
|
|
7520
|
-
* ```ts
|
|
7521
|
-
* {
|
|
7522
|
-
* "openai": {}
|
|
7523
|
-
* }
|
|
7524
|
-
* ```
|
|
7525
|
-
*/
|
|
7526
|
-
providerOptions?: SpeechModelV2ProviderOptions_2;
|
|
7527
|
-
/**
|
|
7528
|
-
* Abort signal for cancelling the operation.
|
|
7529
|
-
*/
|
|
7530
|
-
abortSignal?: AbortSignal;
|
|
7531
|
-
/**
|
|
7532
|
-
* Additional HTTP headers to be sent with the request.
|
|
7533
|
-
* Only applicable for HTTP-based providers.
|
|
7534
|
-
*/
|
|
7535
|
-
headers?: Record<string, string | undefined>;
|
|
7536
|
-
};
|
|
7537
|
-
|
|
7538
6434
|
/**
|
|
7539
6435
|
* Warning from the model provider for this call. The call will proceed, but e.g.
|
|
7540
6436
|
* some settings might not be supported, which can lead to suboptimal results.
|
|
@@ -7548,28 +6444,13 @@ declare type SpeechModelV2CallWarning = {
|
|
|
7548
6444
|
message: string;
|
|
7549
6445
|
};
|
|
7550
6446
|
|
|
7551
|
-
/**
|
|
7552
|
-
* Warning from the model provider for this call. The call will proceed, but e.g.
|
|
7553
|
-
* some settings might not be supported, which can lead to suboptimal results.
|
|
7554
|
-
*/
|
|
7555
|
-
declare type SpeechModelV2CallWarning_2 = {
|
|
7556
|
-
type: 'unsupported-setting';
|
|
7557
|
-
setting: keyof SpeechModelV2CallOptions_2;
|
|
7558
|
-
details?: string;
|
|
7559
|
-
} | {
|
|
7560
|
-
type: 'other';
|
|
7561
|
-
message: string;
|
|
7562
|
-
};
|
|
7563
|
-
|
|
7564
6447
|
declare type SpeechModelV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
|
|
7565
6448
|
|
|
7566
|
-
declare type SpeechModelV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
|
|
7567
|
-
|
|
7568
6449
|
/**
|
|
7569
6450
|
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
7570
6451
|
some settings might not be supported, which can lead to suboptimal results.
|
|
7571
6452
|
*/
|
|
7572
|
-
export declare type SpeechWarning =
|
|
6453
|
+
export declare type SpeechWarning = SpeechModelV2CallWarning;
|
|
7573
6454
|
|
|
7574
6455
|
/** The Standard JSON Schema interface. */
|
|
7575
6456
|
declare interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
|
|
@@ -7902,7 +6783,7 @@ export declare type StopCondition<TOOLS extends ToolSet> = (options: {
|
|
|
7902
6783
|
@returns
|
|
7903
6784
|
A result object for accessing the partial object stream and additional information.
|
|
7904
6785
|
*/
|
|
7905
|
-
export declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<
|
|
6786
|
+
export declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue_2>, OUTPUT extends 'object' | 'array' | 'enum' | 'no-schema' = InferSchema<SCHEMA> extends string ? 'enum' : 'object', RESULT = OUTPUT extends 'array' ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>>(options: Omit<CallSettings, 'stopSequences'> & Prompt & (OUTPUT extends 'enum' ? {
|
|
7906
6787
|
/**
|
|
7907
6788
|
The enum values that the model should use.
|
|
7908
6789
|
*/
|
|
@@ -8107,19 +6988,19 @@ declare interface StreamOptions {
|
|
|
8107
6988
|
*
|
|
8108
6989
|
* @defaultValue `undefined`
|
|
8109
6990
|
*/
|
|
8110
|
-
onError?: (
|
|
6991
|
+
onError?: ("terminate" | ((error: Error) => void)) | undefined;
|
|
8111
6992
|
/**
|
|
8112
6993
|
* Callback for when a reconnection interval is sent from the server.
|
|
8113
6994
|
*
|
|
8114
6995
|
* @param retry - The number of milliseconds to wait before reconnecting.
|
|
8115
6996
|
*/
|
|
8116
|
-
onRetry?: ((retry: number) => void) | undefined
|
|
6997
|
+
onRetry?: ((retry: number) => void) | undefined;
|
|
8117
6998
|
/**
|
|
8118
6999
|
* Callback for when a comment is encountered in the stream.
|
|
8119
7000
|
*
|
|
8120
7001
|
* @param comment - The comment encountered in the stream.
|
|
8121
7002
|
*/
|
|
8122
|
-
onComment?: ((comment: string) => void) | undefined
|
|
7003
|
+
onComment?: ((comment: string) => void) | undefined;
|
|
8123
7004
|
}
|
|
8124
7005
|
|
|
8125
7006
|
/**
|
|
@@ -8170,7 +7051,7 @@ declare interface StreamOptions {
|
|
|
8170
7051
|
@return
|
|
8171
7052
|
A result object for accessing different stream types and additional information.
|
|
8172
7053
|
*/
|
|
8173
|
-
export declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, 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_context, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
|
7054
|
+
export declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, allowSystemInMessages, maxRetries, abortSignal, 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_context, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
|
8174
7055
|
/**
|
|
8175
7056
|
The language model to use.
|
|
8176
7057
|
*/
|
|
@@ -8556,8 +7437,6 @@ declare const symbol$1: unique symbol;
|
|
|
8556
7437
|
|
|
8557
7438
|
declare const symbol$1_2: unique symbol;
|
|
8558
7439
|
|
|
8559
|
-
declare const symbol$1_3: unique symbol;
|
|
8560
|
-
|
|
8561
7440
|
declare const symbol$2: unique symbol;
|
|
8562
7441
|
|
|
8563
7442
|
declare const symbol$2_2: unique symbol;
|
|
@@ -8582,8 +7461,6 @@ declare const symbol$7: unique symbol;
|
|
|
8582
7461
|
|
|
8583
7462
|
declare const symbol$7_2: unique symbol;
|
|
8584
7463
|
|
|
8585
|
-
declare const symbol$7_3: unique symbol;
|
|
8586
|
-
|
|
8587
7464
|
declare const symbol$8: unique symbol;
|
|
8588
7465
|
|
|
8589
7466
|
declare const symbol$8_2: unique symbol;
|
|
@@ -8604,20 +7481,18 @@ declare const symbol$c: unique symbol;
|
|
|
8604
7481
|
|
|
8605
7482
|
declare const symbol$c_2: unique symbol;
|
|
8606
7483
|
|
|
8607
|
-
declare const symbol$c_3: unique symbol;
|
|
8608
|
-
|
|
8609
7484
|
declare const symbol$d: unique symbol;
|
|
8610
7485
|
|
|
8611
7486
|
declare const symbol$d_2: unique symbol;
|
|
8612
7487
|
|
|
8613
|
-
declare const symbol$d_3: unique symbol;
|
|
8614
|
-
|
|
8615
7488
|
declare const symbol$e: unique symbol;
|
|
8616
7489
|
|
|
8617
7490
|
declare const symbol: unique symbol;
|
|
8618
7491
|
|
|
8619
7492
|
declare const symbol_2: unique symbol;
|
|
8620
7493
|
|
|
7494
|
+
declare const symbol_3: unique symbol;
|
|
7495
|
+
|
|
8621
7496
|
/**
|
|
8622
7497
|
A system message. It can contain system information.
|
|
8623
7498
|
|
|
@@ -8798,6 +7673,8 @@ export declare type TextUIPart = {
|
|
|
8798
7673
|
* Defines TimeInput.
|
|
8799
7674
|
*
|
|
8800
7675
|
* hrtime, epoch milliseconds, performance.now() or Date
|
|
7676
|
+
*
|
|
7677
|
+
* @since 1.0.0
|
|
8801
7678
|
*/
|
|
8802
7679
|
declare type TimeInput = HrTime | number | Date;
|
|
8803
7680
|
|
|
@@ -9002,13 +7879,13 @@ export declare class ToolCallRepairError extends AISDKError {
|
|
|
9002
7879
|
export declare type ToolCallRepairFunction<TOOLS extends ToolSet> = (options: {
|
|
9003
7880
|
system: string | undefined;
|
|
9004
7881
|
messages: ModelMessage[];
|
|
9005
|
-
toolCall:
|
|
7882
|
+
toolCall: LanguageModelV2ToolCall;
|
|
9006
7883
|
tools: TOOLS;
|
|
9007
7884
|
inputSchema: (options: {
|
|
9008
7885
|
toolName: string;
|
|
9009
7886
|
}) => JSONSchema7;
|
|
9010
7887
|
error: NoSuchToolError | InvalidToolInputError;
|
|
9011
|
-
}) => Promise<
|
|
7888
|
+
}) => Promise<LanguageModelV2ToolCall | null>;
|
|
9012
7889
|
|
|
9013
7890
|
/**
|
|
9014
7891
|
Tool choice for the generation. It supports the following settings:
|
|
@@ -9142,6 +8019,8 @@ export declare class TooManyEmbeddingValuesForCallError extends AISDKError {
|
|
|
9142
8019
|
|
|
9143
8020
|
/**
|
|
9144
8021
|
* Tracer provides an interface for creating {@link Span}s.
|
|
8022
|
+
*
|
|
8023
|
+
* @since 1.0.0
|
|
9145
8024
|
*/
|
|
9146
8025
|
declare interface Tracer {
|
|
9147
8026
|
/**
|
|
@@ -9208,6 +8087,9 @@ declare interface Tracer {
|
|
|
9208
8087
|
startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
|
|
9209
8088
|
}
|
|
9210
8089
|
|
|
8090
|
+
/**
|
|
8091
|
+
* @since 1.0.0
|
|
8092
|
+
*/
|
|
9211
8093
|
declare interface TraceState {
|
|
9212
8094
|
/**
|
|
9213
8095
|
* Create a new TraceState which inherits from this TraceState and has the
|
|
@@ -9249,7 +8131,7 @@ declare interface TraceState {
|
|
|
9249
8131
|
/**
|
|
9250
8132
|
Transcription model that is used by the AI SDK Core functions.
|
|
9251
8133
|
*/
|
|
9252
|
-
export declare type TranscriptionModel =
|
|
8134
|
+
export declare type TranscriptionModel = TranscriptionModelV2;
|
|
9253
8135
|
|
|
9254
8136
|
export declare type TranscriptionModelResponseMetadata = {
|
|
9255
8137
|
/**
|
|
@@ -9366,106 +8248,6 @@ declare type TranscriptionModelV2 = {
|
|
|
9366
8248
|
}>;
|
|
9367
8249
|
};
|
|
9368
8250
|
|
|
9369
|
-
/**
|
|
9370
|
-
Transcription model specification version 2.
|
|
9371
|
-
*/
|
|
9372
|
-
declare type TranscriptionModelV2_2 = {
|
|
9373
|
-
/**
|
|
9374
|
-
The transcription model must specify which transcription model interface
|
|
9375
|
-
version it implements. This will allow us to evolve the transcription
|
|
9376
|
-
model interface and retain backwards compatibility. The different
|
|
9377
|
-
implementation versions can be handled as a discriminated union
|
|
9378
|
-
on our side.
|
|
9379
|
-
*/
|
|
9380
|
-
readonly specificationVersion: 'v2';
|
|
9381
|
-
/**
|
|
9382
|
-
Name of the provider for logging purposes.
|
|
9383
|
-
*/
|
|
9384
|
-
readonly provider: string;
|
|
9385
|
-
/**
|
|
9386
|
-
Provider-specific model ID for logging purposes.
|
|
9387
|
-
*/
|
|
9388
|
-
readonly modelId: string;
|
|
9389
|
-
/**
|
|
9390
|
-
Generates a transcript.
|
|
9391
|
-
*/
|
|
9392
|
-
doGenerate(options: TranscriptionModelV2CallOptions_2): PromiseLike<{
|
|
9393
|
-
/**
|
|
9394
|
-
* The complete transcribed text from the audio.
|
|
9395
|
-
*/
|
|
9396
|
-
text: string;
|
|
9397
|
-
/**
|
|
9398
|
-
* Array of transcript segments with timing information.
|
|
9399
|
-
* Each segment represents a portion of the transcribed text with start and end times.
|
|
9400
|
-
*/
|
|
9401
|
-
segments: Array<{
|
|
9402
|
-
/**
|
|
9403
|
-
* The text content of this segment.
|
|
9404
|
-
*/
|
|
9405
|
-
text: string;
|
|
9406
|
-
/**
|
|
9407
|
-
* The start time of this segment in seconds.
|
|
9408
|
-
*/
|
|
9409
|
-
startSecond: number;
|
|
9410
|
-
/**
|
|
9411
|
-
* The end time of this segment in seconds.
|
|
9412
|
-
*/
|
|
9413
|
-
endSecond: number;
|
|
9414
|
-
}>;
|
|
9415
|
-
/**
|
|
9416
|
-
* The detected language of the audio content, as an ISO-639-1 code (e.g., 'en' for English).
|
|
9417
|
-
* May be undefined if the language couldn't be detected.
|
|
9418
|
-
*/
|
|
9419
|
-
language: string | undefined;
|
|
9420
|
-
/**
|
|
9421
|
-
* The total duration of the audio file in seconds.
|
|
9422
|
-
* May be undefined if the duration couldn't be determined.
|
|
9423
|
-
*/
|
|
9424
|
-
durationInSeconds: number | undefined;
|
|
9425
|
-
/**
|
|
9426
|
-
Warnings for the call, e.g. unsupported settings.
|
|
9427
|
-
*/
|
|
9428
|
-
warnings: Array<TranscriptionModelV2CallWarning_2>;
|
|
9429
|
-
/**
|
|
9430
|
-
Optional request information for telemetry and debugging purposes.
|
|
9431
|
-
*/
|
|
9432
|
-
request?: {
|
|
9433
|
-
/**
|
|
9434
|
-
Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
|
|
9435
|
-
Non-HTTP(s) providers should not set this.
|
|
9436
|
-
*/
|
|
9437
|
-
body?: string;
|
|
9438
|
-
};
|
|
9439
|
-
/**
|
|
9440
|
-
Response information for telemetry and debugging purposes.
|
|
9441
|
-
*/
|
|
9442
|
-
response: {
|
|
9443
|
-
/**
|
|
9444
|
-
Timestamp for the start of the generated response.
|
|
9445
|
-
*/
|
|
9446
|
-
timestamp: Date;
|
|
9447
|
-
/**
|
|
9448
|
-
The ID of the response model that was used to generate the response.
|
|
9449
|
-
*/
|
|
9450
|
-
modelId: string;
|
|
9451
|
-
/**
|
|
9452
|
-
Response headers.
|
|
9453
|
-
*/
|
|
9454
|
-
headers?: SharedV2Headers_2;
|
|
9455
|
-
/**
|
|
9456
|
-
Response body.
|
|
9457
|
-
*/
|
|
9458
|
-
body?: unknown;
|
|
9459
|
-
};
|
|
9460
|
-
/**
|
|
9461
|
-
Additional provider-specific metadata. They are passed through
|
|
9462
|
-
from the provider to the AI SDK and enable provider-specific
|
|
9463
|
-
results that can be fully encapsulated in the provider.
|
|
9464
|
-
*/
|
|
9465
|
-
providerMetadata?: Record<string, Record<string, JSONValue_3>>;
|
|
9466
|
-
}>;
|
|
9467
|
-
};
|
|
9468
|
-
|
|
9469
8251
|
declare type TranscriptionModelV2CallOptions = {
|
|
9470
8252
|
/**
|
|
9471
8253
|
Audio data to transcribe.
|
|
@@ -9504,44 +8286,6 @@ declare type TranscriptionModelV2CallOptions = {
|
|
|
9504
8286
|
headers?: Record<string, string | undefined>;
|
|
9505
8287
|
};
|
|
9506
8288
|
|
|
9507
|
-
declare type TranscriptionModelV2CallOptions_2 = {
|
|
9508
|
-
/**
|
|
9509
|
-
Audio data to transcribe.
|
|
9510
|
-
Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file.
|
|
9511
|
-
*/
|
|
9512
|
-
audio: Uint8Array | string;
|
|
9513
|
-
/**
|
|
9514
|
-
The IANA media type of the audio data.
|
|
9515
|
-
|
|
9516
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
9517
|
-
*/
|
|
9518
|
-
mediaType: string;
|
|
9519
|
-
/**
|
|
9520
|
-
Additional provider-specific options that are passed through to the provider
|
|
9521
|
-
as body parameters.
|
|
9522
|
-
|
|
9523
|
-
The outer record is keyed by the provider name, and the inner
|
|
9524
|
-
record is keyed by the provider-specific metadata key.
|
|
9525
|
-
```ts
|
|
9526
|
-
{
|
|
9527
|
-
"openai": {
|
|
9528
|
-
"timestampGranularities": ["word"]
|
|
9529
|
-
}
|
|
9530
|
-
}
|
|
9531
|
-
```
|
|
9532
|
-
*/
|
|
9533
|
-
providerOptions?: TranscriptionModelV2ProviderOptions_2;
|
|
9534
|
-
/**
|
|
9535
|
-
Abort signal for cancelling the operation.
|
|
9536
|
-
*/
|
|
9537
|
-
abortSignal?: AbortSignal;
|
|
9538
|
-
/**
|
|
9539
|
-
Additional HTTP headers to be sent with the request.
|
|
9540
|
-
Only applicable for HTTP-based providers.
|
|
9541
|
-
*/
|
|
9542
|
-
headers?: Record<string, string | undefined>;
|
|
9543
|
-
};
|
|
9544
|
-
|
|
9545
8289
|
/**
|
|
9546
8290
|
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
9547
8291
|
some settings might not be supported, which can lead to suboptimal results.
|
|
@@ -9555,28 +8299,13 @@ declare type TranscriptionModelV2CallWarning = {
|
|
|
9555
8299
|
message: string;
|
|
9556
8300
|
};
|
|
9557
8301
|
|
|
9558
|
-
/**
|
|
9559
|
-
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
9560
|
-
some settings might not be supported, which can lead to suboptimal results.
|
|
9561
|
-
*/
|
|
9562
|
-
declare type TranscriptionModelV2CallWarning_2 = {
|
|
9563
|
-
type: 'unsupported-setting';
|
|
9564
|
-
setting: keyof TranscriptionModelV2CallOptions_2;
|
|
9565
|
-
details?: string;
|
|
9566
|
-
} | {
|
|
9567
|
-
type: 'other';
|
|
9568
|
-
message: string;
|
|
9569
|
-
};
|
|
9570
|
-
|
|
9571
8302
|
declare type TranscriptionModelV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
|
|
9572
8303
|
|
|
9573
|
-
declare type TranscriptionModelV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
|
|
9574
|
-
|
|
9575
8304
|
/**
|
|
9576
8305
|
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
9577
8306
|
some settings might not be supported, which can lead to suboptimal results.
|
|
9578
8307
|
*/
|
|
9579
|
-
export declare type TranscriptionWarning =
|
|
8308
|
+
export declare type TranscriptionWarning = TranscriptionModelV2CallWarning;
|
|
9580
8309
|
|
|
9581
8310
|
export declare type TypedToolCall<TOOLS extends ToolSet> = StaticToolCall<TOOLS> | DynamicToolCall;
|
|
9582
8311
|
|
|
@@ -9585,7 +8314,7 @@ export declare type TypedToolError<TOOLS extends ToolSet> = StaticToolError<TOOL
|
|
|
9585
8314
|
export declare type TypedToolResult<TOOLS extends ToolSet> = StaticToolResult<TOOLS> | DynamicToolResult;
|
|
9586
8315
|
|
|
9587
8316
|
export declare class TypeValidationError extends AISDKError {
|
|
9588
|
-
private readonly [symbol$
|
|
8317
|
+
private readonly [symbol$1];
|
|
9589
8318
|
readonly value: unknown;
|
|
9590
8319
|
constructor({ value, cause }: {
|
|
9591
8320
|
value: unknown;
|
|
@@ -9608,30 +8337,6 @@ export declare class TypeValidationError extends AISDKError {
|
|
|
9608
8337
|
}): TypeValidationError;
|
|
9609
8338
|
}
|
|
9610
8339
|
|
|
9611
|
-
declare class TypeValidationError_2 extends AISDKError_2 {
|
|
9612
|
-
private readonly [symbol$1];
|
|
9613
|
-
readonly value: unknown;
|
|
9614
|
-
constructor({ value, cause }: {
|
|
9615
|
-
value: unknown;
|
|
9616
|
-
cause: unknown;
|
|
9617
|
-
});
|
|
9618
|
-
static isInstance(error: unknown): error is TypeValidationError_2;
|
|
9619
|
-
/**
|
|
9620
|
-
* Wraps an error into a TypeValidationError.
|
|
9621
|
-
* If the cause is already a TypeValidationError with the same value, it returns the cause.
|
|
9622
|
-
* Otherwise, it creates a new TypeValidationError.
|
|
9623
|
-
*
|
|
9624
|
-
* @param {Object} params - The parameters for wrapping the error.
|
|
9625
|
-
* @param {unknown} params.value - The value that failed validation.
|
|
9626
|
-
* @param {unknown} params.cause - The original error or cause of the validation failure.
|
|
9627
|
-
* @returns {TypeValidationError} A TypeValidationError instance.
|
|
9628
|
-
*/
|
|
9629
|
-
static wrap({ value, cause, }: {
|
|
9630
|
-
value: unknown;
|
|
9631
|
-
cause: unknown;
|
|
9632
|
-
}): TypeValidationError_2;
|
|
9633
|
-
}
|
|
9634
|
-
|
|
9635
8340
|
export declare const UI_MESSAGE_STREAM_HEADERS: {
|
|
9636
8341
|
'content-type': string;
|
|
9637
8342
|
'cache-control': string;
|
|
@@ -10160,6 +8865,15 @@ export declare type UserModelMessage = {
|
|
|
10160
8865
|
|
|
10161
8866
|
export declare const userModelMessageSchema: z.ZodType<UserModelMessage>;
|
|
10162
8867
|
|
|
8868
|
+
/**
|
|
8869
|
+
* Validates that a URL is safe to download from, blocking private/internal addresses
|
|
8870
|
+
* to prevent SSRF attacks.
|
|
8871
|
+
*
|
|
8872
|
+
* @param url - The URL string to validate.
|
|
8873
|
+
* @throws DownloadError if the URL is unsafe.
|
|
8874
|
+
*/
|
|
8875
|
+
declare function validateDownloadUrl(url: string): void;
|
|
8876
|
+
|
|
10163
8877
|
/**
|
|
10164
8878
|
* Validates the types of an unknown object using a schema and
|
|
10165
8879
|
* return a strongly-typed object.
|
|
@@ -10295,11 +9009,11 @@ declare function withUserAgentSuffix(headers: HeadersInit | Record<string, strin
|
|
|
10295
9009
|
* @returns A new LanguageModelV2 instance with middleware applied.
|
|
10296
9010
|
*/
|
|
10297
9011
|
export declare const wrapLanguageModel: ({ model, middleware: middlewareArg, modelId, providerId, }: {
|
|
10298
|
-
model:
|
|
9012
|
+
model: LanguageModelV2;
|
|
10299
9013
|
middleware: LanguageModelMiddleware | LanguageModelMiddleware[];
|
|
10300
9014
|
modelId?: string;
|
|
10301
9015
|
providerId?: string;
|
|
10302
|
-
}) =>
|
|
9016
|
+
}) => LanguageModelV2;
|
|
10303
9017
|
|
|
10304
9018
|
/**
|
|
10305
9019
|
* Wraps a ProviderV2 instance with middleware functionality.
|
|
@@ -10313,9 +9027,9 @@ export declare const wrapLanguageModel: ({ model, middleware: middlewareArg, mod
|
|
|
10313
9027
|
* @returns A new ProviderV2 instance with middleware applied to all language models.
|
|
10314
9028
|
*/
|
|
10315
9029
|
export declare function wrapProvider({ provider, languageModelMiddleware, }: {
|
|
10316
|
-
provider:
|
|
9030
|
+
provider: ProviderV2;
|
|
10317
9031
|
languageModelMiddleware: LanguageModelMiddleware | LanguageModelMiddleware[];
|
|
10318
|
-
}):
|
|
9032
|
+
}): ProviderV2;
|
|
10319
9033
|
|
|
10320
9034
|
export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, any> | z3.Schema<OBJECT, z3.ZodTypeDef, any>, options?: {
|
|
10321
9035
|
/**
|
|
@@ -10328,5 +9042,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
|
|
|
10328
9042
|
}): Schema<OBJECT>;
|
|
10329
9043
|
|
|
10330
9044
|
export { }
|
|
10331
|
-
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult,
|
|
10332
|
-
export { schemaSymbol, symbol$1, symbol$1_2, symbol$
|
|
9045
|
+
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult, LanguageModelV2ToolResultOutput as LanguageModelV2ToolResultOutput, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, ToolOutputProperties as ToolOutputProperties, LanguageModelV2ToolResultPart as LanguageModelV2ToolResultPart, FlexibleSchema as FlexibleSchema, JSONSchema7Version as JSONSchema7Version, JSONSchema7Definition as JSONSchema7Definition, JSONSchema7TypeName as JSONSchema7TypeName, JSONSchema7Type as JSONSchema7Type, ImageModelV2CallWarning as ImageModelV2CallWarning, SpeechModelV2CallWarning as SpeechModelV2CallWarning, TranscriptionModelV2CallWarning as TranscriptionModelV2CallWarning, AttributeValue as AttributeValue, Tracer as Tracer, EmbeddingModelV2Embedding as EmbeddingModelV2Embedding, ImageModelV2ProviderMetadata as ImageModelV2ProviderMetadata, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2FinishReason as LanguageModelV2FinishReason, LanguageModelV2CallWarning as LanguageModelV2CallWarning, LanguageModelV2Middleware as LanguageModelV2Middleware, SharedV2ProviderMetadata as SharedV2ProviderMetadata, LanguageModelV2Usage as LanguageModelV2Usage, Source as Source, ResponseMessage as ResponseMessage, DeepPartialInternal as DeepPartialInternal, LanguageModelV2ToolCall as LanguageModelV2ToolCall, StreamTextOnAbortCallback as StreamTextOnAbortCallback, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, _ai_sdk_provider as _ai_sdk_provider, DataUIMessageChunk as DataUIMessageChunk, ConsumeStreamOptions as ConsumeStreamOptions, Output_2 as Output_2, InferAgentTools as InferAgentTools, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason as RetryErrorReason, InferSchema as InferSchema, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, JSONValue_2 as JSONValue_2, LanguageModelV2CallOptions as LanguageModelV2CallOptions, LanguageModelV2 as LanguageModelV2, EmbeddingModelV2 as EmbeddingModelV2, ImageModelV2 as ImageModelV2, TranscriptionModelV2 as TranscriptionModelV2, SpeechModelV2 as SpeechModelV2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV2 as ProviderV2, getOriginalFetch as getOriginalFetch, UIMessageStreamResponseInit as UIMessageStreamResponseInit, InferUIMessageToolCall as InferUIMessageToolCall, Validator as Validator, StandardSchemaV1 as StandardSchemaV1, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, InferUIMessageTools as InferUIMessageTools, Resolvable as Resolvable, FetchFunction as FetchFunction };
|
|
9046
|
+
export { schemaSymbol, symbol$1, symbol$1_2, symbol$2, symbol$2_2, symbol$3, symbol$3_2, symbol$4, symbol$4_2, symbol$5, symbol$5_2, symbol$6, symbol$6_2, symbol$7, symbol$7_2, symbol$8, symbol$8_2, symbol$9, symbol$9_2, symbol$a, symbol$a_2, symbol$b, symbol$b_2, symbol$c, symbol$c_2, symbol$d, symbol$d_2, symbol$e, symbol, symbol_2, symbol_3, validatorSymbol };
|