@mastra/fastembed 1.0.1 → 1.1.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 +12 -0
- package/LICENSE-fastembed +21 -0
- package/README.md +26 -17
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +466 -1768
- package/dist/fastembed.d.ts +115 -0
- package/dist/fastembed.d.ts.map +1 -0
- package/dist/index.cjs +1801 -691
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1790 -690
- package/dist/index.js.map +1 -1
- package/package.json +22 -15
- package/LICENSE.md +0 -30
- package/dist/chunk-23EXJLET.cjs +0 -84
- package/dist/chunk-23EXJLET.cjs.map +0 -1
- package/dist/chunk-BSDWQEU3.js +0 -79
- package/dist/chunk-BSDWQEU3.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -10
- package/dist/chunk-DGUM43GV.js.map +0 -1
- package/dist/chunk-EQ4M72KU.js +0 -439
- package/dist/chunk-EQ4M72KU.js.map +0 -1
- package/dist/chunk-HJYHDIOC.js +0 -250
- package/dist/chunk-HJYHDIOC.js.map +0 -1
- package/dist/chunk-IDRQZVB4.cjs +0 -84
- package/dist/chunk-IDRQZVB4.cjs.map +0 -1
- package/dist/chunk-JEQ2X3Z6.cjs +0 -12
- package/dist/chunk-JEQ2X3Z6.cjs.map +0 -1
- package/dist/chunk-LIBOSOHM.cjs +0 -252
- package/dist/chunk-LIBOSOHM.cjs.map +0 -1
- package/dist/chunk-RC6RZVYE.js +0 -79
- package/dist/chunk-RC6RZVYE.js.map +0 -1
- package/dist/chunk-ZD3BKU5O.cjs +0 -441
- package/dist/chunk-ZD3BKU5O.cjs.map +0 -1
- package/dist/token-6GSAFR2W-ABXTQD64.js +0 -61
- package/dist/token-6GSAFR2W-ABXTQD64.js.map +0 -1
- package/dist/token-6GSAFR2W-TW2P7HCS.cjs +0 -63
- package/dist/token-6GSAFR2W-TW2P7HCS.cjs.map +0 -1
- package/dist/token-APYSY3BW-2DN6RAUY.js +0 -61
- package/dist/token-APYSY3BW-2DN6RAUY.js.map +0 -1
- package/dist/token-APYSY3BW-ZQ7TMBY7.cjs +0 -63
- package/dist/token-APYSY3BW-ZQ7TMBY7.cjs.map +0 -1
- package/dist/token-util-NEHG7TUY-GYFEVMWP.cjs +0 -10
- package/dist/token-util-NEHG7TUY-GYFEVMWP.cjs.map +0 -1
- package/dist/token-util-NEHG7TUY-XQP3QSPX.js +0 -8
- package/dist/token-util-NEHG7TUY-XQP3QSPX.js.map +0 -1
- package/dist/token-util-RMHT2CPJ-6TGPE335.cjs +0 -10
- package/dist/token-util-RMHT2CPJ-6TGPE335.cjs.map +0 -1
- package/dist/token-util-RMHT2CPJ-RJEA3FAN.js +0 -8
- package/dist/token-util-RMHT2CPJ-RJEA3FAN.js.map +0 -1
|
@@ -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
|
/**
|
|
@@ -754,7 +706,7 @@ declare type ConsumeStreamOptions = {
|
|
|
754
706
|
onError?: ErrorHandler;
|
|
755
707
|
};
|
|
756
708
|
|
|
757
|
-
declare type ContentPart<TOOLS extends ToolSet> = {
|
|
709
|
+
export declare type ContentPart<TOOLS extends ToolSet> = {
|
|
758
710
|
type: 'text';
|
|
759
711
|
text: string;
|
|
760
712
|
providerMetadata?: ProviderMetadata;
|
|
@@ -778,6 +730,9 @@ 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.
|
|
@@ -907,6 +862,23 @@ export declare function cosineSimilarity(vector1: number[], vector2: number[]):
|
|
|
907
862
|
|
|
908
863
|
declare const createBinaryResponseHandler: () => ResponseHandler<Uint8Array>;
|
|
909
864
|
|
|
865
|
+
/**
|
|
866
|
+
* Creates a download function with configurable options.
|
|
867
|
+
*
|
|
868
|
+
* @param options - Configuration options for the download function.
|
|
869
|
+
* @param options.maxBytes - Maximum allowed download size in bytes. Default: 2 GiB.
|
|
870
|
+
* @returns A download function that can be passed to `transcribe()` or `experimental_generateVideo()`.
|
|
871
|
+
*/
|
|
872
|
+
export declare function createDownload(options?: {
|
|
873
|
+
maxBytes?: number;
|
|
874
|
+
}): ({ url, abortSignal }: {
|
|
875
|
+
url: URL;
|
|
876
|
+
abortSignal?: AbortSignal;
|
|
877
|
+
}) => Promise<{
|
|
878
|
+
data: Uint8Array<ArrayBufferLike>;
|
|
879
|
+
mediaType: string | undefined;
|
|
880
|
+
}>;
|
|
881
|
+
|
|
910
882
|
declare const createEventSourceResponseHandler: <T>(chunkSchema: FlexibleValidator<T>) => ResponseHandler<ReadableStream<ParseResult<T>>>;
|
|
911
883
|
|
|
912
884
|
/**
|
|
@@ -935,7 +907,7 @@ declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage,
|
|
|
935
907
|
errorSchema: FlexibleValidator<T>;
|
|
936
908
|
errorToMessage: (error: T) => string;
|
|
937
909
|
isRetryable?: (response: Response, error?: T) => boolean;
|
|
938
|
-
}) => ResponseHandler<
|
|
910
|
+
}) => ResponseHandler<APICallError>;
|
|
939
911
|
|
|
940
912
|
declare const createJsonResponseHandler: <T>(responseSchema: FlexibleValidator<T>) => ResponseHandler<T>;
|
|
941
913
|
|
|
@@ -966,12 +938,12 @@ declare function createProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT,
|
|
|
966
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.
|
|
967
939
|
* @returns A new ProviderRegistryProvider instance that provides access to all registered providers with optional middleware applied to language models.
|
|
968
940
|
*/
|
|
969
|
-
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, }?: {
|
|
970
942
|
separator?: SEPARATOR;
|
|
971
943
|
languageModelMiddleware?: LanguageModelMiddleware | LanguageModelMiddleware[];
|
|
972
944
|
}): ProviderRegistryProvider<PROVIDERS, SEPARATOR>;
|
|
973
945
|
|
|
974
|
-
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<
|
|
946
|
+
declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
|
|
975
947
|
|
|
976
948
|
export declare function createTextStreamResponse({ status, statusText, headers, textStream, }: ResponseInit & {
|
|
977
949
|
textStream: ReadableStream<string>;
|
|
@@ -1014,19 +986,19 @@ export declare function createUIMessageStreamResponse({ status, statusText, head
|
|
|
1014
986
|
*
|
|
1015
987
|
* @throws {NoSuchModelError} Throws when a requested model is not found and no fallback provider is available.
|
|
1016
988
|
*/
|
|
1017
|
-
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, }: {
|
|
1018
990
|
languageModels?: LANGUAGE_MODELS;
|
|
1019
991
|
textEmbeddingModels?: EMBEDDING_MODELS;
|
|
1020
992
|
imageModels?: IMAGE_MODELS;
|
|
1021
993
|
transcriptionModels?: TRANSCRIPTION_MODELS;
|
|
1022
994
|
speechModels?: SPEECH_MODELS;
|
|
1023
|
-
fallbackProvider?:
|
|
1024
|
-
}):
|
|
1025
|
-
languageModel(modelId: ExtractModelId<LANGUAGE_MODELS>):
|
|
1026
|
-
textEmbeddingModel(modelId: ExtractModelId<EMBEDDING_MODELS>):
|
|
1027
|
-
imageModel(modelId: ExtractModelId<IMAGE_MODELS>):
|
|
1028
|
-
transcriptionModel(modelId: ExtractModelId<TRANSCRIPTION_MODELS>):
|
|
1029
|
-
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;
|
|
1030
1002
|
};
|
|
1031
1003
|
|
|
1032
1004
|
/**
|
|
@@ -1062,6 +1034,19 @@ export declare type DeepPartial<T> = T extends z3.ZodTypeAny ? DeepPartialIntern
|
|
|
1062
1034
|
|
|
1063
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;
|
|
1064
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
|
+
|
|
1065
1050
|
export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends HttpChatTransport<UI_MESSAGE> {
|
|
1066
1051
|
constructor(options?: HttpChatTransportInitOptions<UI_MESSAGE>);
|
|
1067
1052
|
protected processResponseStream(stream: ReadableStream<Uint8Array<ArrayBufferLike>>): ReadableStream<UIMessageChunk>;
|
|
@@ -1072,19 +1057,19 @@ export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends
|
|
|
1072
1057
|
*/
|
|
1073
1058
|
export declare function defaultSettingsMiddleware({ settings, }: {
|
|
1074
1059
|
settings: Partial<{
|
|
1075
|
-
maxOutputTokens?:
|
|
1076
|
-
temperature?:
|
|
1077
|
-
stopSequences?:
|
|
1078
|
-
topP?:
|
|
1079
|
-
topK?:
|
|
1080
|
-
presencePenalty?:
|
|
1081
|
-
frequencyPenalty?:
|
|
1082
|
-
responseFormat?:
|
|
1083
|
-
seed?:
|
|
1084
|
-
tools?:
|
|
1085
|
-
toolChoice?:
|
|
1086
|
-
headers?:
|
|
1087
|
-
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'];
|
|
1088
1073
|
}>;
|
|
1089
1074
|
}): LanguageModelMiddleware;
|
|
1090
1075
|
|
|
@@ -1132,6 +1117,21 @@ export declare class DownloadError extends AISDKError {
|
|
|
1132
1117
|
static isInstance(error: unknown): error is DownloadError;
|
|
1133
1118
|
}
|
|
1134
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
|
+
|
|
1135
1135
|
/**
|
|
1136
1136
|
Helper function for defining a dynamic tool.
|
|
1137
1137
|
*/
|
|
@@ -1279,12 +1279,12 @@ export declare function embed<VALUE = string>({ model: modelArg, value, provider
|
|
|
1279
1279
|
/**
|
|
1280
1280
|
Embedding.
|
|
1281
1281
|
*/
|
|
1282
|
-
export declare type Embedding =
|
|
1282
|
+
export declare type Embedding = EmbeddingModelV2Embedding;
|
|
1283
1283
|
|
|
1284
1284
|
/**
|
|
1285
1285
|
Embedding model that is used by the AI SDK Core functions.
|
|
1286
1286
|
*/
|
|
1287
|
-
export declare type EmbeddingModel<VALUE = string> = string |
|
|
1287
|
+
export declare type EmbeddingModel<VALUE = string> = string | EmbeddingModelV2<VALUE>;
|
|
1288
1288
|
|
|
1289
1289
|
/**
|
|
1290
1290
|
Represents the number of tokens used in an embedding.
|
|
@@ -1390,112 +1390,12 @@ declare type EmbeddingModelV2<VALUE> = {
|
|
|
1390
1390
|
}>;
|
|
1391
1391
|
};
|
|
1392
1392
|
|
|
1393
|
-
/**
|
|
1394
|
-
Specification for an embedding model that implements the embedding model
|
|
1395
|
-
interface version 1.
|
|
1396
|
-
|
|
1397
|
-
VALUE is the type of the values that the model can embed.
|
|
1398
|
-
This will allow us to go beyond text embeddings in the future,
|
|
1399
|
-
e.g. to support image embeddings
|
|
1400
|
-
*/
|
|
1401
|
-
declare type EmbeddingModelV2_2<VALUE> = {
|
|
1402
|
-
/**
|
|
1403
|
-
The embedding model must specify which embedding model interface
|
|
1404
|
-
version it implements. This will allow us to evolve the embedding
|
|
1405
|
-
model interface and retain backwards compatibility. The different
|
|
1406
|
-
implementation versions can be handled as a discriminated union
|
|
1407
|
-
on our side.
|
|
1408
|
-
*/
|
|
1409
|
-
readonly specificationVersion: 'v2';
|
|
1410
|
-
/**
|
|
1411
|
-
Name of the provider for logging purposes.
|
|
1412
|
-
*/
|
|
1413
|
-
readonly provider: string;
|
|
1414
|
-
/**
|
|
1415
|
-
Provider-specific model ID for logging purposes.
|
|
1416
|
-
*/
|
|
1417
|
-
readonly modelId: string;
|
|
1418
|
-
/**
|
|
1419
|
-
Limit of how many embeddings can be generated in a single API call.
|
|
1420
|
-
|
|
1421
|
-
Use Infinity for models that do not have a limit.
|
|
1422
|
-
*/
|
|
1423
|
-
readonly maxEmbeddingsPerCall: PromiseLike<number | undefined> | number | undefined;
|
|
1424
|
-
/**
|
|
1425
|
-
True if the model can handle multiple embedding calls in parallel.
|
|
1426
|
-
*/
|
|
1427
|
-
readonly supportsParallelCalls: PromiseLike<boolean> | boolean;
|
|
1428
|
-
/**
|
|
1429
|
-
Generates a list of embeddings for the given input text.
|
|
1430
|
-
|
|
1431
|
-
Naming: "do" prefix to prevent accidental direct usage of the method
|
|
1432
|
-
by the user.
|
|
1433
|
-
*/
|
|
1434
|
-
doEmbed(options: {
|
|
1435
|
-
/**
|
|
1436
|
-
List of values to embed.
|
|
1437
|
-
*/
|
|
1438
|
-
values: Array<VALUE>;
|
|
1439
|
-
/**
|
|
1440
|
-
Abort signal for cancelling the operation.
|
|
1441
|
-
*/
|
|
1442
|
-
abortSignal?: AbortSignal;
|
|
1443
|
-
/**
|
|
1444
|
-
Additional provider-specific options. They are passed through
|
|
1445
|
-
to the provider from the AI SDK and enable provider-specific
|
|
1446
|
-
functionality that can be fully encapsulated in the provider.
|
|
1447
|
-
*/
|
|
1448
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
1449
|
-
/**
|
|
1450
|
-
Additional HTTP headers to be sent with the request.
|
|
1451
|
-
Only applicable for HTTP-based providers.
|
|
1452
|
-
*/
|
|
1453
|
-
headers?: Record<string, string | undefined>;
|
|
1454
|
-
}): PromiseLike<{
|
|
1455
|
-
/**
|
|
1456
|
-
Generated embeddings. They are in the same order as the input values.
|
|
1457
|
-
*/
|
|
1458
|
-
embeddings: Array<EmbeddingModelV2Embedding_2>;
|
|
1459
|
-
/**
|
|
1460
|
-
Token usage. We only have input tokens for embeddings.
|
|
1461
|
-
*/
|
|
1462
|
-
usage?: {
|
|
1463
|
-
tokens: number;
|
|
1464
|
-
};
|
|
1465
|
-
/**
|
|
1466
|
-
Additional provider-specific metadata. They are passed through
|
|
1467
|
-
from the provider to the AI SDK and enable provider-specific
|
|
1468
|
-
results that can be fully encapsulated in the provider.
|
|
1469
|
-
*/
|
|
1470
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
1471
|
-
/**
|
|
1472
|
-
Optional response information for debugging purposes.
|
|
1473
|
-
*/
|
|
1474
|
-
response?: {
|
|
1475
|
-
/**
|
|
1476
|
-
Response headers.
|
|
1477
|
-
*/
|
|
1478
|
-
headers?: SharedV2Headers_2;
|
|
1479
|
-
/**
|
|
1480
|
-
The response body.
|
|
1481
|
-
*/
|
|
1482
|
-
body?: unknown;
|
|
1483
|
-
};
|
|
1484
|
-
}>;
|
|
1485
|
-
};
|
|
1486
|
-
|
|
1487
1393
|
/**
|
|
1488
1394
|
An embedding is a vector, i.e. an array of numbers.
|
|
1489
1395
|
It is e.g. used to represent a text as a vector of word embeddings.
|
|
1490
1396
|
*/
|
|
1491
1397
|
declare type EmbeddingModelV2Embedding = Array<number>;
|
|
1492
1398
|
|
|
1493
|
-
/**
|
|
1494
|
-
An embedding is a vector, i.e. an array of numbers.
|
|
1495
|
-
It is e.g. used to represent a text as a vector of word embeddings.
|
|
1496
|
-
*/
|
|
1497
|
-
declare type EmbeddingModelV2Embedding_2 = Array<number>;
|
|
1498
|
-
|
|
1499
1399
|
/**
|
|
1500
1400
|
Embed several values using an embedding model. The type of the value is defined
|
|
1501
1401
|
by the embedding model.
|
|
@@ -1688,6 +1588,8 @@ declare class EventSourceParserStream extends TransformStream<string, EventSourc
|
|
|
1688
1588
|
* Defines Exception.
|
|
1689
1589
|
*
|
|
1690
1590
|
* string or an object with one of (message or name or code) and optional stack
|
|
1591
|
+
*
|
|
1592
|
+
* @since 1.0.0
|
|
1691
1593
|
*/
|
|
1692
1594
|
declare type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
|
|
1693
1595
|
|
|
@@ -1996,7 +1898,7 @@ export declare function experimental_generateSpeech({ model, text, voice, output
|
|
|
1996
1898
|
/**
|
|
1997
1899
|
The speech model to use.
|
|
1998
1900
|
*/
|
|
1999
|
-
model:
|
|
1901
|
+
model: SpeechModelV2;
|
|
2000
1902
|
/**
|
|
2001
1903
|
The text to convert to speech.
|
|
2002
1904
|
*/
|
|
@@ -2079,27 +1981,14 @@ export declare interface Experimental_SpeechResult {
|
|
|
2079
1981
|
/**
|
|
2080
1982
|
Provider metadata from the provider.
|
|
2081
1983
|
*/
|
|
2082
|
-
readonly providerMetadata: Record<string, Record<string,
|
|
1984
|
+
readonly providerMetadata: Record<string, Record<string, JSONValue_2>>;
|
|
2083
1985
|
}
|
|
2084
1986
|
|
|
2085
|
-
|
|
2086
|
-
Generates transcripts using a transcription model.
|
|
2087
|
-
|
|
2088
|
-
@param model - The transcription model to use.
|
|
2089
|
-
@param audio - The audio data to transcribe as DataContent (string | Uint8Array | ArrayBuffer | Buffer) or a URL.
|
|
2090
|
-
@param providerOptions - Additional provider-specific options that are passed through to the provider
|
|
2091
|
-
as body parameters.
|
|
2092
|
-
@param maxRetries - Maximum number of retries. Set to 0 to disable retries. Default: 2.
|
|
2093
|
-
@param abortSignal - An optional abort signal that can be used to cancel the call.
|
|
2094
|
-
@param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
|
|
2095
|
-
|
|
2096
|
-
@returns A result object that contains the generated transcript.
|
|
2097
|
-
*/
|
|
2098
|
-
export declare function experimental_transcribe({ model, audio, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, }: {
|
|
1987
|
+
export declare function experimental_transcribe({ model, audio, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, download: downloadFn, }: {
|
|
2099
1988
|
/**
|
|
2100
1989
|
The transcription model to use.
|
|
2101
1990
|
*/
|
|
2102
|
-
model:
|
|
1991
|
+
model: TranscriptionModelV2;
|
|
2103
1992
|
/**
|
|
2104
1993
|
The audio data to transcribe.
|
|
2105
1994
|
*/
|
|
@@ -2134,6 +2023,19 @@ export declare function experimental_transcribe({ model, audio, providerOptions,
|
|
|
2134
2023
|
Only applicable for HTTP-based providers.
|
|
2135
2024
|
*/
|
|
2136
2025
|
headers?: Record<string, string>;
|
|
2026
|
+
/**
|
|
2027
|
+
* Custom download function for fetching audio from URLs.
|
|
2028
|
+
* Use `createDownload()` from `ai` to create a download function with custom size limits.
|
|
2029
|
+
*
|
|
2030
|
+
* @default createDownload() (2 GiB limit)
|
|
2031
|
+
*/
|
|
2032
|
+
download?: (options: {
|
|
2033
|
+
url: URL;
|
|
2034
|
+
abortSignal?: AbortSignal;
|
|
2035
|
+
}) => Promise<{
|
|
2036
|
+
data: Uint8Array;
|
|
2037
|
+
mediaType: string | undefined;
|
|
2038
|
+
}>;
|
|
2137
2039
|
}): Promise<Experimental_TranscriptionResult>;
|
|
2138
2040
|
|
|
2139
2041
|
/**
|
|
@@ -2184,10 +2086,10 @@ export declare interface Experimental_TranscriptionResult {
|
|
|
2184
2086
|
/**
|
|
2185
2087
|
Provider metadata from the provider.
|
|
2186
2088
|
*/
|
|
2187
|
-
readonly providerMetadata: Record<string, Record<string,
|
|
2089
|
+
readonly providerMetadata: Record<string, Record<string, JSONValue_2>>;
|
|
2188
2090
|
}
|
|
2189
2091
|
|
|
2190
|
-
export declare type Experimental_Warning =
|
|
2092
|
+
export declare type Experimental_Warning = LanguageModelV2CallWarning | ImageModelV2CallWarning | SpeechModelV2CallWarning | TranscriptionModelV2CallWarning;
|
|
2191
2093
|
|
|
2192
2094
|
declare type ExtractLiteralUnion<T> = T extends string ? string extends T ? never : T : never;
|
|
2193
2095
|
|
|
@@ -2289,7 +2191,7 @@ export declare type FileUIPart = {
|
|
|
2289
2191
|
- `error`: model stopped because of an error
|
|
2290
2192
|
- `other`: model stopped for other reasons
|
|
2291
2193
|
*/
|
|
2292
|
-
export declare type FinishReason =
|
|
2194
|
+
export declare type FinishReason = LanguageModelV2FinishReason;
|
|
2293
2195
|
|
|
2294
2196
|
declare type FlexibleSchema<SCHEMA> = z4.core.$ZodType<SCHEMA, any> | z3.Schema<SCHEMA, z3.ZodTypeDef, any> | Schema<SCHEMA> | LazySchema<SCHEMA>;
|
|
2295
2197
|
|
|
@@ -2304,13 +2206,57 @@ declare interface GatewayCreditsResponse {
|
|
|
2304
2206
|
totalUsed: string;
|
|
2305
2207
|
}
|
|
2306
2208
|
|
|
2307
|
-
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-
|
|
2209
|
+
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 & {});
|
|
2308
2210
|
|
|
2309
2211
|
declare interface GatewayFetchMetadataResponse {
|
|
2310
2212
|
models: GatewayLanguageModelEntry[];
|
|
2311
2213
|
}
|
|
2312
2214
|
|
|
2313
|
-
declare
|
|
2215
|
+
declare interface GatewayGenerationInfo {
|
|
2216
|
+
/** The generation ID */
|
|
2217
|
+
id: string;
|
|
2218
|
+
/** Total cost in USD */
|
|
2219
|
+
totalCost: number;
|
|
2220
|
+
/** Upstream inference cost in USD (BYOK only) */
|
|
2221
|
+
upstreamInferenceCost: number;
|
|
2222
|
+
/** Usage cost in USD (same as totalCost) */
|
|
2223
|
+
usage: number;
|
|
2224
|
+
/** ISO 8601 timestamp when the generation was created */
|
|
2225
|
+
createdAt: string;
|
|
2226
|
+
/** Model identifier */
|
|
2227
|
+
model: string;
|
|
2228
|
+
/** Whether BYOK credentials were used */
|
|
2229
|
+
isByok: boolean;
|
|
2230
|
+
/** Provider that served this generation */
|
|
2231
|
+
providerName: string;
|
|
2232
|
+
/** Whether streaming was used */
|
|
2233
|
+
streamed: boolean;
|
|
2234
|
+
/** Finish reason (e.g. 'stop') */
|
|
2235
|
+
finishReason: string;
|
|
2236
|
+
/** Time to first token in milliseconds */
|
|
2237
|
+
latency: number;
|
|
2238
|
+
/** Total generation time in milliseconds */
|
|
2239
|
+
generationTime: number;
|
|
2240
|
+
/** Number of prompt tokens */
|
|
2241
|
+
promptTokens: number;
|
|
2242
|
+
/** Number of completion tokens */
|
|
2243
|
+
completionTokens: number;
|
|
2244
|
+
/** Reasoning tokens used */
|
|
2245
|
+
reasoningTokens: number;
|
|
2246
|
+
/** Cached tokens used */
|
|
2247
|
+
cachedTokens: number;
|
|
2248
|
+
/** Cache creation input tokens */
|
|
2249
|
+
cacheCreationTokens: number;
|
|
2250
|
+
/** Billable web search calls */
|
|
2251
|
+
billableWebSearchCalls: number;
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
declare interface GatewayGenerationInfoParams {
|
|
2255
|
+
/** The generation ID to look up (format: gen_<ulid>) */
|
|
2256
|
+
id: string;
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
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 & {});
|
|
2314
2260
|
|
|
2315
2261
|
declare interface GatewayLanguageModelEntry {
|
|
2316
2262
|
/**
|
|
@@ -2356,12 +2302,12 @@ declare interface GatewayLanguageModelEntry {
|
|
|
2356
2302
|
/**
|
|
2357
2303
|
* Optional field to differentiate between model types.
|
|
2358
2304
|
*/
|
|
2359
|
-
modelType?:
|
|
2305
|
+
modelType?: KnownModelType | null;
|
|
2360
2306
|
}
|
|
2361
2307
|
|
|
2362
2308
|
declare type GatewayLanguageModelSpecification = Pick<LanguageModelV2, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
2363
2309
|
|
|
2364
|
-
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-
|
|
2310
|
+
export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.7-sonnet' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'arcee-ai/trinity-large-preview' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking-2601' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'xai/grok-3' | 'xai/grok-3-fast' | 'xai/grok-3-mini' | 'xai/grok-3-mini-fast' | 'xai/grok-4' | 'xai/grok-4-fast-non-reasoning' | 'xai/grok-4-fast-reasoning' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-code-fast-1' | 'xiaomi/mimo-v2-flash' | 'xiaomi/mimo-v2-pro' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5v-turbo' | (string & {});
|
|
2365
2311
|
|
|
2366
2312
|
declare interface GatewayProvider extends ProviderV2 {
|
|
2367
2313
|
(modelId: GatewayModelId): LanguageModelV2;
|
|
@@ -2377,6 +2323,16 @@ declare interface GatewayProvider extends ProviderV2 {
|
|
|
2377
2323
|
Returns credit information for the authenticated user.
|
|
2378
2324
|
*/
|
|
2379
2325
|
getCredits(): Promise<GatewayCreditsResponse>;
|
|
2326
|
+
/**
|
|
2327
|
+
* Returns a spend report with cost, token, and request count data,
|
|
2328
|
+
* aggregated by the specified dimension.
|
|
2329
|
+
*/
|
|
2330
|
+
getSpendReport(params: GatewaySpendReportParams): Promise<GatewaySpendReportResponse>;
|
|
2331
|
+
/**
|
|
2332
|
+
* Returns detailed information about a specific generation by its ID,
|
|
2333
|
+
* including cost, token usage, latency, and provider details.
|
|
2334
|
+
*/
|
|
2335
|
+
getGenerationInfo(params: GatewayGenerationInfoParams): Promise<GatewayGenerationInfo>;
|
|
2380
2336
|
/**
|
|
2381
2337
|
Creates a model for generating text embeddings.
|
|
2382
2338
|
*/
|
|
@@ -2415,6 +2371,64 @@ declare interface GatewayProviderSettings {
|
|
|
2415
2371
|
metadataCacheRefreshMillis?: number;
|
|
2416
2372
|
}
|
|
2417
2373
|
|
|
2374
|
+
declare interface GatewaySpendReportParams {
|
|
2375
|
+
/** Start date in YYYY-MM-DD format (inclusive) */
|
|
2376
|
+
startDate: string;
|
|
2377
|
+
/** End date in YYYY-MM-DD format (inclusive) */
|
|
2378
|
+
endDate: string;
|
|
2379
|
+
/** Primary aggregation dimension. Defaults to 'day'. */
|
|
2380
|
+
groupBy?: 'day' | 'user' | 'model' | 'tag' | 'provider' | 'credential_type';
|
|
2381
|
+
/** Time granularity when groupBy is 'day'. */
|
|
2382
|
+
datePart?: 'day' | 'hour';
|
|
2383
|
+
/** Filter to a specific user's spend. */
|
|
2384
|
+
userId?: string;
|
|
2385
|
+
/** Filter to a specific model (e.g. 'anthropic/claude-sonnet-4.5'). */
|
|
2386
|
+
model?: string;
|
|
2387
|
+
/** Filter to a specific provider (e.g. 'anthropic'). */
|
|
2388
|
+
provider?: string;
|
|
2389
|
+
/** Filter to BYOK or system credentials. */
|
|
2390
|
+
credentialType?: 'byok' | 'system';
|
|
2391
|
+
/** Filter to requests with these tags. */
|
|
2392
|
+
tags?: string[];
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
declare interface GatewaySpendReportResponse {
|
|
2396
|
+
results: GatewaySpendReportRow[];
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
declare interface GatewaySpendReportRow {
|
|
2400
|
+
/** Date string (present when groupBy is 'day') */
|
|
2401
|
+
day?: string;
|
|
2402
|
+
/** Hour timestamp (present when groupBy is 'day' and datePart is 'hour') */
|
|
2403
|
+
hour?: string;
|
|
2404
|
+
/** User identifier (present when groupBy is 'user') */
|
|
2405
|
+
user?: string;
|
|
2406
|
+
/** Model identifier (present when groupBy is 'model') */
|
|
2407
|
+
model?: string;
|
|
2408
|
+
/** Tag value (present when groupBy is 'tag') */
|
|
2409
|
+
tag?: string;
|
|
2410
|
+
/** Provider name (present when groupBy is 'provider') */
|
|
2411
|
+
provider?: string;
|
|
2412
|
+
/** Credential type (present when groupBy is 'credential_type') */
|
|
2413
|
+
credentialType?: 'byok' | 'system';
|
|
2414
|
+
/** Total cost in USD */
|
|
2415
|
+
totalCost: number;
|
|
2416
|
+
/** Market cost in USD */
|
|
2417
|
+
marketCost?: number;
|
|
2418
|
+
/** Number of input tokens */
|
|
2419
|
+
inputTokens?: number;
|
|
2420
|
+
/** Number of output tokens */
|
|
2421
|
+
outputTokens?: number;
|
|
2422
|
+
/** Number of cached input tokens */
|
|
2423
|
+
cachedInputTokens?: number;
|
|
2424
|
+
/** Number of cache creation input tokens */
|
|
2425
|
+
cacheCreationInputTokens?: number;
|
|
2426
|
+
/** Number of reasoning tokens */
|
|
2427
|
+
reasoningTokens?: number;
|
|
2428
|
+
/** Number of requests */
|
|
2429
|
+
requestCount?: number;
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2418
2432
|
/**
|
|
2419
2433
|
* Gateway-specific provider-defined tools.
|
|
2420
2434
|
*/
|
|
@@ -2540,12 +2554,11 @@ export declare const generateId: IdGenerator;
|
|
|
2540
2554
|
@returns
|
|
2541
2555
|
A result object that contains the generated object, the finish reason, the token usage, and additional information.
|
|
2542
2556
|
*/
|
|
2543
|
-
export declare function generateObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<
|
|
2557
|
+
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' ? {
|
|
2544
2558
|
/**
|
|
2545
2559
|
The enum values that the model should use.
|
|
2546
2560
|
*/
|
|
2547
2561
|
enum: Array<RESULT>;
|
|
2548
|
-
mode?: 'json';
|
|
2549
2562
|
output: 'enum';
|
|
2550
2563
|
} : OUTPUT extends 'no-schema' ? {} : {
|
|
2551
2564
|
/**
|
|
@@ -2564,20 +2577,6 @@ export declare function generateObject<SCHEMA extends FlexibleSchema<unknown> =
|
|
|
2564
2577
|
via tool or schema description.
|
|
2565
2578
|
*/
|
|
2566
2579
|
schemaDescription?: string;
|
|
2567
|
-
/**
|
|
2568
|
-
The mode to use for object generation.
|
|
2569
|
-
|
|
2570
|
-
The schema is converted into a JSON schema and used in one of the following ways
|
|
2571
|
-
|
|
2572
|
-
- 'auto': The provider will choose the best mode for the model.
|
|
2573
|
-
- 'tool': A tool with the JSON schema as parameters is provided and the provider is instructed to use it.
|
|
2574
|
-
- 'json': The JSON schema and an instruction are injected into the prompt. If the provider supports JSON mode, it is enabled. If the provider supports JSON grammars, the grammar is used.
|
|
2575
|
-
|
|
2576
|
-
Please note that most providers do not support all modes.
|
|
2577
|
-
|
|
2578
|
-
Default and recommended: 'auto' (best mode for the model).
|
|
2579
|
-
*/
|
|
2580
|
-
mode?: 'auto' | 'json' | 'tool';
|
|
2581
2580
|
}) & {
|
|
2582
2581
|
output?: OUTPUT;
|
|
2583
2582
|
/**
|
|
@@ -2711,7 +2710,7 @@ export declare interface GenerateObjectResult<OBJECT> {
|
|
|
2711
2710
|
@returns
|
|
2712
2711
|
A result object that contains the generated text, the results of the tool calls, and additional information.
|
|
2713
2712
|
*/
|
|
2714
|
-
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 & {
|
|
2713
|
+
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 & {
|
|
2715
2714
|
/**
|
|
2716
2715
|
The language model to use.
|
|
2717
2716
|
*/
|
|
@@ -2933,10 +2932,6 @@ declare type GetMaxImagesPerCallFunction = (options: {
|
|
|
2933
2932
|
modelId: string;
|
|
2934
2933
|
}) => PromiseLike<number | undefined> | number | undefined;
|
|
2935
2934
|
|
|
2936
|
-
declare type GetMaxImagesPerCallFunction_2 = (options: {
|
|
2937
|
-
modelId: string;
|
|
2938
|
-
}) => PromiseLike<number | undefined> | number | undefined;
|
|
2939
|
-
|
|
2940
2935
|
declare const getOriginalFetch: () => typeof fetch;
|
|
2941
2936
|
|
|
2942
2937
|
declare function getRuntimeEnvironmentUserAgent(globalThisAny?: any): string;
|
|
@@ -2971,6 +2966,8 @@ export declare function hasToolCall(toolName: string): StopCondition<any>;
|
|
|
2971
2966
|
* The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
|
|
2972
2967
|
* HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
|
|
2973
2968
|
* This is represented in HrTime format as [1609504210, 150000000].
|
|
2969
|
+
*
|
|
2970
|
+
* @since 1.0.0
|
|
2974
2971
|
*/
|
|
2975
2972
|
declare type HrTime = [number, number];
|
|
2976
2973
|
|
|
@@ -3057,18 +3054,18 @@ export declare type IdGenerator = () => string;
|
|
|
3057
3054
|
/**
|
|
3058
3055
|
Image model that is used by the AI SDK Core functions.
|
|
3059
3056
|
*/
|
|
3060
|
-
export declare type ImageModel = string |
|
|
3057
|
+
export declare type ImageModel = string | ImageModelV2;
|
|
3061
3058
|
|
|
3062
3059
|
/**
|
|
3063
3060
|
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
3064
3061
|
some settings might not be supported, which can lead to suboptimal results.
|
|
3065
3062
|
*/
|
|
3066
|
-
export declare type ImageModelCallWarning =
|
|
3063
|
+
export declare type ImageModelCallWarning = ImageModelV2CallWarning;
|
|
3067
3064
|
|
|
3068
3065
|
/**
|
|
3069
3066
|
Metadata from the model provider for this call
|
|
3070
3067
|
*/
|
|
3071
|
-
export declare type ImageModelProviderMetadata =
|
|
3068
|
+
export declare type ImageModelProviderMetadata = ImageModelV2ProviderMetadata;
|
|
3072
3069
|
|
|
3073
3070
|
export declare type ImageModelResponseMetadata = {
|
|
3074
3071
|
/**
|
|
@@ -3166,111 +3163,30 @@ declare type ImageModelV2 = {
|
|
|
3166
3163
|
}>;
|
|
3167
3164
|
};
|
|
3168
3165
|
|
|
3169
|
-
|
|
3170
|
-
Image generation model specification version 2.
|
|
3171
|
-
*/
|
|
3172
|
-
declare type ImageModelV2_2 = {
|
|
3166
|
+
declare type ImageModelV2CallOptions = {
|
|
3173
3167
|
/**
|
|
3174
|
-
|
|
3175
|
-
version it implements. This will allow us to evolve the image
|
|
3176
|
-
model interface and retain backwards compatibility. The different
|
|
3177
|
-
implementation versions can be handled as a discriminated union
|
|
3178
|
-
on our side.
|
|
3168
|
+
Prompt for the image generation.
|
|
3179
3169
|
*/
|
|
3180
|
-
|
|
3170
|
+
prompt: string;
|
|
3181
3171
|
/**
|
|
3182
|
-
|
|
3172
|
+
Number of images to generate.
|
|
3183
3173
|
*/
|
|
3184
|
-
|
|
3174
|
+
n: number;
|
|
3185
3175
|
/**
|
|
3186
|
-
|
|
3176
|
+
Size of the images to generate.
|
|
3177
|
+
Must have the format `{width}x{height}`.
|
|
3178
|
+
`undefined` will use the provider's default size.
|
|
3187
3179
|
*/
|
|
3188
|
-
|
|
3180
|
+
size: `${number}x${number}` | undefined;
|
|
3189
3181
|
/**
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
optionally as a promise.
|
|
3182
|
+
Aspect ratio of the images to generate.
|
|
3183
|
+
Must have the format `{width}:{height}`.
|
|
3184
|
+
`undefined` will use the provider's default aspect ratio.
|
|
3194
3185
|
*/
|
|
3195
|
-
|
|
3186
|
+
aspectRatio: `${number}:${number}` | undefined;
|
|
3196
3187
|
/**
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
doGenerate(options: ImageModelV2CallOptions_2): PromiseLike<{
|
|
3200
|
-
/**
|
|
3201
|
-
Generated images as base64 encoded strings or binary data.
|
|
3202
|
-
The images should be returned without any unnecessary conversion.
|
|
3203
|
-
If the API returns base64 encoded strings, the images should be returned
|
|
3204
|
-
as base64 encoded strings. If the API returns binary data, the images should
|
|
3205
|
-
be returned as binary data.
|
|
3206
|
-
*/
|
|
3207
|
-
images: Array<string> | Array<Uint8Array>;
|
|
3208
|
-
/**
|
|
3209
|
-
Warnings for the call, e.g. unsupported settings.
|
|
3210
|
-
*/
|
|
3211
|
-
warnings: Array<ImageModelV2CallWarning_2>;
|
|
3212
|
-
/**
|
|
3213
|
-
Additional provider-specific metadata. They are passed through
|
|
3214
|
-
from the provider to the AI SDK and enable provider-specific
|
|
3215
|
-
results that can be fully encapsulated in the provider.
|
|
3216
|
-
|
|
3217
|
-
The outer record is keyed by the provider name, and the inner
|
|
3218
|
-
record is provider-specific metadata. It always includes an
|
|
3219
|
-
`images` key with image-specific metadata
|
|
3220
|
-
|
|
3221
|
-
```ts
|
|
3222
|
-
{
|
|
3223
|
-
"openai": {
|
|
3224
|
-
"images": ["revisedPrompt": "Revised prompt here."]
|
|
3225
|
-
}
|
|
3226
|
-
}
|
|
3227
|
-
```
|
|
3228
|
-
*/
|
|
3229
|
-
providerMetadata?: ImageModelV2ProviderMetadata_2;
|
|
3230
|
-
/**
|
|
3231
|
-
Response information for telemetry and debugging purposes.
|
|
3232
|
-
*/
|
|
3233
|
-
response: {
|
|
3234
|
-
/**
|
|
3235
|
-
Timestamp for the start of the generated response.
|
|
3236
|
-
*/
|
|
3237
|
-
timestamp: Date;
|
|
3238
|
-
/**
|
|
3239
|
-
The ID of the response model that was used to generate the response.
|
|
3240
|
-
*/
|
|
3241
|
-
modelId: string;
|
|
3242
|
-
/**
|
|
3243
|
-
Response headers.
|
|
3244
|
-
*/
|
|
3245
|
-
headers: Record<string, string> | undefined;
|
|
3246
|
-
};
|
|
3247
|
-
}>;
|
|
3248
|
-
};
|
|
3249
|
-
|
|
3250
|
-
declare type ImageModelV2CallOptions = {
|
|
3251
|
-
/**
|
|
3252
|
-
Prompt for the image generation.
|
|
3253
|
-
*/
|
|
3254
|
-
prompt: string;
|
|
3255
|
-
/**
|
|
3256
|
-
Number of images to generate.
|
|
3257
|
-
*/
|
|
3258
|
-
n: number;
|
|
3259
|
-
/**
|
|
3260
|
-
Size of the images to generate.
|
|
3261
|
-
Must have the format `{width}x{height}`.
|
|
3262
|
-
`undefined` will use the provider's default size.
|
|
3263
|
-
*/
|
|
3264
|
-
size: `${number}x${number}` | undefined;
|
|
3265
|
-
/**
|
|
3266
|
-
Aspect ratio of the images to generate.
|
|
3267
|
-
Must have the format `{width}:{height}`.
|
|
3268
|
-
`undefined` will use the provider's default aspect ratio.
|
|
3269
|
-
*/
|
|
3270
|
-
aspectRatio: `${number}:${number}` | undefined;
|
|
3271
|
-
/**
|
|
3272
|
-
Seed for the image generation.
|
|
3273
|
-
`undefined` will use the provider's default seed.
|
|
3188
|
+
Seed for the image generation.
|
|
3189
|
+
`undefined` will use the provider's default seed.
|
|
3274
3190
|
*/
|
|
3275
3191
|
seed: number | undefined;
|
|
3276
3192
|
/**
|
|
@@ -3299,58 +3215,6 @@ declare type ImageModelV2CallOptions = {
|
|
|
3299
3215
|
headers?: Record<string, string | undefined>;
|
|
3300
3216
|
};
|
|
3301
3217
|
|
|
3302
|
-
declare type ImageModelV2CallOptions_2 = {
|
|
3303
|
-
/**
|
|
3304
|
-
Prompt for the image generation.
|
|
3305
|
-
*/
|
|
3306
|
-
prompt: string;
|
|
3307
|
-
/**
|
|
3308
|
-
Number of images to generate.
|
|
3309
|
-
*/
|
|
3310
|
-
n: number;
|
|
3311
|
-
/**
|
|
3312
|
-
Size of the images to generate.
|
|
3313
|
-
Must have the format `{width}x{height}`.
|
|
3314
|
-
`undefined` will use the provider's default size.
|
|
3315
|
-
*/
|
|
3316
|
-
size: `${number}x${number}` | undefined;
|
|
3317
|
-
/**
|
|
3318
|
-
Aspect ratio of the images to generate.
|
|
3319
|
-
Must have the format `{width}:{height}`.
|
|
3320
|
-
`undefined` will use the provider's default aspect ratio.
|
|
3321
|
-
*/
|
|
3322
|
-
aspectRatio: `${number}:${number}` | undefined;
|
|
3323
|
-
/**
|
|
3324
|
-
Seed for the image generation.
|
|
3325
|
-
`undefined` will use the provider's default seed.
|
|
3326
|
-
*/
|
|
3327
|
-
seed: number | undefined;
|
|
3328
|
-
/**
|
|
3329
|
-
Additional provider-specific options that are passed through to the provider
|
|
3330
|
-
as body parameters.
|
|
3331
|
-
|
|
3332
|
-
The outer record is keyed by the provider name, and the inner
|
|
3333
|
-
record is keyed by the provider-specific metadata key.
|
|
3334
|
-
```ts
|
|
3335
|
-
{
|
|
3336
|
-
"openai": {
|
|
3337
|
-
"style": "vivid"
|
|
3338
|
-
}
|
|
3339
|
-
}
|
|
3340
|
-
```
|
|
3341
|
-
*/
|
|
3342
|
-
providerOptions: SharedV2ProviderOptions_2;
|
|
3343
|
-
/**
|
|
3344
|
-
Abort signal for cancelling the operation.
|
|
3345
|
-
*/
|
|
3346
|
-
abortSignal?: AbortSignal;
|
|
3347
|
-
/**
|
|
3348
|
-
Additional HTTP headers to be sent with the request.
|
|
3349
|
-
Only applicable for HTTP-based providers.
|
|
3350
|
-
*/
|
|
3351
|
-
headers?: Record<string, string | undefined>;
|
|
3352
|
-
};
|
|
3353
|
-
|
|
3354
3218
|
/**
|
|
3355
3219
|
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
3356
3220
|
some settings might not be supported, which can lead to suboptimal results.
|
|
@@ -3364,27 +3228,10 @@ declare type ImageModelV2CallWarning = {
|
|
|
3364
3228
|
message: string;
|
|
3365
3229
|
};
|
|
3366
3230
|
|
|
3367
|
-
/**
|
|
3368
|
-
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
3369
|
-
some settings might not be supported, which can lead to suboptimal results.
|
|
3370
|
-
*/
|
|
3371
|
-
declare type ImageModelV2CallWarning_2 = {
|
|
3372
|
-
type: 'unsupported-setting';
|
|
3373
|
-
setting: keyof ImageModelV2CallOptions_2;
|
|
3374
|
-
details?: string;
|
|
3375
|
-
} | {
|
|
3376
|
-
type: 'other';
|
|
3377
|
-
message: string;
|
|
3378
|
-
};
|
|
3379
|
-
|
|
3380
3231
|
declare type ImageModelV2ProviderMetadata = Record<string, {
|
|
3381
3232
|
images: JSONArray;
|
|
3382
3233
|
} & JSONValue_2>;
|
|
3383
3234
|
|
|
3384
|
-
declare type ImageModelV2ProviderMetadata_2 = Record<string, {
|
|
3385
|
-
images: JSONArray_2;
|
|
3386
|
-
} & JSONValue_3>;
|
|
3387
|
-
|
|
3388
3235
|
/**
|
|
3389
3236
|
Image content part of a prompt. It contains an image.
|
|
3390
3237
|
*/
|
|
@@ -3472,7 +3319,7 @@ declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPre
|
|
|
3472
3319
|
}): LanguageModelV2Prompt;
|
|
3473
3320
|
|
|
3474
3321
|
export declare class InvalidArgumentError extends AISDKError {
|
|
3475
|
-
private readonly [symbol$
|
|
3322
|
+
private readonly [symbol$c_2];
|
|
3476
3323
|
readonly parameter: string;
|
|
3477
3324
|
readonly value: unknown;
|
|
3478
3325
|
constructor({ parameter, value, message, }: {
|
|
@@ -3591,11 +3438,11 @@ export declare function isDeepEqualData(obj1: any, obj2: any): boolean;
|
|
|
3591
3438
|
*/
|
|
3592
3439
|
export declare function isFileUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is FileUIPart;
|
|
3593
3440
|
|
|
3594
|
-
declare function isJSONArray(value: unknown): value is
|
|
3441
|
+
declare function isJSONArray(value: unknown): value is JSONArray;
|
|
3595
3442
|
|
|
3596
|
-
declare function isJSONObject(value: unknown): value is
|
|
3443
|
+
declare function isJSONObject(value: unknown): value is JSONObject;
|
|
3597
3444
|
|
|
3598
|
-
declare function isJSONValue(value: unknown): value is
|
|
3445
|
+
declare function isJSONValue(value: unknown): value is JSONValue_2;
|
|
3599
3446
|
|
|
3600
3447
|
declare function isParsableJson(input: string): boolean;
|
|
3601
3448
|
|
|
@@ -3636,34 +3483,18 @@ declare type Job = () => Promise<void>;
|
|
|
3636
3483
|
|
|
3637
3484
|
declare type JSONArray = JSONValue_2[];
|
|
3638
3485
|
|
|
3639
|
-
declare type JSONArray_2 = JSONValue_3[];
|
|
3640
|
-
|
|
3641
3486
|
declare type JSONObject = {
|
|
3642
3487
|
[key: string]: JSONValue_2;
|
|
3643
3488
|
};
|
|
3644
3489
|
|
|
3645
|
-
declare type JSONObject_2 = {
|
|
3646
|
-
[key: string]: JSONValue_3;
|
|
3647
|
-
};
|
|
3648
|
-
|
|
3649
3490
|
export declare class JSONParseError extends AISDKError {
|
|
3650
|
-
private readonly [symbol$7_2];
|
|
3651
|
-
readonly text: string;
|
|
3652
|
-
constructor({ text, cause }: {
|
|
3653
|
-
text: string;
|
|
3654
|
-
cause: unknown;
|
|
3655
|
-
});
|
|
3656
|
-
static isInstance(error: unknown): error is JSONParseError;
|
|
3657
|
-
}
|
|
3658
|
-
|
|
3659
|
-
declare class JSONParseError_2 extends AISDKError_2 {
|
|
3660
3491
|
private readonly [symbol$7];
|
|
3661
3492
|
readonly text: string;
|
|
3662
3493
|
constructor({ text, cause }: {
|
|
3663
3494
|
text: string;
|
|
3664
3495
|
cause: unknown;
|
|
3665
3496
|
});
|
|
3666
|
-
static isInstance(error: unknown): error is
|
|
3497
|
+
static isInstance(error: unknown): error is JSONParseError;
|
|
3667
3498
|
}
|
|
3668
3499
|
|
|
3669
3500
|
/**
|
|
@@ -3839,7 +3670,7 @@ export declare class JsonToSseTransformStream extends TransformStream<unknown, s
|
|
|
3839
3670
|
constructor();
|
|
3840
3671
|
}
|
|
3841
3672
|
|
|
3842
|
-
export declare type JSONValue =
|
|
3673
|
+
export declare type JSONValue = JSONValue_2;
|
|
3843
3674
|
|
|
3844
3675
|
/**
|
|
3845
3676
|
A JSON value can be a string, number, boolean, object, array, or null.
|
|
@@ -3847,16 +3678,14 @@ export declare type JSONValue = JSONValue_3;
|
|
|
3847
3678
|
*/
|
|
3848
3679
|
declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
|
|
3849
3680
|
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
*/
|
|
3854
|
-
declare type JSONValue_3 = null | string | number | boolean | JSONObject_2 | JSONArray_2;
|
|
3681
|
+
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language"];
|
|
3682
|
+
|
|
3683
|
+
declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
|
|
3855
3684
|
|
|
3856
3685
|
/**
|
|
3857
3686
|
Language model that is used by the AI SDK Core functions.
|
|
3858
3687
|
*/
|
|
3859
|
-
export declare type LanguageModel = GlobalProviderModelId |
|
|
3688
|
+
export declare type LanguageModel = GlobalProviderModelId | LanguageModelV2;
|
|
3860
3689
|
|
|
3861
3690
|
export declare type LanguageModelMiddleware = LanguageModelV2Middleware;
|
|
3862
3691
|
|
|
@@ -3889,7 +3718,7 @@ export declare type LanguageModelResponseMetadata = {
|
|
|
3889
3718
|
/**
|
|
3890
3719
|
Represents the number of tokens used in a prompt and completion.
|
|
3891
3720
|
*/
|
|
3892
|
-
export declare type LanguageModelUsage =
|
|
3721
|
+
export declare type LanguageModelUsage = LanguageModelV2Usage;
|
|
3893
3722
|
|
|
3894
3723
|
/**
|
|
3895
3724
|
Specification for a language model that implements the language model interface version 2.
|
|
@@ -4003,118 +3832,6 @@ declare type LanguageModelV2 = {
|
|
|
4003
3832
|
}>;
|
|
4004
3833
|
};
|
|
4005
3834
|
|
|
4006
|
-
/**
|
|
4007
|
-
Specification for a language model that implements the language model interface version 2.
|
|
4008
|
-
*/
|
|
4009
|
-
declare type LanguageModelV2_2 = {
|
|
4010
|
-
/**
|
|
4011
|
-
The language model must specify which language model interface version it implements.
|
|
4012
|
-
*/
|
|
4013
|
-
readonly specificationVersion: 'v2';
|
|
4014
|
-
/**
|
|
4015
|
-
Name of the provider for logging purposes.
|
|
4016
|
-
*/
|
|
4017
|
-
readonly provider: string;
|
|
4018
|
-
/**
|
|
4019
|
-
Provider-specific model ID for logging purposes.
|
|
4020
|
-
*/
|
|
4021
|
-
readonly modelId: string;
|
|
4022
|
-
/**
|
|
4023
|
-
Supported URL patterns by media type for the provider.
|
|
4024
|
-
|
|
4025
|
-
The keys are media type patterns or full media types (e.g. `*\/*` for everything, `audio/*`, `video/*`, or `application/pdf`).
|
|
4026
|
-
and the values are arrays of regular expressions that match the URL paths.
|
|
4027
|
-
|
|
4028
|
-
The matching should be against lower-case URLs.
|
|
4029
|
-
|
|
4030
|
-
Matched URLs are supported natively by the model and are not downloaded.
|
|
4031
|
-
|
|
4032
|
-
@returns A map of supported URL patterns by media type (as a promise or a plain object).
|
|
4033
|
-
*/
|
|
4034
|
-
supportedUrls: PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>;
|
|
4035
|
-
/**
|
|
4036
|
-
Generates a language model output (non-streaming).
|
|
4037
|
-
|
|
4038
|
-
Naming: "do" prefix to prevent accidental direct usage of the method
|
|
4039
|
-
by the user.
|
|
4040
|
-
*/
|
|
4041
|
-
doGenerate(options: LanguageModelV2CallOptions_2): PromiseLike<{
|
|
4042
|
-
/**
|
|
4043
|
-
Ordered content that the model has generated.
|
|
4044
|
-
*/
|
|
4045
|
-
content: Array<LanguageModelV2Content_2>;
|
|
4046
|
-
/**
|
|
4047
|
-
Finish reason.
|
|
4048
|
-
*/
|
|
4049
|
-
finishReason: LanguageModelV2FinishReason_2;
|
|
4050
|
-
/**
|
|
4051
|
-
Usage information.
|
|
4052
|
-
*/
|
|
4053
|
-
usage: LanguageModelV2Usage_2;
|
|
4054
|
-
/**
|
|
4055
|
-
Additional provider-specific metadata. They are passed through
|
|
4056
|
-
from the provider to the AI SDK and enable provider-specific
|
|
4057
|
-
results that can be fully encapsulated in the provider.
|
|
4058
|
-
*/
|
|
4059
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4060
|
-
/**
|
|
4061
|
-
Optional request information for telemetry and debugging purposes.
|
|
4062
|
-
*/
|
|
4063
|
-
request?: {
|
|
4064
|
-
/**
|
|
4065
|
-
Request HTTP body that was sent to the provider API.
|
|
4066
|
-
*/
|
|
4067
|
-
body?: unknown;
|
|
4068
|
-
};
|
|
4069
|
-
/**
|
|
4070
|
-
Optional response information for telemetry and debugging purposes.
|
|
4071
|
-
*/
|
|
4072
|
-
response?: LanguageModelV2ResponseMetadata_2 & {
|
|
4073
|
-
/**
|
|
4074
|
-
Response headers.
|
|
4075
|
-
*/
|
|
4076
|
-
headers?: SharedV2Headers_2;
|
|
4077
|
-
/**
|
|
4078
|
-
Response HTTP body.
|
|
4079
|
-
*/
|
|
4080
|
-
body?: unknown;
|
|
4081
|
-
};
|
|
4082
|
-
/**
|
|
4083
|
-
Warnings for the call, e.g. unsupported settings.
|
|
4084
|
-
*/
|
|
4085
|
-
warnings: Array<LanguageModelV2CallWarning_2>;
|
|
4086
|
-
}>;
|
|
4087
|
-
/**
|
|
4088
|
-
Generates a language model output (streaming).
|
|
4089
|
-
|
|
4090
|
-
Naming: "do" prefix to prevent accidental direct usage of the method
|
|
4091
|
-
by the user.
|
|
4092
|
-
*
|
|
4093
|
-
@return A stream of higher-level language model output parts.
|
|
4094
|
-
*/
|
|
4095
|
-
doStream(options: LanguageModelV2CallOptions_2): PromiseLike<{
|
|
4096
|
-
stream: ReadableStream<LanguageModelV2StreamPart_2>;
|
|
4097
|
-
/**
|
|
4098
|
-
Optional request information for telemetry and debugging purposes.
|
|
4099
|
-
*/
|
|
4100
|
-
request?: {
|
|
4101
|
-
/**
|
|
4102
|
-
Request HTTP body that was sent to the provider API.
|
|
4103
|
-
*/
|
|
4104
|
-
body?: unknown;
|
|
4105
|
-
};
|
|
4106
|
-
/**
|
|
4107
|
-
Optional response data.
|
|
4108
|
-
*/
|
|
4109
|
-
response?: {
|
|
4110
|
-
/**
|
|
4111
|
-
Response headers.
|
|
4112
|
-
*/
|
|
4113
|
-
headers?: SharedV2Headers_2;
|
|
4114
|
-
};
|
|
4115
|
-
}>;
|
|
4116
|
-
};
|
|
4117
|
-
|
|
4118
3835
|
declare type LanguageModelV2CallOptions = {
|
|
4119
3836
|
/**
|
|
4120
3837
|
A language mode prompt is a standardized prompt type.
|
|
@@ -4216,107 +3933,6 @@ declare type LanguageModelV2CallOptions = {
|
|
|
4216
3933
|
providerOptions?: SharedV2ProviderOptions;
|
|
4217
3934
|
};
|
|
4218
3935
|
|
|
4219
|
-
declare type LanguageModelV2CallOptions_2 = {
|
|
4220
|
-
/**
|
|
4221
|
-
A language mode prompt is a standardized prompt type.
|
|
4222
|
-
|
|
4223
|
-
Note: This is **not** the user-facing prompt. The AI SDK methods will map the
|
|
4224
|
-
user-facing prompt types such as chat or instruction prompts to this format.
|
|
4225
|
-
That approach allows us to evolve the user facing prompts without breaking
|
|
4226
|
-
the language model interface.
|
|
4227
|
-
*/
|
|
4228
|
-
prompt: LanguageModelV2Prompt_2;
|
|
4229
|
-
/**
|
|
4230
|
-
Maximum number of tokens to generate.
|
|
4231
|
-
*/
|
|
4232
|
-
maxOutputTokens?: number;
|
|
4233
|
-
/**
|
|
4234
|
-
Temperature setting. The range depends on the provider and model.
|
|
4235
|
-
*/
|
|
4236
|
-
temperature?: number;
|
|
4237
|
-
/**
|
|
4238
|
-
Stop sequences.
|
|
4239
|
-
If set, the model will stop generating text when one of the stop sequences is generated.
|
|
4240
|
-
Providers may have limits on the number of stop sequences.
|
|
4241
|
-
*/
|
|
4242
|
-
stopSequences?: string[];
|
|
4243
|
-
/**
|
|
4244
|
-
Nucleus sampling.
|
|
4245
|
-
*/
|
|
4246
|
-
topP?: number;
|
|
4247
|
-
/**
|
|
4248
|
-
Only sample from the top K options for each subsequent token.
|
|
4249
|
-
|
|
4250
|
-
Used to remove "long tail" low probability responses.
|
|
4251
|
-
Recommended for advanced use cases only. You usually only need to use temperature.
|
|
4252
|
-
*/
|
|
4253
|
-
topK?: number;
|
|
4254
|
-
/**
|
|
4255
|
-
Presence penalty setting. It affects the likelihood of the model to
|
|
4256
|
-
repeat information that is already in the prompt.
|
|
4257
|
-
*/
|
|
4258
|
-
presencePenalty?: number;
|
|
4259
|
-
/**
|
|
4260
|
-
Frequency penalty setting. It affects the likelihood of the model
|
|
4261
|
-
to repeatedly use the same words or phrases.
|
|
4262
|
-
*/
|
|
4263
|
-
frequencyPenalty?: number;
|
|
4264
|
-
/**
|
|
4265
|
-
Response format. The output can either be text or JSON. Default is text.
|
|
4266
|
-
|
|
4267
|
-
If JSON is selected, a schema can optionally be provided to guide the LLM.
|
|
4268
|
-
*/
|
|
4269
|
-
responseFormat?: {
|
|
4270
|
-
type: 'text';
|
|
4271
|
-
} | {
|
|
4272
|
-
type: 'json';
|
|
4273
|
-
/**
|
|
4274
|
-
* JSON schema that the generated output should conform to.
|
|
4275
|
-
*/
|
|
4276
|
-
schema?: JSONSchema7;
|
|
4277
|
-
/**
|
|
4278
|
-
* Name of output that should be generated. Used by some providers for additional LLM guidance.
|
|
4279
|
-
*/
|
|
4280
|
-
name?: string;
|
|
4281
|
-
/**
|
|
4282
|
-
* Description of the output that should be generated. Used by some providers for additional LLM guidance.
|
|
4283
|
-
*/
|
|
4284
|
-
description?: string;
|
|
4285
|
-
};
|
|
4286
|
-
/**
|
|
4287
|
-
The seed (integer) to use for random sampling. If set and supported
|
|
4288
|
-
by the model, calls will generate deterministic results.
|
|
4289
|
-
*/
|
|
4290
|
-
seed?: number;
|
|
4291
|
-
/**
|
|
4292
|
-
The tools that are available for the model.
|
|
4293
|
-
*/
|
|
4294
|
-
tools?: Array<LanguageModelV2FunctionTool_2 | LanguageModelV2ProviderDefinedTool_2>;
|
|
4295
|
-
/**
|
|
4296
|
-
Specifies how the tool should be selected. Defaults to 'auto'.
|
|
4297
|
-
*/
|
|
4298
|
-
toolChoice?: LanguageModelV2ToolChoice_2;
|
|
4299
|
-
/**
|
|
4300
|
-
Include raw chunks in the stream. Only applicable for streaming calls.
|
|
4301
|
-
*/
|
|
4302
|
-
includeRawChunks?: boolean;
|
|
4303
|
-
/**
|
|
4304
|
-
Abort signal for cancelling the operation.
|
|
4305
|
-
*/
|
|
4306
|
-
abortSignal?: AbortSignal;
|
|
4307
|
-
/**
|
|
4308
|
-
Additional HTTP headers to be sent with the request.
|
|
4309
|
-
Only applicable for HTTP-based providers.
|
|
4310
|
-
*/
|
|
4311
|
-
headers?: Record<string, string | undefined>;
|
|
4312
|
-
/**
|
|
4313
|
-
* Additional provider-specific options. They are passed through
|
|
4314
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
4315
|
-
* functionality that can be fully encapsulated in the provider.
|
|
4316
|
-
*/
|
|
4317
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
4318
|
-
};
|
|
4319
|
-
|
|
4320
3936
|
/**
|
|
4321
3937
|
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
4322
3938
|
some settings might not be supported, which can lead to suboptimal results.
|
|
@@ -4334,37 +3950,13 @@ declare type LanguageModelV2CallWarning = {
|
|
|
4334
3950
|
message: string;
|
|
4335
3951
|
};
|
|
4336
3952
|
|
|
4337
|
-
/**
|
|
4338
|
-
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
4339
|
-
some settings might not be supported, which can lead to suboptimal results.
|
|
4340
|
-
*/
|
|
4341
|
-
declare type LanguageModelV2CallWarning_2 = {
|
|
4342
|
-
type: 'unsupported-setting';
|
|
4343
|
-
setting: Omit<keyof LanguageModelV2CallOptions_2, 'prompt'>;
|
|
4344
|
-
details?: string;
|
|
4345
|
-
} | {
|
|
4346
|
-
type: 'unsupported-tool';
|
|
4347
|
-
tool: LanguageModelV2FunctionTool_2 | LanguageModelV2ProviderDefinedTool_2;
|
|
4348
|
-
details?: string;
|
|
4349
|
-
} | {
|
|
4350
|
-
type: 'other';
|
|
4351
|
-
message: string;
|
|
4352
|
-
};
|
|
4353
|
-
|
|
4354
3953
|
declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reasoning | LanguageModelV2File | LanguageModelV2Source | LanguageModelV2ToolCall | LanguageModelV2ToolResult;
|
|
4355
3954
|
|
|
4356
|
-
declare type LanguageModelV2Content_2 = LanguageModelV2Text_2 | LanguageModelV2Reasoning_2 | LanguageModelV2File_2 | LanguageModelV2Source_2 | LanguageModelV2ToolCall_2 | LanguageModelV2ToolResult_2;
|
|
4357
|
-
|
|
4358
3955
|
/**
|
|
4359
3956
|
Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
4360
3957
|
*/
|
|
4361
3958
|
declare type LanguageModelV2DataContent = Uint8Array | string | URL;
|
|
4362
3959
|
|
|
4363
|
-
/**
|
|
4364
|
-
Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
4365
|
-
*/
|
|
4366
|
-
declare type LanguageModelV2DataContent_2 = Uint8Array | string | URL;
|
|
4367
|
-
|
|
4368
3960
|
/**
|
|
4369
3961
|
A file that has been generated by the model.
|
|
4370
3962
|
Generated files as base64 encoded strings or binary data.
|
|
@@ -4389,30 +3981,6 @@ declare type LanguageModelV2File = {
|
|
|
4389
3981
|
data: string | Uint8Array;
|
|
4390
3982
|
};
|
|
4391
3983
|
|
|
4392
|
-
/**
|
|
4393
|
-
A file that has been generated by the model.
|
|
4394
|
-
Generated files as base64 encoded strings or binary data.
|
|
4395
|
-
The files should be returned without any unnecessary conversion.
|
|
4396
|
-
*/
|
|
4397
|
-
declare type LanguageModelV2File_2 = {
|
|
4398
|
-
type: 'file';
|
|
4399
|
-
/**
|
|
4400
|
-
The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
|
|
4401
|
-
|
|
4402
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4403
|
-
*/
|
|
4404
|
-
mediaType: string;
|
|
4405
|
-
/**
|
|
4406
|
-
Generated file data as base64 encoded strings or binary data.
|
|
4407
|
-
|
|
4408
|
-
The file data should be returned without any unnecessary conversion.
|
|
4409
|
-
If the API returns base64 encoded strings, the file data should be returned
|
|
4410
|
-
as base64 encoded strings. If the API returns binary data, the file data should
|
|
4411
|
-
be returned as binary data.
|
|
4412
|
-
*/
|
|
4413
|
-
data: string | Uint8Array;
|
|
4414
|
-
};
|
|
4415
|
-
|
|
4416
3984
|
/**
|
|
4417
3985
|
File content part of a prompt. It contains a file.
|
|
4418
3986
|
*/
|
|
@@ -4442,35 +4010,6 @@ declare interface LanguageModelV2FilePart {
|
|
|
4442
4010
|
providerOptions?: SharedV2ProviderOptions;
|
|
4443
4011
|
}
|
|
4444
4012
|
|
|
4445
|
-
/**
|
|
4446
|
-
File content part of a prompt. It contains a file.
|
|
4447
|
-
*/
|
|
4448
|
-
declare interface LanguageModelV2FilePart_2 {
|
|
4449
|
-
type: 'file';
|
|
4450
|
-
/**
|
|
4451
|
-
* Optional filename of the file.
|
|
4452
|
-
*/
|
|
4453
|
-
filename?: string;
|
|
4454
|
-
/**
|
|
4455
|
-
File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
4456
|
-
*/
|
|
4457
|
-
data: LanguageModelV2DataContent_2;
|
|
4458
|
-
/**
|
|
4459
|
-
IANA media type of the file.
|
|
4460
|
-
|
|
4461
|
-
Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
|
|
4462
|
-
|
|
4463
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4464
|
-
*/
|
|
4465
|
-
mediaType: string;
|
|
4466
|
-
/**
|
|
4467
|
-
* Additional provider-specific options. They are passed through
|
|
4468
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
4469
|
-
* functionality that can be fully encapsulated in the provider.
|
|
4470
|
-
*/
|
|
4471
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
4472
|
-
}
|
|
4473
|
-
|
|
4474
4013
|
/**
|
|
4475
4014
|
Reason why a language model finished generating a response.
|
|
4476
4015
|
|
|
@@ -4485,20 +4024,6 @@ declare interface LanguageModelV2FilePart_2 {
|
|
|
4485
4024
|
*/
|
|
4486
4025
|
declare type LanguageModelV2FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
|
|
4487
4026
|
|
|
4488
|
-
/**
|
|
4489
|
-
Reason why a language model finished generating a response.
|
|
4490
|
-
|
|
4491
|
-
Can be one of the following:
|
|
4492
|
-
- `stop`: model generated stop sequence
|
|
4493
|
-
- `length`: model generated maximum number of tokens
|
|
4494
|
-
- `content-filter`: content filter violation stopped the model
|
|
4495
|
-
- `tool-calls`: model triggered tool calls
|
|
4496
|
-
- `error`: model stopped because of an error
|
|
4497
|
-
- `other`: model stopped for other reasons
|
|
4498
|
-
- `unknown`: the model has not transmitted a finish reason
|
|
4499
|
-
*/
|
|
4500
|
-
declare type LanguageModelV2FinishReason_2 = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
|
|
4501
|
-
|
|
4502
4027
|
/**
|
|
4503
4028
|
A tool has a name, a description, and a set of parameters.
|
|
4504
4029
|
|
|
@@ -4530,37 +4055,6 @@ declare type LanguageModelV2FunctionTool = {
|
|
|
4530
4055
|
providerOptions?: SharedV2ProviderOptions;
|
|
4531
4056
|
};
|
|
4532
4057
|
|
|
4533
|
-
/**
|
|
4534
|
-
A tool has a name, a description, and a set of parameters.
|
|
4535
|
-
|
|
4536
|
-
Note: this is **not** the user-facing tool definition. The AI SDK methods will
|
|
4537
|
-
map the user-facing tool definitions to this format.
|
|
4538
|
-
*/
|
|
4539
|
-
declare type LanguageModelV2FunctionTool_2 = {
|
|
4540
|
-
/**
|
|
4541
|
-
The type of the tool (always 'function').
|
|
4542
|
-
*/
|
|
4543
|
-
type: 'function';
|
|
4544
|
-
/**
|
|
4545
|
-
The name of the tool. Unique within this model call.
|
|
4546
|
-
*/
|
|
4547
|
-
name: string;
|
|
4548
|
-
/**
|
|
4549
|
-
A description of the tool. The language model uses this to understand the
|
|
4550
|
-
tool's purpose and to provide better completion suggestions.
|
|
4551
|
-
*/
|
|
4552
|
-
description?: string;
|
|
4553
|
-
/**
|
|
4554
|
-
The parameters that the tool expects. The language model uses this to
|
|
4555
|
-
understand the tool's input requirements and to provide matching suggestions.
|
|
4556
|
-
*/
|
|
4557
|
-
inputSchema: JSONSchema7;
|
|
4558
|
-
/**
|
|
4559
|
-
The provider-specific options for the tool.
|
|
4560
|
-
*/
|
|
4561
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
4562
|
-
};
|
|
4563
|
-
|
|
4564
4058
|
declare type LanguageModelV2Message = ({
|
|
4565
4059
|
role: 'system';
|
|
4566
4060
|
content: string;
|
|
@@ -4582,27 +4076,6 @@ declare type LanguageModelV2Message = ({
|
|
|
4582
4076
|
providerOptions?: SharedV2ProviderOptions;
|
|
4583
4077
|
};
|
|
4584
4078
|
|
|
4585
|
-
declare type LanguageModelV2Message_2 = ({
|
|
4586
|
-
role: 'system';
|
|
4587
|
-
content: string;
|
|
4588
|
-
} | {
|
|
4589
|
-
role: 'user';
|
|
4590
|
-
content: Array<LanguageModelV2TextPart_2 | LanguageModelV2FilePart_2>;
|
|
4591
|
-
} | {
|
|
4592
|
-
role: 'assistant';
|
|
4593
|
-
content: Array<LanguageModelV2TextPart_2 | LanguageModelV2FilePart_2 | LanguageModelV2ReasoningPart_2 | LanguageModelV2ToolCallPart_2 | LanguageModelV2ToolResultPart_2>;
|
|
4594
|
-
} | {
|
|
4595
|
-
role: 'tool';
|
|
4596
|
-
content: Array<LanguageModelV2ToolResultPart_2>;
|
|
4597
|
-
}) & {
|
|
4598
|
-
/**
|
|
4599
|
-
* Additional provider-specific options. They are passed through
|
|
4600
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
4601
|
-
* functionality that can be fully encapsulated in the provider.
|
|
4602
|
-
*/
|
|
4603
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
4604
|
-
};
|
|
4605
|
-
|
|
4606
4079
|
/**
|
|
4607
4080
|
* Experimental middleware for LanguageModelV2.
|
|
4608
4081
|
* This type defines the structure for middleware that can be used to modify
|
|
@@ -4618,21 +4091,21 @@ declare type LanguageModelV2Middleware = {
|
|
|
4618
4091
|
* @param options.model - The language model instance.
|
|
4619
4092
|
*/
|
|
4620
4093
|
overrideProvider?: (options: {
|
|
4621
|
-
model:
|
|
4094
|
+
model: LanguageModelV2;
|
|
4622
4095
|
}) => string;
|
|
4623
4096
|
/**
|
|
4624
4097
|
* Override the model ID if desired.
|
|
4625
4098
|
* @param options.model - The language model instance.
|
|
4626
4099
|
*/
|
|
4627
4100
|
overrideModelId?: (options: {
|
|
4628
|
-
model:
|
|
4101
|
+
model: LanguageModelV2;
|
|
4629
4102
|
}) => string;
|
|
4630
4103
|
/**
|
|
4631
4104
|
* Override the supported URLs if desired.
|
|
4632
4105
|
* @param options.model - The language model instance.
|
|
4633
4106
|
*/
|
|
4634
4107
|
overrideSupportedUrls?: (options: {
|
|
4635
|
-
model:
|
|
4108
|
+
model: LanguageModelV2;
|
|
4636
4109
|
}) => PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>;
|
|
4637
4110
|
/**
|
|
4638
4111
|
* Transforms the parameters before they are passed to the language model.
|
|
@@ -4643,9 +4116,9 @@ declare type LanguageModelV2Middleware = {
|
|
|
4643
4116
|
*/
|
|
4644
4117
|
transformParams?: (options: {
|
|
4645
4118
|
type: 'generate' | 'stream';
|
|
4646
|
-
params:
|
|
4647
|
-
model:
|
|
4648
|
-
}) => PromiseLike<
|
|
4119
|
+
params: LanguageModelV2CallOptions;
|
|
4120
|
+
model: LanguageModelV2;
|
|
4121
|
+
}) => PromiseLike<LanguageModelV2CallOptions>;
|
|
4649
4122
|
/**
|
|
4650
4123
|
* Wraps the generate operation of the language model.
|
|
4651
4124
|
* @param options - Object containing the generate function, parameters, and model.
|
|
@@ -4657,11 +4130,11 @@ declare type LanguageModelV2Middleware = {
|
|
|
4657
4130
|
* @returns A promise that resolves to the result of the generate operation.
|
|
4658
4131
|
*/
|
|
4659
4132
|
wrapGenerate?: (options: {
|
|
4660
|
-
doGenerate: () => ReturnType<
|
|
4661
|
-
doStream: () => ReturnType<
|
|
4662
|
-
params:
|
|
4663
|
-
model:
|
|
4664
|
-
}) => Promise<Awaited<ReturnType<
|
|
4133
|
+
doGenerate: () => ReturnType<LanguageModelV2['doGenerate']>;
|
|
4134
|
+
doStream: () => ReturnType<LanguageModelV2['doStream']>;
|
|
4135
|
+
params: LanguageModelV2CallOptions;
|
|
4136
|
+
model: LanguageModelV2;
|
|
4137
|
+
}) => Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
|
|
4665
4138
|
/**
|
|
4666
4139
|
* Wraps the stream operation of the language model.
|
|
4667
4140
|
*
|
|
@@ -4674,11 +4147,11 @@ declare type LanguageModelV2Middleware = {
|
|
|
4674
4147
|
* @returns A promise that resolves to the result of the stream operation.
|
|
4675
4148
|
*/
|
|
4676
4149
|
wrapStream?: (options: {
|
|
4677
|
-
doGenerate: () => ReturnType<
|
|
4678
|
-
doStream: () => ReturnType<
|
|
4679
|
-
params:
|
|
4680
|
-
model:
|
|
4681
|
-
}) => PromiseLike<Awaited<ReturnType<
|
|
4150
|
+
doGenerate: () => ReturnType<LanguageModelV2['doGenerate']>;
|
|
4151
|
+
doStream: () => ReturnType<LanguageModelV2['doStream']>;
|
|
4152
|
+
params: LanguageModelV2CallOptions;
|
|
4153
|
+
model: LanguageModelV2;
|
|
4154
|
+
}) => PromiseLike<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
|
|
4682
4155
|
};
|
|
4683
4156
|
|
|
4684
4157
|
/**
|
|
@@ -4692,17 +4165,6 @@ declare type LanguageModelV2Middleware = {
|
|
|
4692
4165
|
*/
|
|
4693
4166
|
declare type LanguageModelV2Prompt = Array<LanguageModelV2Message>;
|
|
4694
4167
|
|
|
4695
|
-
/**
|
|
4696
|
-
A prompt is a list of messages.
|
|
4697
|
-
|
|
4698
|
-
Note: Not all models and prompt formats support multi-modal inputs and
|
|
4699
|
-
tool calls. The validation happens at runtime.
|
|
4700
|
-
|
|
4701
|
-
Note: This is not a user-facing prompt. The AI SDK methods will map the
|
|
4702
|
-
user-facing prompt types such as chat or instruction prompts to this format.
|
|
4703
|
-
*/
|
|
4704
|
-
declare type LanguageModelV2Prompt_2 = Array<LanguageModelV2Message_2>;
|
|
4705
|
-
|
|
4706
4168
|
/**
|
|
4707
4169
|
The configuration of a tool that is defined by the provider.
|
|
4708
4170
|
*/
|
|
@@ -4725,28 +4187,6 @@ declare type LanguageModelV2ProviderDefinedTool = {
|
|
|
4725
4187
|
args: Record<string, unknown>;
|
|
4726
4188
|
};
|
|
4727
4189
|
|
|
4728
|
-
/**
|
|
4729
|
-
The configuration of a tool that is defined by the provider.
|
|
4730
|
-
*/
|
|
4731
|
-
declare type LanguageModelV2ProviderDefinedTool_2 = {
|
|
4732
|
-
/**
|
|
4733
|
-
The type of the tool (always 'provider-defined').
|
|
4734
|
-
*/
|
|
4735
|
-
type: 'provider-defined';
|
|
4736
|
-
/**
|
|
4737
|
-
The ID of the tool. Should follow the format `<provider-name>.<unique-tool-name>`.
|
|
4738
|
-
*/
|
|
4739
|
-
id: `${string}.${string}`;
|
|
4740
|
-
/**
|
|
4741
|
-
The name of the tool that the user must use in the tool set.
|
|
4742
|
-
*/
|
|
4743
|
-
name: string;
|
|
4744
|
-
/**
|
|
4745
|
-
The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
|
|
4746
|
-
*/
|
|
4747
|
-
args: Record<string, unknown>;
|
|
4748
|
-
};
|
|
4749
|
-
|
|
4750
4190
|
/**
|
|
4751
4191
|
Reasoning that the model has generated.
|
|
4752
4192
|
*/
|
|
@@ -4759,18 +4199,6 @@ declare type LanguageModelV2Reasoning = {
|
|
|
4759
4199
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
4760
4200
|
};
|
|
4761
4201
|
|
|
4762
|
-
/**
|
|
4763
|
-
Reasoning that the model has generated.
|
|
4764
|
-
*/
|
|
4765
|
-
declare type LanguageModelV2Reasoning_2 = {
|
|
4766
|
-
type: 'reasoning';
|
|
4767
|
-
text: string;
|
|
4768
|
-
/**
|
|
4769
|
-
* Optional provider-specific metadata for the reasoning part.
|
|
4770
|
-
*/
|
|
4771
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4772
|
-
};
|
|
4773
|
-
|
|
4774
4202
|
/**
|
|
4775
4203
|
Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
4776
4204
|
*/
|
|
@@ -4788,23 +4216,6 @@ declare interface LanguageModelV2ReasoningPart {
|
|
|
4788
4216
|
providerOptions?: SharedV2ProviderOptions;
|
|
4789
4217
|
}
|
|
4790
4218
|
|
|
4791
|
-
/**
|
|
4792
|
-
Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
4793
|
-
*/
|
|
4794
|
-
declare interface LanguageModelV2ReasoningPart_2 {
|
|
4795
|
-
type: 'reasoning';
|
|
4796
|
-
/**
|
|
4797
|
-
The reasoning text.
|
|
4798
|
-
*/
|
|
4799
|
-
text: string;
|
|
4800
|
-
/**
|
|
4801
|
-
* Additional provider-specific options. They are passed through
|
|
4802
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
4803
|
-
* functionality that can be fully encapsulated in the provider.
|
|
4804
|
-
*/
|
|
4805
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
4806
|
-
}
|
|
4807
|
-
|
|
4808
4219
|
declare interface LanguageModelV2ResponseMetadata {
|
|
4809
4220
|
/**
|
|
4810
4221
|
ID for the generated response, if the provider sends one.
|
|
@@ -4820,21 +4231,6 @@ declare interface LanguageModelV2ResponseMetadata {
|
|
|
4820
4231
|
modelId?: string;
|
|
4821
4232
|
}
|
|
4822
4233
|
|
|
4823
|
-
declare interface LanguageModelV2ResponseMetadata_2 {
|
|
4824
|
-
/**
|
|
4825
|
-
ID for the generated response, if the provider sends one.
|
|
4826
|
-
*/
|
|
4827
|
-
id?: string;
|
|
4828
|
-
/**
|
|
4829
|
-
Timestamp for the start of the generated response, if the provider sends one.
|
|
4830
|
-
*/
|
|
4831
|
-
timestamp?: Date;
|
|
4832
|
-
/**
|
|
4833
|
-
The ID of the response model that was used to generate the response, if the provider sends one.
|
|
4834
|
-
*/
|
|
4835
|
-
modelId?: string;
|
|
4836
|
-
}
|
|
4837
|
-
|
|
4838
4234
|
/**
|
|
4839
4235
|
A source that has been used as input to generate the response.
|
|
4840
4236
|
*/
|
|
@@ -4888,59 +4284,6 @@ declare type LanguageModelV2Source = {
|
|
|
4888
4284
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
4889
4285
|
};
|
|
4890
4286
|
|
|
4891
|
-
/**
|
|
4892
|
-
A source that has been used as input to generate the response.
|
|
4893
|
-
*/
|
|
4894
|
-
declare type LanguageModelV2Source_2 = {
|
|
4895
|
-
type: 'source';
|
|
4896
|
-
/**
|
|
4897
|
-
* The type of source - URL sources reference web content.
|
|
4898
|
-
*/
|
|
4899
|
-
sourceType: 'url';
|
|
4900
|
-
/**
|
|
4901
|
-
* The ID of the source.
|
|
4902
|
-
*/
|
|
4903
|
-
id: string;
|
|
4904
|
-
/**
|
|
4905
|
-
* The URL of the source.
|
|
4906
|
-
*/
|
|
4907
|
-
url: string;
|
|
4908
|
-
/**
|
|
4909
|
-
* The title of the source.
|
|
4910
|
-
*/
|
|
4911
|
-
title?: string;
|
|
4912
|
-
/**
|
|
4913
|
-
* Additional provider metadata for the source.
|
|
4914
|
-
*/
|
|
4915
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4916
|
-
} | {
|
|
4917
|
-
type: 'source';
|
|
4918
|
-
/**
|
|
4919
|
-
* The type of source - document sources reference files/documents.
|
|
4920
|
-
*/
|
|
4921
|
-
sourceType: 'document';
|
|
4922
|
-
/**
|
|
4923
|
-
* The ID of the source.
|
|
4924
|
-
*/
|
|
4925
|
-
id: string;
|
|
4926
|
-
/**
|
|
4927
|
-
* IANA media type of the document (e.g., 'application/pdf').
|
|
4928
|
-
*/
|
|
4929
|
-
mediaType: string;
|
|
4930
|
-
/**
|
|
4931
|
-
* The title of the document.
|
|
4932
|
-
*/
|
|
4933
|
-
title: string;
|
|
4934
|
-
/**
|
|
4935
|
-
* Optional filename of the document.
|
|
4936
|
-
*/
|
|
4937
|
-
filename?: string;
|
|
4938
|
-
/**
|
|
4939
|
-
* Additional provider metadata for the source.
|
|
4940
|
-
*/
|
|
4941
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
4942
|
-
};
|
|
4943
|
-
|
|
4944
4287
|
declare type LanguageModelV2StreamPart = {
|
|
4945
4288
|
type: 'text-start';
|
|
4946
4289
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
@@ -5000,65 +4343,6 @@ declare type LanguageModelV2StreamPart = {
|
|
|
5000
4343
|
error: unknown;
|
|
5001
4344
|
};
|
|
5002
4345
|
|
|
5003
|
-
declare type LanguageModelV2StreamPart_2 = {
|
|
5004
|
-
type: 'text-start';
|
|
5005
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5006
|
-
id: string;
|
|
5007
|
-
} | {
|
|
5008
|
-
type: 'text-delta';
|
|
5009
|
-
id: string;
|
|
5010
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5011
|
-
delta: string;
|
|
5012
|
-
} | {
|
|
5013
|
-
type: 'text-end';
|
|
5014
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5015
|
-
id: string;
|
|
5016
|
-
} | {
|
|
5017
|
-
type: 'reasoning-start';
|
|
5018
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5019
|
-
id: string;
|
|
5020
|
-
} | {
|
|
5021
|
-
type: 'reasoning-delta';
|
|
5022
|
-
id: string;
|
|
5023
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5024
|
-
delta: string;
|
|
5025
|
-
} | {
|
|
5026
|
-
type: 'reasoning-end';
|
|
5027
|
-
id: string;
|
|
5028
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5029
|
-
} | {
|
|
5030
|
-
type: 'tool-input-start';
|
|
5031
|
-
id: string;
|
|
5032
|
-
toolName: string;
|
|
5033
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5034
|
-
providerExecuted?: boolean;
|
|
5035
|
-
} | {
|
|
5036
|
-
type: 'tool-input-delta';
|
|
5037
|
-
id: string;
|
|
5038
|
-
delta: string;
|
|
5039
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5040
|
-
} | {
|
|
5041
|
-
type: 'tool-input-end';
|
|
5042
|
-
id: string;
|
|
5043
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5044
|
-
} | LanguageModelV2ToolCall_2 | LanguageModelV2ToolResult_2 | LanguageModelV2File_2 | LanguageModelV2Source_2 | {
|
|
5045
|
-
type: 'stream-start';
|
|
5046
|
-
warnings: Array<LanguageModelV2CallWarning_2>;
|
|
5047
|
-
} | ({
|
|
5048
|
-
type: 'response-metadata';
|
|
5049
|
-
} & LanguageModelV2ResponseMetadata_2) | {
|
|
5050
|
-
type: 'finish';
|
|
5051
|
-
usage: LanguageModelV2Usage_2;
|
|
5052
|
-
finishReason: LanguageModelV2FinishReason_2;
|
|
5053
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5054
|
-
} | {
|
|
5055
|
-
type: 'raw';
|
|
5056
|
-
rawValue: unknown;
|
|
5057
|
-
} | {
|
|
5058
|
-
type: 'error';
|
|
5059
|
-
error: unknown;
|
|
5060
|
-
};
|
|
5061
|
-
|
|
5062
4346
|
/**
|
|
5063
4347
|
Text that the model has generated.
|
|
5064
4348
|
*/
|
|
@@ -5071,18 +4355,6 @@ declare type LanguageModelV2Text = {
|
|
|
5071
4355
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
5072
4356
|
};
|
|
5073
4357
|
|
|
5074
|
-
/**
|
|
5075
|
-
Text that the model has generated.
|
|
5076
|
-
*/
|
|
5077
|
-
declare type LanguageModelV2Text_2 = {
|
|
5078
|
-
type: 'text';
|
|
5079
|
-
/**
|
|
5080
|
-
The text content.
|
|
5081
|
-
*/
|
|
5082
|
-
text: string;
|
|
5083
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5084
|
-
};
|
|
5085
|
-
|
|
5086
4358
|
/**
|
|
5087
4359
|
Text content part of a prompt. It contains a string of text.
|
|
5088
4360
|
*/
|
|
@@ -5100,23 +4372,6 @@ declare interface LanguageModelV2TextPart {
|
|
|
5100
4372
|
providerOptions?: SharedV2ProviderOptions;
|
|
5101
4373
|
}
|
|
5102
4374
|
|
|
5103
|
-
/**
|
|
5104
|
-
Text content part of a prompt. It contains a string of text.
|
|
5105
|
-
*/
|
|
5106
|
-
declare interface LanguageModelV2TextPart_2 {
|
|
5107
|
-
type: 'text';
|
|
5108
|
-
/**
|
|
5109
|
-
The text content.
|
|
5110
|
-
*/
|
|
5111
|
-
text: string;
|
|
5112
|
-
/**
|
|
5113
|
-
* Additional provider-specific options. They are passed through
|
|
5114
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
5115
|
-
* functionality that can be fully encapsulated in the provider.
|
|
5116
|
-
*/
|
|
5117
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
5118
|
-
}
|
|
5119
|
-
|
|
5120
4375
|
/**
|
|
5121
4376
|
* Tool calls that the model has generated.
|
|
5122
4377
|
*/
|
|
@@ -5146,29 +4401,6 @@ declare type LanguageModelV2ToolCall = {
|
|
|
5146
4401
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
5147
4402
|
};
|
|
5148
4403
|
|
|
5149
|
-
/**
|
|
5150
|
-
Tool calls that the model has generated.
|
|
5151
|
-
*/
|
|
5152
|
-
declare type LanguageModelV2ToolCall_2 = {
|
|
5153
|
-
type: 'tool-call';
|
|
5154
|
-
toolCallId: string;
|
|
5155
|
-
toolName: string;
|
|
5156
|
-
/**
|
|
5157
|
-
Stringified JSON object with the tool call arguments. Must match the
|
|
5158
|
-
parameters schema of the tool.
|
|
5159
|
-
*/
|
|
5160
|
-
input: string;
|
|
5161
|
-
/**
|
|
5162
|
-
* Whether the tool call will be executed by the provider.
|
|
5163
|
-
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
5164
|
-
*/
|
|
5165
|
-
providerExecuted?: boolean;
|
|
5166
|
-
/**
|
|
5167
|
-
* Additional provider-specific metadata for the tool call.
|
|
5168
|
-
*/
|
|
5169
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5170
|
-
};
|
|
5171
|
-
|
|
5172
4404
|
/**
|
|
5173
4405
|
Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
5174
4406
|
*/
|
|
@@ -5199,36 +4431,6 @@ declare interface LanguageModelV2ToolCallPart {
|
|
|
5199
4431
|
providerOptions?: SharedV2ProviderOptions;
|
|
5200
4432
|
}
|
|
5201
4433
|
|
|
5202
|
-
/**
|
|
5203
|
-
Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
5204
|
-
*/
|
|
5205
|
-
declare interface LanguageModelV2ToolCallPart_2 {
|
|
5206
|
-
type: 'tool-call';
|
|
5207
|
-
/**
|
|
5208
|
-
ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
5209
|
-
*/
|
|
5210
|
-
toolCallId: string;
|
|
5211
|
-
/**
|
|
5212
|
-
Name of the tool that is being called.
|
|
5213
|
-
*/
|
|
5214
|
-
toolName: string;
|
|
5215
|
-
/**
|
|
5216
|
-
Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
5217
|
-
*/
|
|
5218
|
-
input: unknown;
|
|
5219
|
-
/**
|
|
5220
|
-
* Whether the tool call will be executed by the provider.
|
|
5221
|
-
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
5222
|
-
*/
|
|
5223
|
-
providerExecuted?: boolean;
|
|
5224
|
-
/**
|
|
5225
|
-
* Additional provider-specific options. They are passed through
|
|
5226
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
5227
|
-
* functionality that can be fully encapsulated in the provider.
|
|
5228
|
-
*/
|
|
5229
|
-
providerOptions?: SharedV2ProviderOptions_2;
|
|
5230
|
-
}
|
|
5231
|
-
|
|
5232
4434
|
declare type LanguageModelV2ToolChoice = {
|
|
5233
4435
|
type: 'auto';
|
|
5234
4436
|
} | {
|
|
@@ -5240,17 +4442,6 @@ declare type LanguageModelV2ToolChoice = {
|
|
|
5240
4442
|
toolName: string;
|
|
5241
4443
|
};
|
|
5242
4444
|
|
|
5243
|
-
declare type LanguageModelV2ToolChoice_2 = {
|
|
5244
|
-
type: 'auto';
|
|
5245
|
-
} | {
|
|
5246
|
-
type: 'none';
|
|
5247
|
-
} | {
|
|
5248
|
-
type: 'required';
|
|
5249
|
-
} | {
|
|
5250
|
-
type: 'tool';
|
|
5251
|
-
toolName: string;
|
|
5252
|
-
};
|
|
5253
|
-
|
|
5254
4445
|
/**
|
|
5255
4446
|
Result of a tool call that has been executed by the provider.
|
|
5256
4447
|
*/
|
|
@@ -5284,39 +4475,6 @@ declare type LanguageModelV2ToolResult = {
|
|
|
5284
4475
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
5285
4476
|
};
|
|
5286
4477
|
|
|
5287
|
-
/**
|
|
5288
|
-
Result of a tool call that has been executed by the provider.
|
|
5289
|
-
*/
|
|
5290
|
-
declare type LanguageModelV2ToolResult_2 = {
|
|
5291
|
-
type: 'tool-result';
|
|
5292
|
-
/**
|
|
5293
|
-
* The ID of the tool call that this result is associated with.
|
|
5294
|
-
*/
|
|
5295
|
-
toolCallId: string;
|
|
5296
|
-
/**
|
|
5297
|
-
* Name of the tool that generated this result.
|
|
5298
|
-
*/
|
|
5299
|
-
toolName: string;
|
|
5300
|
-
/**
|
|
5301
|
-
* Result of the tool call. This is a JSON-serializable object.
|
|
5302
|
-
*/
|
|
5303
|
-
result: unknown;
|
|
5304
|
-
/**
|
|
5305
|
-
* Optional flag if the result is an error or an error message.
|
|
5306
|
-
*/
|
|
5307
|
-
isError?: boolean;
|
|
5308
|
-
/**
|
|
5309
|
-
* Whether the tool result was generated by the provider.
|
|
5310
|
-
* If this flag is set to true, the tool result was generated by the provider.
|
|
5311
|
-
* If this flag is not set or is false, the tool result was generated by the client.
|
|
5312
|
-
*/
|
|
5313
|
-
providerExecuted?: boolean;
|
|
5314
|
-
/**
|
|
5315
|
-
* Additional provider-specific metadata for the tool result.
|
|
5316
|
-
*/
|
|
5317
|
-
providerMetadata?: SharedV2ProviderMetadata_2;
|
|
5318
|
-
};
|
|
5319
|
-
|
|
5320
4478
|
declare type LanguageModelV2ToolResultOutput = {
|
|
5321
4479
|
type: 'text';
|
|
5322
4480
|
value: string;
|
|
@@ -5332,88 +4490,29 @@ declare type LanguageModelV2ToolResultOutput = {
|
|
|
5332
4490
|
} | {
|
|
5333
4491
|
type: 'content';
|
|
5334
4492
|
value: Array<{
|
|
5335
|
-
type: 'text';
|
|
5336
|
-
/**
|
|
5337
|
-
Text content.
|
|
5338
|
-
*/
|
|
5339
|
-
text: string;
|
|
5340
|
-
} | {
|
|
5341
|
-
type: 'media';
|
|
5342
|
-
/**
|
|
5343
|
-
Base-64 encoded media data.
|
|
5344
|
-
*/
|
|
5345
|
-
data: string;
|
|
5346
|
-
/**
|
|
5347
|
-
IANA media type.
|
|
5348
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
5349
|
-
*/
|
|
5350
|
-
mediaType: string;
|
|
5351
|
-
}>;
|
|
5352
|
-
};
|
|
5353
|
-
|
|
5354
|
-
declare type LanguageModelV2ToolResultOutput_2 = {
|
|
5355
|
-
type: 'text';
|
|
5356
|
-
value: string;
|
|
5357
|
-
} | {
|
|
5358
|
-
type: 'json';
|
|
5359
|
-
value: JSONValue_3;
|
|
5360
|
-
} | {
|
|
5361
|
-
type: 'error-text';
|
|
5362
|
-
value: string;
|
|
5363
|
-
} | {
|
|
5364
|
-
type: 'error-json';
|
|
5365
|
-
value: JSONValue_3;
|
|
5366
|
-
} | {
|
|
5367
|
-
type: 'content';
|
|
5368
|
-
value: Array<{
|
|
5369
|
-
type: 'text';
|
|
5370
|
-
/**
|
|
5371
|
-
Text content.
|
|
5372
|
-
*/
|
|
5373
|
-
text: string;
|
|
5374
|
-
} | {
|
|
5375
|
-
type: 'media';
|
|
5376
|
-
/**
|
|
5377
|
-
Base-64 encoded media data.
|
|
5378
|
-
*/
|
|
5379
|
-
data: string;
|
|
5380
|
-
/**
|
|
5381
|
-
IANA media type.
|
|
5382
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
5383
|
-
*/
|
|
5384
|
-
mediaType: string;
|
|
5385
|
-
}>;
|
|
5386
|
-
};
|
|
5387
|
-
|
|
5388
|
-
/**
|
|
5389
|
-
Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
5390
|
-
*/
|
|
5391
|
-
declare interface LanguageModelV2ToolResultPart {
|
|
5392
|
-
type: 'tool-result';
|
|
5393
|
-
/**
|
|
5394
|
-
ID of the tool call that this result is associated with.
|
|
5395
|
-
*/
|
|
5396
|
-
toolCallId: string;
|
|
5397
|
-
/**
|
|
5398
|
-
Name of the tool that generated this result.
|
|
5399
|
-
*/
|
|
5400
|
-
toolName: string;
|
|
5401
|
-
/**
|
|
5402
|
-
Result of the tool call.
|
|
5403
|
-
*/
|
|
5404
|
-
output: LanguageModelV2ToolResultOutput;
|
|
5405
|
-
/**
|
|
5406
|
-
* Additional provider-specific options. They are passed through
|
|
5407
|
-
* to the provider from the AI SDK and enable provider-specific
|
|
5408
|
-
* functionality that can be fully encapsulated in the provider.
|
|
5409
|
-
*/
|
|
5410
|
-
providerOptions?: SharedV2ProviderOptions;
|
|
5411
|
-
}
|
|
4493
|
+
type: 'text';
|
|
4494
|
+
/**
|
|
4495
|
+
Text content.
|
|
4496
|
+
*/
|
|
4497
|
+
text: string;
|
|
4498
|
+
} | {
|
|
4499
|
+
type: 'media';
|
|
4500
|
+
/**
|
|
4501
|
+
Base-64 encoded media data.
|
|
4502
|
+
*/
|
|
4503
|
+
data: string;
|
|
4504
|
+
/**
|
|
4505
|
+
IANA media type.
|
|
4506
|
+
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
4507
|
+
*/
|
|
4508
|
+
mediaType: string;
|
|
4509
|
+
}>;
|
|
4510
|
+
};
|
|
5412
4511
|
|
|
5413
4512
|
/**
|
|
5414
4513
|
Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
5415
4514
|
*/
|
|
5416
|
-
declare interface
|
|
4515
|
+
declare interface LanguageModelV2ToolResultPart {
|
|
5417
4516
|
type: 'tool-result';
|
|
5418
4517
|
/**
|
|
5419
4518
|
ID of the tool call that this result is associated with.
|
|
@@ -5426,13 +4525,13 @@ declare interface LanguageModelV2ToolResultPart_2 {
|
|
|
5426
4525
|
/**
|
|
5427
4526
|
Result of the tool call.
|
|
5428
4527
|
*/
|
|
5429
|
-
output:
|
|
4528
|
+
output: LanguageModelV2ToolResultOutput;
|
|
5430
4529
|
/**
|
|
5431
4530
|
* Additional provider-specific options. They are passed through
|
|
5432
4531
|
* to the provider from the AI SDK and enable provider-specific
|
|
5433
4532
|
* functionality that can be fully encapsulated in the provider.
|
|
5434
4533
|
*/
|
|
5435
|
-
providerOptions?:
|
|
4534
|
+
providerOptions?: SharedV2ProviderOptions;
|
|
5436
4535
|
}
|
|
5437
4536
|
|
|
5438
4537
|
/**
|
|
@@ -5466,37 +4565,6 @@ declare type LanguageModelV2Usage = {
|
|
|
5466
4565
|
cachedInputTokens?: number | undefined;
|
|
5467
4566
|
};
|
|
5468
4567
|
|
|
5469
|
-
/**
|
|
5470
|
-
Usage information for a language model call.
|
|
5471
|
-
|
|
5472
|
-
If your API return additional usage information, you can add it to the
|
|
5473
|
-
provider metadata under your provider's key.
|
|
5474
|
-
*/
|
|
5475
|
-
declare type LanguageModelV2Usage_2 = {
|
|
5476
|
-
/**
|
|
5477
|
-
The number of input (prompt) tokens used.
|
|
5478
|
-
*/
|
|
5479
|
-
inputTokens: number | undefined;
|
|
5480
|
-
/**
|
|
5481
|
-
The number of output (completion) tokens used.
|
|
5482
|
-
*/
|
|
5483
|
-
outputTokens: number | undefined;
|
|
5484
|
-
/**
|
|
5485
|
-
The total number of tokens as reported by the provider.
|
|
5486
|
-
This number might be different from the sum of `inputTokens` and `outputTokens`
|
|
5487
|
-
and e.g. include reasoning tokens or other overhead.
|
|
5488
|
-
*/
|
|
5489
|
-
totalTokens: number | undefined;
|
|
5490
|
-
/**
|
|
5491
|
-
The number of reasoning tokens used.
|
|
5492
|
-
*/
|
|
5493
|
-
reasoningTokens?: number | undefined;
|
|
5494
|
-
/**
|
|
5495
|
-
The number of cached input tokens.
|
|
5496
|
-
*/
|
|
5497
|
-
cachedInputTokens?: number | undefined;
|
|
5498
|
-
};
|
|
5499
|
-
|
|
5500
4568
|
/**
|
|
5501
4569
|
Check if the message is an assistant message with completed tool calls.
|
|
5502
4570
|
The last step of the message must have at least one tool invocation and
|
|
@@ -5544,6 +4612,8 @@ declare function lazyValidator<OBJECT>(createValidator: () => Validator<OBJECT>)
|
|
|
5544
4612
|
* However, it is desirable to associate incoming SpanContext to new trace
|
|
5545
4613
|
* initiated on service provider side so two traces (from Client and from
|
|
5546
4614
|
* Service Provider) can be correlated.
|
|
4615
|
+
*
|
|
4616
|
+
* @since 1.0.0
|
|
5547
4617
|
*/
|
|
5548
4618
|
declare interface Link {
|
|
5549
4619
|
/** The {@link SpanContext} of a linked span. */
|
|
@@ -5723,7 +4793,7 @@ export declare class NoOutputGeneratedError extends AISDKError {
|
|
|
5723
4793
|
Thrown when no output type is specified and output-related methods are called.
|
|
5724
4794
|
*/
|
|
5725
4795
|
export declare class NoOutputSpecifiedError extends AISDKError {
|
|
5726
|
-
private readonly [symbol$
|
|
4796
|
+
private readonly [symbol$7_2];
|
|
5727
4797
|
constructor({ message }?: {
|
|
5728
4798
|
message?: string;
|
|
5729
4799
|
});
|
|
@@ -5763,7 +4833,7 @@ export declare class NoSuchModelError extends AISDKError {
|
|
|
5763
4833
|
}
|
|
5764
4834
|
|
|
5765
4835
|
export declare class NoSuchProviderError extends NoSuchModelError {
|
|
5766
|
-
private readonly [
|
|
4836
|
+
private readonly [symbol_3];
|
|
5767
4837
|
readonly providerId: string;
|
|
5768
4838
|
readonly availableProviders: string[];
|
|
5769
4839
|
constructor({ modelId, modelType, providerId, availableProviders, message, }: {
|
|
@@ -5777,7 +4847,7 @@ export declare class NoSuchProviderError extends NoSuchModelError {
|
|
|
5777
4847
|
}
|
|
5778
4848
|
|
|
5779
4849
|
export declare class NoSuchToolError extends AISDKError {
|
|
5780
|
-
private readonly [symbol$
|
|
4850
|
+
private readonly [symbol$d_2];
|
|
5781
4851
|
readonly toolName: string;
|
|
5782
4852
|
readonly availableTools: string[] | undefined;
|
|
5783
4853
|
constructor({ toolName, availableTools, message, }: {
|
|
@@ -5815,7 +4885,7 @@ export declare namespace Output {
|
|
|
5815
4885
|
|
|
5816
4886
|
declare interface Output_2<OUTPUT, PARTIAL> {
|
|
5817
4887
|
readonly type: 'object' | 'text';
|
|
5818
|
-
responseFormat:
|
|
4888
|
+
responseFormat: LanguageModelV2CallOptions['responseFormat'];
|
|
5819
4889
|
parsePartial(options: {
|
|
5820
4890
|
text: string;
|
|
5821
4891
|
}): Promise<{
|
|
@@ -6005,7 +5075,7 @@ export declare function parseJsonEventStream<T>({ stream, schema, }: {
|
|
|
6005
5075
|
}): ReadableStream<ParseResult<T>>;
|
|
6006
5076
|
|
|
6007
5077
|
export declare function parsePartialJson(jsonText: string | undefined): Promise<{
|
|
6008
|
-
value:
|
|
5078
|
+
value: JSONValue_2 | undefined;
|
|
6009
5079
|
state: 'undefined-input' | 'successful-parse' | 'repaired-parse' | 'failed-parse';
|
|
6010
5080
|
}>;
|
|
6011
5081
|
|
|
@@ -6021,7 +5091,7 @@ declare type ParseResult<T> = {
|
|
|
6021
5091
|
rawValue: unknown;
|
|
6022
5092
|
} | {
|
|
6023
5093
|
success: false;
|
|
6024
|
-
error:
|
|
5094
|
+
error: JSONParseError | TypeValidationError;
|
|
6025
5095
|
rawValue: unknown;
|
|
6026
5096
|
};
|
|
6027
5097
|
|
|
@@ -6185,7 +5255,7 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
|
|
|
6185
5255
|
url: string;
|
|
6186
5256
|
headers?: Record<string, string | undefined>;
|
|
6187
5257
|
formData: FormData;
|
|
6188
|
-
failedResponseHandler: ResponseHandler<
|
|
5258
|
+
failedResponseHandler: ResponseHandler<APICallError>;
|
|
6189
5259
|
successfulResponseHandler: ResponseHandler<T>;
|
|
6190
5260
|
abortSignal?: AbortSignal;
|
|
6191
5261
|
fetch?: FetchFunction;
|
|
@@ -6199,7 +5269,7 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
|
|
|
6199
5269
|
url: string;
|
|
6200
5270
|
headers?: Record<string, string | undefined>;
|
|
6201
5271
|
body: unknown;
|
|
6202
|
-
failedResponseHandler: ResponseHandler<
|
|
5272
|
+
failedResponseHandler: ResponseHandler<APICallError>;
|
|
6203
5273
|
successfulResponseHandler: ResponseHandler<T>;
|
|
6204
5274
|
abortSignal?: AbortSignal;
|
|
6205
5275
|
fetch?: FetchFunction;
|
|
@@ -6301,6 +5371,15 @@ export declare type Prompt = {
|
|
|
6301
5371
|
System message to include in the prompt. Can be used with `prompt` or `messages`.
|
|
6302
5372
|
*/
|
|
6303
5373
|
system?: string;
|
|
5374
|
+
/**
|
|
5375
|
+
* Whether system messages are allowed in the `prompt` or `messages` fields.
|
|
5376
|
+
*
|
|
5377
|
+
* When disabled, system messages must be provided through the `system`
|
|
5378
|
+
* option. When unset, system messages are allowed with a warning.
|
|
5379
|
+
*
|
|
5380
|
+
* @default undefined
|
|
5381
|
+
*/
|
|
5382
|
+
allowSystemInMessages?: boolean;
|
|
6304
5383
|
} & ({
|
|
6305
5384
|
/**
|
|
6306
5385
|
A prompt. It can be either a text prompt or a list of messages.
|
|
@@ -6388,7 +5467,7 @@ declare type ProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS exte
|
|
|
6388
5467
|
This is needed to enable provider-specific functionality that can be
|
|
6389
5468
|
fully encapsulated in the provider.
|
|
6390
5469
|
*/
|
|
6391
|
-
export declare type ProviderMetadata =
|
|
5470
|
+
export declare type ProviderMetadata = SharedV2ProviderMetadata;
|
|
6392
5471
|
|
|
6393
5472
|
/**
|
|
6394
5473
|
Additional provider-specific options.
|
|
@@ -6398,17 +5477,17 @@ export declare type ProviderMetadata = SharedV2ProviderMetadata_2;
|
|
|
6398
5477
|
*/
|
|
6399
5478
|
declare type ProviderOptions = SharedV2ProviderOptions;
|
|
6400
5479
|
|
|
6401
|
-
export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string,
|
|
6402
|
-
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never):
|
|
6403
|
-
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never):
|
|
6404
|
-
textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['textEmbeddingModel']>>[0]>}` : never):
|
|
6405
|
-
textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never):
|
|
6406
|
-
imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['imageModel']>>[0]>}` : never):
|
|
6407
|
-
imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never):
|
|
6408
|
-
transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['transcriptionModel']>>[0]>}` : never):
|
|
6409
|
-
transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never):
|
|
6410
|
-
speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['speechModel']>>[0]>}` : never):
|
|
6411
|
-
speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never):
|
|
5480
|
+
export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV2> = Record<string, ProviderV2>, SEPARATOR extends string = ':'> {
|
|
5481
|
+
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV2;
|
|
5482
|
+
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): LanguageModelV2;
|
|
5483
|
+
textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['textEmbeddingModel']>>[0]>}` : never): EmbeddingModelV2<string>;
|
|
5484
|
+
textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): EmbeddingModelV2<string>;
|
|
5485
|
+
imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['imageModel']>>[0]>}` : never): ImageModelV2;
|
|
5486
|
+
imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): ImageModelV2;
|
|
5487
|
+
transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['transcriptionModel']>>[0]>}` : never): TranscriptionModelV2;
|
|
5488
|
+
transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): TranscriptionModelV2;
|
|
5489
|
+
speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['speechModel']>>[0]>}` : never): SpeechModelV2;
|
|
5490
|
+
speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): SpeechModelV2;
|
|
6412
5491
|
}
|
|
6413
5492
|
|
|
6414
5493
|
/**
|
|
@@ -6466,61 +5545,6 @@ declare interface ProviderV2 {
|
|
|
6466
5545
|
speechModel?(modelId: string): SpeechModelV2;
|
|
6467
5546
|
}
|
|
6468
5547
|
|
|
6469
|
-
/**
|
|
6470
|
-
* Provider for language, text embedding, and image generation models.
|
|
6471
|
-
*/
|
|
6472
|
-
declare interface ProviderV2_2 {
|
|
6473
|
-
/**
|
|
6474
|
-
Returns the language model with the given id.
|
|
6475
|
-
The model id is then passed to the provider function to get the model.
|
|
6476
|
-
|
|
6477
|
-
@param {string} modelId - The id of the model to return.
|
|
6478
|
-
|
|
6479
|
-
@returns {LanguageModel} The language model associated with the id
|
|
6480
|
-
|
|
6481
|
-
@throws {NoSuchModelError} If no such model exists.
|
|
6482
|
-
*/
|
|
6483
|
-
languageModel(modelId: string): LanguageModelV2_2;
|
|
6484
|
-
/**
|
|
6485
|
-
Returns the text embedding model with the given id.
|
|
6486
|
-
The model id is then passed to the provider function to get the model.
|
|
6487
|
-
|
|
6488
|
-
@param {string} modelId - The id of the model to return.
|
|
6489
|
-
|
|
6490
|
-
@returns {LanguageModel} The language model associated with the id
|
|
6491
|
-
|
|
6492
|
-
@throws {NoSuchModelError} If no such model exists.
|
|
6493
|
-
*/
|
|
6494
|
-
textEmbeddingModel(modelId: string): EmbeddingModelV2_2<string>;
|
|
6495
|
-
/**
|
|
6496
|
-
Returns the image model with the given id.
|
|
6497
|
-
The model id is then passed to the provider function to get the model.
|
|
6498
|
-
|
|
6499
|
-
@param {string} modelId - The id of the model to return.
|
|
6500
|
-
|
|
6501
|
-
@returns {ImageModel} The image model associated with the id
|
|
6502
|
-
*/
|
|
6503
|
-
imageModel(modelId: string): ImageModelV2_2;
|
|
6504
|
-
/**
|
|
6505
|
-
Returns the transcription model with the given id.
|
|
6506
|
-
The model id is then passed to the provider function to get the model.
|
|
6507
|
-
|
|
6508
|
-
@param {string} modelId - The id of the model to return.
|
|
6509
|
-
|
|
6510
|
-
@returns {TranscriptionModel} The transcription model associated with the id
|
|
6511
|
-
*/
|
|
6512
|
-
transcriptionModel?(modelId: string): TranscriptionModelV2_2;
|
|
6513
|
-
/**
|
|
6514
|
-
Returns the speech model with the given id.
|
|
6515
|
-
The model id is then passed to the provider function to get the model.
|
|
6516
|
-
|
|
6517
|
-
@param {string} modelId - The id of the model to return.
|
|
6518
|
-
|
|
6519
|
-
@returns {SpeechModel} The speech model associated with the id
|
|
6520
|
-
*/
|
|
6521
|
-
speechModel?(modelId: string): SpeechModelV2_2;
|
|
6522
|
-
}
|
|
6523
|
-
|
|
6524
5548
|
/**
|
|
6525
5549
|
* Prunes model messages from a list of model messages.
|
|
6526
5550
|
*
|
|
@@ -6541,6 +5565,25 @@ export declare function pruneMessages({ messages, reasoning, toolCalls, emptyMes
|
|
|
6541
5565
|
emptyMessages?: 'keep' | 'remove';
|
|
6542
5566
|
}): ModelMessage[];
|
|
6543
5567
|
|
|
5568
|
+
/**
|
|
5569
|
+
* Reads a fetch Response body with a size limit to prevent memory exhaustion.
|
|
5570
|
+
*
|
|
5571
|
+
* Checks the Content-Length header for early rejection, then reads the body
|
|
5572
|
+
* incrementally via ReadableStream and aborts with a DownloadError when the
|
|
5573
|
+
* limit is exceeded.
|
|
5574
|
+
*
|
|
5575
|
+
* @param response - The fetch Response to read.
|
|
5576
|
+
* @param url - The URL being downloaded (used in error messages).
|
|
5577
|
+
* @param maxBytes - Maximum allowed bytes. Defaults to DEFAULT_MAX_DOWNLOAD_SIZE.
|
|
5578
|
+
* @returns A Uint8Array containing the response body.
|
|
5579
|
+
* @throws DownloadError if the response exceeds maxBytes.
|
|
5580
|
+
*/
|
|
5581
|
+
declare function readResponseWithSizeLimit({ response, url, maxBytes, }: {
|
|
5582
|
+
response: Response;
|
|
5583
|
+
url: string;
|
|
5584
|
+
maxBytes?: number;
|
|
5585
|
+
}): Promise<Uint8Array>;
|
|
5586
|
+
|
|
6544
5587
|
/**
|
|
6545
5588
|
* Transforms a stream of `UIMessageChunk`s into an `AsyncIterableStream` of `UIMessage`s.
|
|
6546
5589
|
*
|
|
@@ -6655,7 +5698,7 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
|
|
|
6655
5698
|
declare type ResponseMessage = AssistantModelMessage | ToolModelMessage;
|
|
6656
5699
|
|
|
6657
5700
|
export declare class RetryError extends AISDKError {
|
|
6658
|
-
private readonly [symbol$
|
|
5701
|
+
private readonly [symbol$1_2];
|
|
6659
5702
|
readonly reason: RetryErrorReason;
|
|
6660
5703
|
readonly lastError: unknown;
|
|
6661
5704
|
readonly errors: Array<unknown>;
|
|
@@ -6711,7 +5754,7 @@ declare function safeValidateTypes<OBJECT>({ value, schema, }: {
|
|
|
6711
5754
|
rawValue: unknown;
|
|
6712
5755
|
} | {
|
|
6713
5756
|
success: false;
|
|
6714
|
-
error:
|
|
5757
|
+
error: TypeValidationError;
|
|
6715
5758
|
rawValue: unknown;
|
|
6716
5759
|
}>;
|
|
6717
5760
|
|
|
@@ -6768,8 +5811,6 @@ export declare class SerialJobExecutor {
|
|
|
6768
5811
|
|
|
6769
5812
|
declare type SharedV2Headers = Record<string, string>;
|
|
6770
5813
|
|
|
6771
|
-
declare type SharedV2Headers_2 = Record<string, string>;
|
|
6772
|
-
|
|
6773
5814
|
/**
|
|
6774
5815
|
* Additional provider-specific metadata.
|
|
6775
5816
|
* Metadata are additional outputs from the provider.
|
|
@@ -6793,29 +5834,6 @@ declare type SharedV2Headers_2 = Record<string, string>;
|
|
|
6793
5834
|
*/
|
|
6794
5835
|
declare type SharedV2ProviderMetadata = Record<string, Record<string, JSONValue_2>>;
|
|
6795
5836
|
|
|
6796
|
-
/**
|
|
6797
|
-
* Additional provider-specific metadata.
|
|
6798
|
-
* Metadata are additional outputs from the provider.
|
|
6799
|
-
* They are passed through to the provider from the AI SDK
|
|
6800
|
-
* and enable provider-specific functionality
|
|
6801
|
-
* that can be fully encapsulated in the provider.
|
|
6802
|
-
*
|
|
6803
|
-
* This enables us to quickly ship provider-specific functionality
|
|
6804
|
-
* without affecting the core AI SDK.
|
|
6805
|
-
*
|
|
6806
|
-
* The outer record is keyed by the provider name, and the inner
|
|
6807
|
-
* record is keyed by the provider-specific metadata key.
|
|
6808
|
-
*
|
|
6809
|
-
* ```ts
|
|
6810
|
-
* {
|
|
6811
|
-
* "anthropic": {
|
|
6812
|
-
* "cacheControl": { "type": "ephemeral" }
|
|
6813
|
-
* }
|
|
6814
|
-
* }
|
|
6815
|
-
* ```
|
|
6816
|
-
*/
|
|
6817
|
-
declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValue_3>>;
|
|
6818
|
-
|
|
6819
5837
|
/**
|
|
6820
5838
|
* Additional provider-specific options.
|
|
6821
5839
|
* Options are additional input to the provider.
|
|
@@ -6839,29 +5857,6 @@ declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValu
|
|
|
6839
5857
|
*/
|
|
6840
5858
|
declare type SharedV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
|
|
6841
5859
|
|
|
6842
|
-
/**
|
|
6843
|
-
* Additional provider-specific options.
|
|
6844
|
-
* Options are additional input to the provider.
|
|
6845
|
-
* They are passed through to the provider from the AI SDK
|
|
6846
|
-
* and enable provider-specific functionality
|
|
6847
|
-
* that can be fully encapsulated in the provider.
|
|
6848
|
-
*
|
|
6849
|
-
* This enables us to quickly ship provider-specific functionality
|
|
6850
|
-
* without affecting the core AI SDK.
|
|
6851
|
-
*
|
|
6852
|
-
* The outer record is keyed by the provider name, and the inner
|
|
6853
|
-
* record is keyed by the provider-specific metadata key.
|
|
6854
|
-
*
|
|
6855
|
-
* ```ts
|
|
6856
|
-
* {
|
|
6857
|
-
* "anthropic": {
|
|
6858
|
-
* "cacheControl": { "type": "ephemeral" }
|
|
6859
|
-
* }
|
|
6860
|
-
* }
|
|
6861
|
-
* ```
|
|
6862
|
-
*/
|
|
6863
|
-
declare type SharedV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
|
|
6864
|
-
|
|
6865
5860
|
/**
|
|
6866
5861
|
* Creates a ReadableStream that emits the provided values with an optional delay between each value.
|
|
6867
5862
|
*
|
|
@@ -6941,7 +5936,7 @@ declare type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
6941
5936
|
file: GeneratedFile;
|
|
6942
5937
|
} | {
|
|
6943
5938
|
type: 'stream-start';
|
|
6944
|
-
warnings:
|
|
5939
|
+
warnings: LanguageModelV2CallWarning[];
|
|
6945
5940
|
} | {
|
|
6946
5941
|
type: 'response-metadata';
|
|
6947
5942
|
id?: string;
|
|
@@ -6984,7 +5979,7 @@ export declare function smoothStream<TOOLS extends ToolSet>({ delayInMs, chunkin
|
|
|
6984
5979
|
/**
|
|
6985
5980
|
A source that has been used as input to generate the response.
|
|
6986
5981
|
*/
|
|
6987
|
-
declare type Source =
|
|
5982
|
+
declare type Source = LanguageModelV2Source;
|
|
6988
5983
|
|
|
6989
5984
|
/**
|
|
6990
5985
|
* A document source part of a message.
|
|
@@ -7017,6 +6012,8 @@ export declare type SourceUrlUIPart = {
|
|
|
7017
6012
|
* may have children.
|
|
7018
6013
|
*
|
|
7019
6014
|
* Spans are created by the {@link Tracer.startSpan} method.
|
|
6015
|
+
*
|
|
6016
|
+
* @since 1.0.0
|
|
7020
6017
|
*/
|
|
7021
6018
|
declare interface Span {
|
|
7022
6019
|
/**
|
|
@@ -7076,11 +6073,21 @@ declare interface Span {
|
|
|
7076
6073
|
*/
|
|
7077
6074
|
addLinks(links: Link[]): this;
|
|
7078
6075
|
/**
|
|
7079
|
-
* Sets
|
|
7080
|
-
*
|
|
7081
|
-
*
|
|
6076
|
+
* Sets the status of the span.
|
|
6077
|
+
*
|
|
6078
|
+
* By default, a span has status {@link SpanStatusCode.UNSET}.
|
|
6079
|
+
* Calling this method overrides that default.
|
|
6080
|
+
*
|
|
6081
|
+
* The status codes have a total order: `OK > ERROR > UNSET`.
|
|
6082
|
+
*
|
|
6083
|
+
* - Once {@link SpanStatusCode.OK} is set, any further attempts to change
|
|
6084
|
+
* the status are ignored.
|
|
6085
|
+
* - Any attempt to set {@link SpanStatusCode.UNSET} is always ignored.
|
|
6086
|
+
*
|
|
6087
|
+
* The `message` field is only used when {@link SpanStatusCode.ERROR} is set.
|
|
6088
|
+
* For all other status codes, `message` is ignored.
|
|
7082
6089
|
*
|
|
7083
|
-
* @param status
|
|
6090
|
+
* @param status The {@link SpanStatus} to set.
|
|
7084
6091
|
*/
|
|
7085
6092
|
setStatus(status: SpanStatus): this;
|
|
7086
6093
|
/**
|
|
@@ -7125,17 +6132,21 @@ declare interface Span {
|
|
|
7125
6132
|
|
|
7126
6133
|
/**
|
|
7127
6134
|
* @deprecated please use {@link Attributes}
|
|
6135
|
+
* @since 1.0.0
|
|
7128
6136
|
*/
|
|
7129
6137
|
declare type SpanAttributes = Attributes;
|
|
7130
6138
|
|
|
7131
6139
|
/**
|
|
7132
6140
|
* @deprecated please use {@link AttributeValue}
|
|
6141
|
+
* @since 1.0.0
|
|
7133
6142
|
*/
|
|
7134
6143
|
declare type SpanAttributeValue = AttributeValue;
|
|
7135
6144
|
|
|
7136
6145
|
/**
|
|
7137
6146
|
* A SpanContext represents the portion of a {@link Span} which must be
|
|
7138
6147
|
* serialized and propagated along side of a {@link Baggage}.
|
|
6148
|
+
*
|
|
6149
|
+
* @since 1.0.0
|
|
7139
6150
|
*/
|
|
7140
6151
|
declare interface SpanContext {
|
|
7141
6152
|
/**
|
|
@@ -7185,6 +6196,9 @@ declare interface SpanContext {
|
|
|
7185
6196
|
traceState?: TraceState;
|
|
7186
6197
|
}
|
|
7187
6198
|
|
|
6199
|
+
/**
|
|
6200
|
+
* @since 1.0.0
|
|
6201
|
+
*/
|
|
7188
6202
|
declare enum SpanKind {
|
|
7189
6203
|
/** Default value. Indicates that the span is used internally. */
|
|
7190
6204
|
INTERNAL = 0,
|
|
@@ -7214,6 +6228,8 @@ declare enum SpanKind {
|
|
|
7214
6228
|
|
|
7215
6229
|
/**
|
|
7216
6230
|
* Options needed for span creation
|
|
6231
|
+
*
|
|
6232
|
+
* @since 1.0.0
|
|
7217
6233
|
*/
|
|
7218
6234
|
declare interface SpanOptions {
|
|
7219
6235
|
/**
|
|
@@ -7222,7 +6238,7 @@ declare interface SpanOptions {
|
|
|
7222
6238
|
*/
|
|
7223
6239
|
kind?: SpanKind;
|
|
7224
6240
|
/** A span's attributes */
|
|
7225
|
-
attributes?:
|
|
6241
|
+
attributes?: Attributes;
|
|
7226
6242
|
/** {@link Link}s span to other spans */
|
|
7227
6243
|
links?: Link[];
|
|
7228
6244
|
/** A manually specified start time for the created `Span` object. */
|
|
@@ -7231,6 +6247,9 @@ declare interface SpanOptions {
|
|
|
7231
6247
|
root?: boolean;
|
|
7232
6248
|
}
|
|
7233
6249
|
|
|
6250
|
+
/**
|
|
6251
|
+
* @since 1.0.0
|
|
6252
|
+
*/
|
|
7234
6253
|
declare interface SpanStatus {
|
|
7235
6254
|
/** The status code of this message. */
|
|
7236
6255
|
code: SpanStatusCode;
|
|
@@ -7240,6 +6259,8 @@ declare interface SpanStatus {
|
|
|
7240
6259
|
|
|
7241
6260
|
/**
|
|
7242
6261
|
* An enumeration of status codes.
|
|
6262
|
+
*
|
|
6263
|
+
* @since 1.0.0
|
|
7243
6264
|
*/
|
|
7244
6265
|
declare enum SpanStatusCode {
|
|
7245
6266
|
/**
|
|
@@ -7260,7 +6281,7 @@ declare enum SpanStatusCode {
|
|
|
7260
6281
|
/**
|
|
7261
6282
|
Speech model that is used by the AI SDK Core functions.
|
|
7262
6283
|
*/
|
|
7263
|
-
export declare type SpeechModel =
|
|
6284
|
+
export declare type SpeechModel = SpeechModelV2;
|
|
7264
6285
|
|
|
7265
6286
|
export declare type SpeechModelResponseMetadata = {
|
|
7266
6287
|
/**
|
|
@@ -7274,92 +6295,17 @@ export declare type SpeechModelResponseMetadata = {
|
|
|
7274
6295
|
/**
|
|
7275
6296
|
Response headers.
|
|
7276
6297
|
*/
|
|
7277
|
-
headers?: Record<string, string>;
|
|
7278
|
-
/**
|
|
7279
|
-
Response body.
|
|
7280
|
-
*/
|
|
7281
|
-
body?: unknown;
|
|
7282
|
-
};
|
|
7283
|
-
|
|
7284
|
-
/**
|
|
7285
|
-
* Speech model specification version 2.
|
|
7286
|
-
*/
|
|
7287
|
-
declare type SpeechModelV2 = {
|
|
7288
|
-
/**
|
|
7289
|
-
* The speech model must specify which speech model interface
|
|
7290
|
-
* version it implements. This will allow us to evolve the speech
|
|
7291
|
-
* model interface and retain backwards compatibility. The different
|
|
7292
|
-
* implementation versions can be handled as a discriminated union
|
|
7293
|
-
* on our side.
|
|
7294
|
-
*/
|
|
7295
|
-
readonly specificationVersion: 'v2';
|
|
7296
|
-
/**
|
|
7297
|
-
* Name of the provider for logging purposes.
|
|
7298
|
-
*/
|
|
7299
|
-
readonly provider: string;
|
|
7300
|
-
/**
|
|
7301
|
-
* Provider-specific model ID for logging purposes.
|
|
7302
|
-
*/
|
|
7303
|
-
readonly modelId: string;
|
|
7304
|
-
/**
|
|
7305
|
-
* Generates speech audio from text.
|
|
7306
|
-
*/
|
|
7307
|
-
doGenerate(options: SpeechModelV2CallOptions): PromiseLike<{
|
|
7308
|
-
/**
|
|
7309
|
-
* Generated audio as an ArrayBuffer.
|
|
7310
|
-
* The audio should be returned without any unnecessary conversion.
|
|
7311
|
-
* If the API returns base64 encoded strings, the audio should be returned
|
|
7312
|
-
* as base64 encoded strings. If the API returns binary data, the audio
|
|
7313
|
-
* should be returned as binary data.
|
|
7314
|
-
*/
|
|
7315
|
-
audio: string | Uint8Array;
|
|
7316
|
-
/**
|
|
7317
|
-
* Warnings for the call, e.g. unsupported settings.
|
|
7318
|
-
*/
|
|
7319
|
-
warnings: Array<SpeechModelV2CallWarning>;
|
|
7320
|
-
/**
|
|
7321
|
-
* Optional request information for telemetry and debugging purposes.
|
|
7322
|
-
*/
|
|
7323
|
-
request?: {
|
|
7324
|
-
/**
|
|
7325
|
-
* Response body (available only for providers that use HTTP requests).
|
|
7326
|
-
*/
|
|
7327
|
-
body?: unknown;
|
|
7328
|
-
};
|
|
7329
|
-
/**
|
|
7330
|
-
* Response information for telemetry and debugging purposes.
|
|
7331
|
-
*/
|
|
7332
|
-
response: {
|
|
7333
|
-
/**
|
|
7334
|
-
* Timestamp for the start of the generated response.
|
|
7335
|
-
*/
|
|
7336
|
-
timestamp: Date;
|
|
7337
|
-
/**
|
|
7338
|
-
* The ID of the response model that was used to generate the response.
|
|
7339
|
-
*/
|
|
7340
|
-
modelId: string;
|
|
7341
|
-
/**
|
|
7342
|
-
* Response headers.
|
|
7343
|
-
*/
|
|
7344
|
-
headers?: SharedV2Headers;
|
|
7345
|
-
/**
|
|
7346
|
-
* Response body.
|
|
7347
|
-
*/
|
|
7348
|
-
body?: unknown;
|
|
7349
|
-
};
|
|
7350
|
-
/**
|
|
7351
|
-
* Additional provider-specific metadata. They are passed through
|
|
7352
|
-
* from the provider to the AI SDK and enable provider-specific
|
|
7353
|
-
* results that can be fully encapsulated in the provider.
|
|
7354
|
-
*/
|
|
7355
|
-
providerMetadata?: Record<string, Record<string, JSONValue_2>>;
|
|
7356
|
-
}>;
|
|
6298
|
+
headers?: Record<string, string>;
|
|
6299
|
+
/**
|
|
6300
|
+
Response body.
|
|
6301
|
+
*/
|
|
6302
|
+
body?: unknown;
|
|
7357
6303
|
};
|
|
7358
6304
|
|
|
7359
6305
|
/**
|
|
7360
6306
|
* Speech model specification version 2.
|
|
7361
6307
|
*/
|
|
7362
|
-
declare type
|
|
6308
|
+
declare type SpeechModelV2 = {
|
|
7363
6309
|
/**
|
|
7364
6310
|
* The speech model must specify which speech model interface
|
|
7365
6311
|
* version it implements. This will allow us to evolve the speech
|
|
@@ -7379,7 +6325,7 @@ declare type SpeechModelV2_2 = {
|
|
|
7379
6325
|
/**
|
|
7380
6326
|
* Generates speech audio from text.
|
|
7381
6327
|
*/
|
|
7382
|
-
doGenerate(options:
|
|
6328
|
+
doGenerate(options: SpeechModelV2CallOptions): PromiseLike<{
|
|
7383
6329
|
/**
|
|
7384
6330
|
* Generated audio as an ArrayBuffer.
|
|
7385
6331
|
* The audio should be returned without any unnecessary conversion.
|
|
@@ -7391,7 +6337,7 @@ declare type SpeechModelV2_2 = {
|
|
|
7391
6337
|
/**
|
|
7392
6338
|
* Warnings for the call, e.g. unsupported settings.
|
|
7393
6339
|
*/
|
|
7394
|
-
warnings: Array<
|
|
6340
|
+
warnings: Array<SpeechModelV2CallWarning>;
|
|
7395
6341
|
/**
|
|
7396
6342
|
* Optional request information for telemetry and debugging purposes.
|
|
7397
6343
|
*/
|
|
@@ -7416,7 +6362,7 @@ declare type SpeechModelV2_2 = {
|
|
|
7416
6362
|
/**
|
|
7417
6363
|
* Response headers.
|
|
7418
6364
|
*/
|
|
7419
|
-
headers?:
|
|
6365
|
+
headers?: SharedV2Headers;
|
|
7420
6366
|
/**
|
|
7421
6367
|
* Response body.
|
|
7422
6368
|
*/
|
|
@@ -7427,7 +6373,7 @@ declare type SpeechModelV2_2 = {
|
|
|
7427
6373
|
* from the provider to the AI SDK and enable provider-specific
|
|
7428
6374
|
* results that can be fully encapsulated in the provider.
|
|
7429
6375
|
*/
|
|
7430
|
-
providerMetadata?: Record<string, Record<string,
|
|
6376
|
+
providerMetadata?: Record<string, Record<string, JSONValue_2>>;
|
|
7431
6377
|
}>;
|
|
7432
6378
|
};
|
|
7433
6379
|
|
|
@@ -7482,57 +6428,6 @@ declare type SpeechModelV2CallOptions = {
|
|
|
7482
6428
|
headers?: Record<string, string | undefined>;
|
|
7483
6429
|
};
|
|
7484
6430
|
|
|
7485
|
-
declare type SpeechModelV2CallOptions_2 = {
|
|
7486
|
-
/**
|
|
7487
|
-
* Text to convert to speech.
|
|
7488
|
-
*/
|
|
7489
|
-
text: string;
|
|
7490
|
-
/**
|
|
7491
|
-
* The voice to use for speech synthesis.
|
|
7492
|
-
* This is provider-specific and may be a voice ID, name, or other identifier.
|
|
7493
|
-
*/
|
|
7494
|
-
voice?: string;
|
|
7495
|
-
/**
|
|
7496
|
-
* The desired output format for the audio e.g. "mp3", "wav", etc.
|
|
7497
|
-
*/
|
|
7498
|
-
outputFormat?: string;
|
|
7499
|
-
/**
|
|
7500
|
-
* Instructions for the speech generation e.g. "Speak in a slow and steady tone".
|
|
7501
|
-
*/
|
|
7502
|
-
instructions?: string;
|
|
7503
|
-
/**
|
|
7504
|
-
* The speed of the speech generation.
|
|
7505
|
-
*/
|
|
7506
|
-
speed?: number;
|
|
7507
|
-
/**
|
|
7508
|
-
* The language for speech generation. This should be an ISO 639-1 language code (e.g. "en", "es", "fr")
|
|
7509
|
-
* or "auto" for automatic language detection. Provider support varies.
|
|
7510
|
-
*/
|
|
7511
|
-
language?: string;
|
|
7512
|
-
/**
|
|
7513
|
-
* Additional provider-specific options that are passed through to the provider
|
|
7514
|
-
* as body parameters.
|
|
7515
|
-
*
|
|
7516
|
-
* The outer record is keyed by the provider name, and the inner
|
|
7517
|
-
* record is keyed by the provider-specific metadata key.
|
|
7518
|
-
* ```ts
|
|
7519
|
-
* {
|
|
7520
|
-
* "openai": {}
|
|
7521
|
-
* }
|
|
7522
|
-
* ```
|
|
7523
|
-
*/
|
|
7524
|
-
providerOptions?: SpeechModelV2ProviderOptions_2;
|
|
7525
|
-
/**
|
|
7526
|
-
* Abort signal for cancelling the operation.
|
|
7527
|
-
*/
|
|
7528
|
-
abortSignal?: AbortSignal;
|
|
7529
|
-
/**
|
|
7530
|
-
* Additional HTTP headers to be sent with the request.
|
|
7531
|
-
* Only applicable for HTTP-based providers.
|
|
7532
|
-
*/
|
|
7533
|
-
headers?: Record<string, string | undefined>;
|
|
7534
|
-
};
|
|
7535
|
-
|
|
7536
6431
|
/**
|
|
7537
6432
|
* Warning from the model provider for this call. The call will proceed, but e.g.
|
|
7538
6433
|
* some settings might not be supported, which can lead to suboptimal results.
|
|
@@ -7546,28 +6441,13 @@ declare type SpeechModelV2CallWarning = {
|
|
|
7546
6441
|
message: string;
|
|
7547
6442
|
};
|
|
7548
6443
|
|
|
7549
|
-
/**
|
|
7550
|
-
* Warning from the model provider for this call. The call will proceed, but e.g.
|
|
7551
|
-
* some settings might not be supported, which can lead to suboptimal results.
|
|
7552
|
-
*/
|
|
7553
|
-
declare type SpeechModelV2CallWarning_2 = {
|
|
7554
|
-
type: 'unsupported-setting';
|
|
7555
|
-
setting: keyof SpeechModelV2CallOptions_2;
|
|
7556
|
-
details?: string;
|
|
7557
|
-
} | {
|
|
7558
|
-
type: 'other';
|
|
7559
|
-
message: string;
|
|
7560
|
-
};
|
|
7561
|
-
|
|
7562
6444
|
declare type SpeechModelV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
|
|
7563
6445
|
|
|
7564
|
-
declare type SpeechModelV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
|
|
7565
|
-
|
|
7566
6446
|
/**
|
|
7567
6447
|
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
7568
6448
|
some settings might not be supported, which can lead to suboptimal results.
|
|
7569
6449
|
*/
|
|
7570
|
-
export declare type SpeechWarning =
|
|
6450
|
+
export declare type SpeechWarning = SpeechModelV2CallWarning;
|
|
7571
6451
|
|
|
7572
6452
|
/** The Standard JSON Schema interface. */
|
|
7573
6453
|
declare interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
|
|
@@ -7900,12 +6780,11 @@ export declare type StopCondition<TOOLS extends ToolSet> = (options: {
|
|
|
7900
6780
|
@returns
|
|
7901
6781
|
A result object for accessing the partial object stream and additional information.
|
|
7902
6782
|
*/
|
|
7903
|
-
export declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<
|
|
6783
|
+
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' ? {
|
|
7904
6784
|
/**
|
|
7905
6785
|
The enum values that the model should use.
|
|
7906
6786
|
*/
|
|
7907
6787
|
enum: Array<RESULT>;
|
|
7908
|
-
mode?: 'json';
|
|
7909
6788
|
output: 'enum';
|
|
7910
6789
|
} : OUTPUT extends 'no-schema' ? {} : {
|
|
7911
6790
|
/**
|
|
@@ -7924,20 +6803,6 @@ export declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = Fl
|
|
|
7924
6803
|
via tool or schema description.
|
|
7925
6804
|
*/
|
|
7926
6805
|
schemaDescription?: string;
|
|
7927
|
-
/**
|
|
7928
|
-
The mode to use for object generation.
|
|
7929
|
-
|
|
7930
|
-
The schema is converted into a JSON schema and used in one of the following ways
|
|
7931
|
-
|
|
7932
|
-
- 'auto': The provider will choose the best mode for the model.
|
|
7933
|
-
- 'tool': A tool with the JSON schema as parameters is provided and the provider is instructed to use it.
|
|
7934
|
-
- 'json': The JSON schema and an instruction are injected into the prompt. If the provider supports JSON mode, it is enabled. If the provider supports JSON grammars, the grammar is used.
|
|
7935
|
-
|
|
7936
|
-
Please note that most providers do not support all modes.
|
|
7937
|
-
|
|
7938
|
-
Default and recommended: 'auto' (best mode for the model).
|
|
7939
|
-
*/
|
|
7940
|
-
mode?: 'auto' | 'json' | 'tool';
|
|
7941
6806
|
}) & {
|
|
7942
6807
|
output?: OUTPUT;
|
|
7943
6808
|
/**
|
|
@@ -8183,7 +7048,7 @@ declare interface StreamOptions {
|
|
|
8183
7048
|
@return
|
|
8184
7049
|
A result object for accessing different stream types and additional information.
|
|
8185
7050
|
*/
|
|
8186
|
-
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 & {
|
|
7051
|
+
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 & {
|
|
8187
7052
|
/**
|
|
8188
7053
|
The language model to use.
|
|
8189
7054
|
*/
|
|
@@ -8569,8 +7434,6 @@ declare const symbol$1: unique symbol;
|
|
|
8569
7434
|
|
|
8570
7435
|
declare const symbol$1_2: unique symbol;
|
|
8571
7436
|
|
|
8572
|
-
declare const symbol$1_3: unique symbol;
|
|
8573
|
-
|
|
8574
7437
|
declare const symbol$2: unique symbol;
|
|
8575
7438
|
|
|
8576
7439
|
declare const symbol$2_2: unique symbol;
|
|
@@ -8595,8 +7458,6 @@ declare const symbol$7: unique symbol;
|
|
|
8595
7458
|
|
|
8596
7459
|
declare const symbol$7_2: unique symbol;
|
|
8597
7460
|
|
|
8598
|
-
declare const symbol$7_3: unique symbol;
|
|
8599
|
-
|
|
8600
7461
|
declare const symbol$8: unique symbol;
|
|
8601
7462
|
|
|
8602
7463
|
declare const symbol$8_2: unique symbol;
|
|
@@ -8617,20 +7478,18 @@ declare const symbol$c: unique symbol;
|
|
|
8617
7478
|
|
|
8618
7479
|
declare const symbol$c_2: unique symbol;
|
|
8619
7480
|
|
|
8620
|
-
declare const symbol$c_3: unique symbol;
|
|
8621
|
-
|
|
8622
7481
|
declare const symbol$d: unique symbol;
|
|
8623
7482
|
|
|
8624
7483
|
declare const symbol$d_2: unique symbol;
|
|
8625
7484
|
|
|
8626
|
-
declare const symbol$d_3: unique symbol;
|
|
8627
|
-
|
|
8628
7485
|
declare const symbol$e: unique symbol;
|
|
8629
7486
|
|
|
8630
7487
|
declare const symbol: unique symbol;
|
|
8631
7488
|
|
|
8632
7489
|
declare const symbol_2: unique symbol;
|
|
8633
7490
|
|
|
7491
|
+
declare const symbol_3: unique symbol;
|
|
7492
|
+
|
|
8634
7493
|
/**
|
|
8635
7494
|
A system message. It can contain system information.
|
|
8636
7495
|
|
|
@@ -8811,6 +7670,8 @@ export declare type TextUIPart = {
|
|
|
8811
7670
|
* Defines TimeInput.
|
|
8812
7671
|
*
|
|
8813
7672
|
* hrtime, epoch milliseconds, performance.now() or Date
|
|
7673
|
+
*
|
|
7674
|
+
* @since 1.0.0
|
|
8814
7675
|
*/
|
|
8815
7676
|
declare type TimeInput = HrTime | number | Date;
|
|
8816
7677
|
|
|
@@ -9015,13 +7876,13 @@ export declare class ToolCallRepairError extends AISDKError {
|
|
|
9015
7876
|
export declare type ToolCallRepairFunction<TOOLS extends ToolSet> = (options: {
|
|
9016
7877
|
system: string | undefined;
|
|
9017
7878
|
messages: ModelMessage[];
|
|
9018
|
-
toolCall:
|
|
7879
|
+
toolCall: LanguageModelV2ToolCall;
|
|
9019
7880
|
tools: TOOLS;
|
|
9020
7881
|
inputSchema: (options: {
|
|
9021
7882
|
toolName: string;
|
|
9022
7883
|
}) => JSONSchema7;
|
|
9023
7884
|
error: NoSuchToolError | InvalidToolInputError;
|
|
9024
|
-
}) => Promise<
|
|
7885
|
+
}) => Promise<LanguageModelV2ToolCall | null>;
|
|
9025
7886
|
|
|
9026
7887
|
/**
|
|
9027
7888
|
Tool choice for the generation. It supports the following settings:
|
|
@@ -9155,6 +8016,8 @@ export declare class TooManyEmbeddingValuesForCallError extends AISDKError {
|
|
|
9155
8016
|
|
|
9156
8017
|
/**
|
|
9157
8018
|
* Tracer provides an interface for creating {@link Span}s.
|
|
8019
|
+
*
|
|
8020
|
+
* @since 1.0.0
|
|
9158
8021
|
*/
|
|
9159
8022
|
declare interface Tracer {
|
|
9160
8023
|
/**
|
|
@@ -9221,6 +8084,9 @@ declare interface Tracer {
|
|
|
9221
8084
|
startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
|
|
9222
8085
|
}
|
|
9223
8086
|
|
|
8087
|
+
/**
|
|
8088
|
+
* @since 1.0.0
|
|
8089
|
+
*/
|
|
9224
8090
|
declare interface TraceState {
|
|
9225
8091
|
/**
|
|
9226
8092
|
* Create a new TraceState which inherits from this TraceState and has the
|
|
@@ -9262,7 +8128,7 @@ declare interface TraceState {
|
|
|
9262
8128
|
/**
|
|
9263
8129
|
Transcription model that is used by the AI SDK Core functions.
|
|
9264
8130
|
*/
|
|
9265
|
-
export declare type TranscriptionModel =
|
|
8131
|
+
export declare type TranscriptionModel = TranscriptionModelV2;
|
|
9266
8132
|
|
|
9267
8133
|
export declare type TranscriptionModelResponseMetadata = {
|
|
9268
8134
|
/**
|
|
@@ -9379,106 +8245,6 @@ declare type TranscriptionModelV2 = {
|
|
|
9379
8245
|
}>;
|
|
9380
8246
|
};
|
|
9381
8247
|
|
|
9382
|
-
/**
|
|
9383
|
-
Transcription model specification version 2.
|
|
9384
|
-
*/
|
|
9385
|
-
declare type TranscriptionModelV2_2 = {
|
|
9386
|
-
/**
|
|
9387
|
-
The transcription model must specify which transcription model interface
|
|
9388
|
-
version it implements. This will allow us to evolve the transcription
|
|
9389
|
-
model interface and retain backwards compatibility. The different
|
|
9390
|
-
implementation versions can be handled as a discriminated union
|
|
9391
|
-
on our side.
|
|
9392
|
-
*/
|
|
9393
|
-
readonly specificationVersion: 'v2';
|
|
9394
|
-
/**
|
|
9395
|
-
Name of the provider for logging purposes.
|
|
9396
|
-
*/
|
|
9397
|
-
readonly provider: string;
|
|
9398
|
-
/**
|
|
9399
|
-
Provider-specific model ID for logging purposes.
|
|
9400
|
-
*/
|
|
9401
|
-
readonly modelId: string;
|
|
9402
|
-
/**
|
|
9403
|
-
Generates a transcript.
|
|
9404
|
-
*/
|
|
9405
|
-
doGenerate(options: TranscriptionModelV2CallOptions_2): PromiseLike<{
|
|
9406
|
-
/**
|
|
9407
|
-
* The complete transcribed text from the audio.
|
|
9408
|
-
*/
|
|
9409
|
-
text: string;
|
|
9410
|
-
/**
|
|
9411
|
-
* Array of transcript segments with timing information.
|
|
9412
|
-
* Each segment represents a portion of the transcribed text with start and end times.
|
|
9413
|
-
*/
|
|
9414
|
-
segments: Array<{
|
|
9415
|
-
/**
|
|
9416
|
-
* The text content of this segment.
|
|
9417
|
-
*/
|
|
9418
|
-
text: string;
|
|
9419
|
-
/**
|
|
9420
|
-
* The start time of this segment in seconds.
|
|
9421
|
-
*/
|
|
9422
|
-
startSecond: number;
|
|
9423
|
-
/**
|
|
9424
|
-
* The end time of this segment in seconds.
|
|
9425
|
-
*/
|
|
9426
|
-
endSecond: number;
|
|
9427
|
-
}>;
|
|
9428
|
-
/**
|
|
9429
|
-
* The detected language of the audio content, as an ISO-639-1 code (e.g., 'en' for English).
|
|
9430
|
-
* May be undefined if the language couldn't be detected.
|
|
9431
|
-
*/
|
|
9432
|
-
language: string | undefined;
|
|
9433
|
-
/**
|
|
9434
|
-
* The total duration of the audio file in seconds.
|
|
9435
|
-
* May be undefined if the duration couldn't be determined.
|
|
9436
|
-
*/
|
|
9437
|
-
durationInSeconds: number | undefined;
|
|
9438
|
-
/**
|
|
9439
|
-
Warnings for the call, e.g. unsupported settings.
|
|
9440
|
-
*/
|
|
9441
|
-
warnings: Array<TranscriptionModelV2CallWarning_2>;
|
|
9442
|
-
/**
|
|
9443
|
-
Optional request information for telemetry and debugging purposes.
|
|
9444
|
-
*/
|
|
9445
|
-
request?: {
|
|
9446
|
-
/**
|
|
9447
|
-
Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
|
|
9448
|
-
Non-HTTP(s) providers should not set this.
|
|
9449
|
-
*/
|
|
9450
|
-
body?: string;
|
|
9451
|
-
};
|
|
9452
|
-
/**
|
|
9453
|
-
Response information for telemetry and debugging purposes.
|
|
9454
|
-
*/
|
|
9455
|
-
response: {
|
|
9456
|
-
/**
|
|
9457
|
-
Timestamp for the start of the generated response.
|
|
9458
|
-
*/
|
|
9459
|
-
timestamp: Date;
|
|
9460
|
-
/**
|
|
9461
|
-
The ID of the response model that was used to generate the response.
|
|
9462
|
-
*/
|
|
9463
|
-
modelId: string;
|
|
9464
|
-
/**
|
|
9465
|
-
Response headers.
|
|
9466
|
-
*/
|
|
9467
|
-
headers?: SharedV2Headers_2;
|
|
9468
|
-
/**
|
|
9469
|
-
Response body.
|
|
9470
|
-
*/
|
|
9471
|
-
body?: unknown;
|
|
9472
|
-
};
|
|
9473
|
-
/**
|
|
9474
|
-
Additional provider-specific metadata. They are passed through
|
|
9475
|
-
from the provider to the AI SDK and enable provider-specific
|
|
9476
|
-
results that can be fully encapsulated in the provider.
|
|
9477
|
-
*/
|
|
9478
|
-
providerMetadata?: Record<string, Record<string, JSONValue_3>>;
|
|
9479
|
-
}>;
|
|
9480
|
-
};
|
|
9481
|
-
|
|
9482
8248
|
declare type TranscriptionModelV2CallOptions = {
|
|
9483
8249
|
/**
|
|
9484
8250
|
Audio data to transcribe.
|
|
@@ -9517,44 +8283,6 @@ declare type TranscriptionModelV2CallOptions = {
|
|
|
9517
8283
|
headers?: Record<string, string | undefined>;
|
|
9518
8284
|
};
|
|
9519
8285
|
|
|
9520
|
-
declare type TranscriptionModelV2CallOptions_2 = {
|
|
9521
|
-
/**
|
|
9522
|
-
Audio data to transcribe.
|
|
9523
|
-
Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file.
|
|
9524
|
-
*/
|
|
9525
|
-
audio: Uint8Array | string;
|
|
9526
|
-
/**
|
|
9527
|
-
The IANA media type of the audio data.
|
|
9528
|
-
|
|
9529
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
9530
|
-
*/
|
|
9531
|
-
mediaType: string;
|
|
9532
|
-
/**
|
|
9533
|
-
Additional provider-specific options that are passed through to the provider
|
|
9534
|
-
as body parameters.
|
|
9535
|
-
|
|
9536
|
-
The outer record is keyed by the provider name, and the inner
|
|
9537
|
-
record is keyed by the provider-specific metadata key.
|
|
9538
|
-
```ts
|
|
9539
|
-
{
|
|
9540
|
-
"openai": {
|
|
9541
|
-
"timestampGranularities": ["word"]
|
|
9542
|
-
}
|
|
9543
|
-
}
|
|
9544
|
-
```
|
|
9545
|
-
*/
|
|
9546
|
-
providerOptions?: TranscriptionModelV2ProviderOptions_2;
|
|
9547
|
-
/**
|
|
9548
|
-
Abort signal for cancelling the operation.
|
|
9549
|
-
*/
|
|
9550
|
-
abortSignal?: AbortSignal;
|
|
9551
|
-
/**
|
|
9552
|
-
Additional HTTP headers to be sent with the request.
|
|
9553
|
-
Only applicable for HTTP-based providers.
|
|
9554
|
-
*/
|
|
9555
|
-
headers?: Record<string, string | undefined>;
|
|
9556
|
-
};
|
|
9557
|
-
|
|
9558
8286
|
/**
|
|
9559
8287
|
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
9560
8288
|
some settings might not be supported, which can lead to suboptimal results.
|
|
@@ -9568,28 +8296,13 @@ declare type TranscriptionModelV2CallWarning = {
|
|
|
9568
8296
|
message: string;
|
|
9569
8297
|
};
|
|
9570
8298
|
|
|
9571
|
-
/**
|
|
9572
|
-
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
9573
|
-
some settings might not be supported, which can lead to suboptimal results.
|
|
9574
|
-
*/
|
|
9575
|
-
declare type TranscriptionModelV2CallWarning_2 = {
|
|
9576
|
-
type: 'unsupported-setting';
|
|
9577
|
-
setting: keyof TranscriptionModelV2CallOptions_2;
|
|
9578
|
-
details?: string;
|
|
9579
|
-
} | {
|
|
9580
|
-
type: 'other';
|
|
9581
|
-
message: string;
|
|
9582
|
-
};
|
|
9583
|
-
|
|
9584
8299
|
declare type TranscriptionModelV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
|
|
9585
8300
|
|
|
9586
|
-
declare type TranscriptionModelV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
|
|
9587
|
-
|
|
9588
8301
|
/**
|
|
9589
8302
|
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
9590
8303
|
some settings might not be supported, which can lead to suboptimal results.
|
|
9591
8304
|
*/
|
|
9592
|
-
export declare type TranscriptionWarning =
|
|
8305
|
+
export declare type TranscriptionWarning = TranscriptionModelV2CallWarning;
|
|
9593
8306
|
|
|
9594
8307
|
export declare type TypedToolCall<TOOLS extends ToolSet> = StaticToolCall<TOOLS> | DynamicToolCall;
|
|
9595
8308
|
|
|
@@ -9598,7 +8311,7 @@ export declare type TypedToolError<TOOLS extends ToolSet> = StaticToolError<TOOL
|
|
|
9598
8311
|
export declare type TypedToolResult<TOOLS extends ToolSet> = StaticToolResult<TOOLS> | DynamicToolResult;
|
|
9599
8312
|
|
|
9600
8313
|
export declare class TypeValidationError extends AISDKError {
|
|
9601
|
-
private readonly [symbol$
|
|
8314
|
+
private readonly [symbol$1];
|
|
9602
8315
|
readonly value: unknown;
|
|
9603
8316
|
constructor({ value, cause }: {
|
|
9604
8317
|
value: unknown;
|
|
@@ -9621,30 +8334,6 @@ export declare class TypeValidationError extends AISDKError {
|
|
|
9621
8334
|
}): TypeValidationError;
|
|
9622
8335
|
}
|
|
9623
8336
|
|
|
9624
|
-
declare class TypeValidationError_2 extends AISDKError_2 {
|
|
9625
|
-
private readonly [symbol$1];
|
|
9626
|
-
readonly value: unknown;
|
|
9627
|
-
constructor({ value, cause }: {
|
|
9628
|
-
value: unknown;
|
|
9629
|
-
cause: unknown;
|
|
9630
|
-
});
|
|
9631
|
-
static isInstance(error: unknown): error is TypeValidationError_2;
|
|
9632
|
-
/**
|
|
9633
|
-
* Wraps an error into a TypeValidationError.
|
|
9634
|
-
* If the cause is already a TypeValidationError with the same value, it returns the cause.
|
|
9635
|
-
* Otherwise, it creates a new TypeValidationError.
|
|
9636
|
-
*
|
|
9637
|
-
* @param {Object} params - The parameters for wrapping the error.
|
|
9638
|
-
* @param {unknown} params.value - The value that failed validation.
|
|
9639
|
-
* @param {unknown} params.cause - The original error or cause of the validation failure.
|
|
9640
|
-
* @returns {TypeValidationError} A TypeValidationError instance.
|
|
9641
|
-
*/
|
|
9642
|
-
static wrap({ value, cause, }: {
|
|
9643
|
-
value: unknown;
|
|
9644
|
-
cause: unknown;
|
|
9645
|
-
}): TypeValidationError_2;
|
|
9646
|
-
}
|
|
9647
|
-
|
|
9648
8337
|
export declare const UI_MESSAGE_STREAM_HEADERS: {
|
|
9649
8338
|
'content-type': string;
|
|
9650
8339
|
'cache-control': string;
|
|
@@ -10173,6 +8862,15 @@ export declare type UserModelMessage = {
|
|
|
10173
8862
|
|
|
10174
8863
|
export declare const userModelMessageSchema: z.ZodType<UserModelMessage>;
|
|
10175
8864
|
|
|
8865
|
+
/**
|
|
8866
|
+
* Validates that a URL is safe to download from, blocking private/internal addresses
|
|
8867
|
+
* to prevent SSRF attacks.
|
|
8868
|
+
*
|
|
8869
|
+
* @param url - The URL string to validate.
|
|
8870
|
+
* @throws DownloadError if the URL is unsafe.
|
|
8871
|
+
*/
|
|
8872
|
+
declare function validateDownloadUrl(url: string): void;
|
|
8873
|
+
|
|
10176
8874
|
/**
|
|
10177
8875
|
* Validates the types of an unknown object using a schema and
|
|
10178
8876
|
* return a strongly-typed object.
|
|
@@ -10308,11 +9006,11 @@ declare function withUserAgentSuffix(headers: HeadersInit | Record<string, strin
|
|
|
10308
9006
|
* @returns A new LanguageModelV2 instance with middleware applied.
|
|
10309
9007
|
*/
|
|
10310
9008
|
export declare const wrapLanguageModel: ({ model, middleware: middlewareArg, modelId, providerId, }: {
|
|
10311
|
-
model:
|
|
9009
|
+
model: LanguageModelV2;
|
|
10312
9010
|
middleware: LanguageModelMiddleware | LanguageModelMiddleware[];
|
|
10313
9011
|
modelId?: string;
|
|
10314
9012
|
providerId?: string;
|
|
10315
|
-
}) =>
|
|
9013
|
+
}) => LanguageModelV2;
|
|
10316
9014
|
|
|
10317
9015
|
/**
|
|
10318
9016
|
* Wraps a ProviderV2 instance with middleware functionality.
|
|
@@ -10326,9 +9024,9 @@ export declare const wrapLanguageModel: ({ model, middleware: middlewareArg, mod
|
|
|
10326
9024
|
* @returns A new ProviderV2 instance with middleware applied to all language models.
|
|
10327
9025
|
*/
|
|
10328
9026
|
export declare function wrapProvider({ provider, languageModelMiddleware, }: {
|
|
10329
|
-
provider:
|
|
9027
|
+
provider: ProviderV2;
|
|
10330
9028
|
languageModelMiddleware: LanguageModelMiddleware | LanguageModelMiddleware[];
|
|
10331
|
-
}):
|
|
9029
|
+
}): ProviderV2;
|
|
10332
9030
|
|
|
10333
9031
|
export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, any> | z3.Schema<OBJECT, z3.ZodTypeDef, any>, options?: {
|
|
10334
9032
|
/**
|
|
@@ -10341,5 +9039,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
|
|
|
10341
9039
|
}): Schema<OBJECT>;
|
|
10342
9040
|
|
|
10343
9041
|
export { }
|
|
10344
|
-
export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult,
|
|
10345
|
-
export { schemaSymbol, symbol$1, symbol$1_2, symbol$
|
|
9042
|
+
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 };
|
|
9043
|
+
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 };
|