@mastra/fastembed 1.0.0 → 1.0.1

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE.md +15 -0
  3. package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +2103 -269
  4. package/dist/{chunk-SG3GRV3O.cjs → chunk-23EXJLET.cjs} +3 -3
  5. package/dist/chunk-23EXJLET.cjs.map +1 -0
  6. package/dist/{chunk-KMQS2YEC.js → chunk-BSDWQEU3.js} +3 -3
  7. package/dist/chunk-BSDWQEU3.js.map +1 -0
  8. package/dist/chunk-EQ4M72KU.js +439 -0
  9. package/dist/chunk-EQ4M72KU.js.map +1 -0
  10. package/dist/{chunk-WC4XBMZT.js → chunk-HJYHDIOC.js} +5 -5
  11. package/dist/chunk-HJYHDIOC.js.map +1 -0
  12. package/dist/{chunk-ZUQPUTTO.cjs → chunk-IDRQZVB4.cjs} +4 -4
  13. package/dist/chunk-IDRQZVB4.cjs.map +1 -0
  14. package/dist/{chunk-YMNW6DEN.cjs → chunk-LIBOSOHM.cjs} +14 -14
  15. package/dist/chunk-LIBOSOHM.cjs.map +1 -0
  16. package/dist/{chunk-MMUHFOCG.js → chunk-RC6RZVYE.js} +4 -4
  17. package/dist/chunk-RC6RZVYE.js.map +1 -0
  18. package/dist/chunk-ZD3BKU5O.cjs +441 -0
  19. package/dist/chunk-ZD3BKU5O.cjs.map +1 -0
  20. package/dist/index.cjs +1153 -465
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.ts +7 -2
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +1142 -455
  25. package/dist/index.js.map +1 -1
  26. package/dist/{token-6GSAFR2W-VLY2XUPA.js → token-6GSAFR2W-ABXTQD64.js} +5 -5
  27. package/dist/token-6GSAFR2W-ABXTQD64.js.map +1 -0
  28. package/dist/{token-6GSAFR2W-YCB5SK2Z.cjs → token-6GSAFR2W-TW2P7HCS.cjs} +8 -8
  29. package/dist/token-6GSAFR2W-TW2P7HCS.cjs.map +1 -0
  30. package/dist/{token-6GSAFR2W-K2BTU23I.js → token-APYSY3BW-2DN6RAUY.js} +11 -11
  31. package/dist/token-APYSY3BW-2DN6RAUY.js.map +1 -0
  32. package/dist/{token-6GSAFR2W-JV3TZR4M.cjs → token-APYSY3BW-ZQ7TMBY7.cjs} +14 -14
  33. package/dist/token-APYSY3BW-ZQ7TMBY7.cjs.map +1 -0
  34. package/dist/token-util-NEHG7TUY-GYFEVMWP.cjs +10 -0
  35. package/dist/{token-util-NEHG7TUY-7IL6JUVY.cjs.map → token-util-NEHG7TUY-GYFEVMWP.cjs.map} +1 -1
  36. package/dist/token-util-NEHG7TUY-XQP3QSPX.js +8 -0
  37. package/dist/{token-util-NEHG7TUY-TIJ3LMSH.js.map → token-util-NEHG7TUY-XQP3QSPX.js.map} +1 -1
  38. package/dist/token-util-RMHT2CPJ-6TGPE335.cjs +10 -0
  39. package/dist/token-util-RMHT2CPJ-6TGPE335.cjs.map +1 -0
  40. package/dist/token-util-RMHT2CPJ-RJEA3FAN.js +8 -0
  41. package/dist/token-util-RMHT2CPJ-RJEA3FAN.js.map +1 -0
  42. package/package.json +12 -12
  43. package/dist/chunk-KMQS2YEC.js.map +0 -1
  44. package/dist/chunk-MMUHFOCG.js.map +0 -1
  45. package/dist/chunk-QY6BZOPJ.js +0 -250
  46. package/dist/chunk-QY6BZOPJ.js.map +0 -1
  47. package/dist/chunk-SG3GRV3O.cjs.map +0 -1
  48. package/dist/chunk-W72AYUIF.cjs +0 -252
  49. package/dist/chunk-W72AYUIF.cjs.map +0 -1
  50. package/dist/chunk-WC4XBMZT.js.map +0 -1
  51. package/dist/chunk-YMNW6DEN.cjs.map +0 -1
  52. package/dist/chunk-ZUQPUTTO.cjs.map +0 -1
  53. package/dist/token-6GSAFR2W-JV3TZR4M.cjs.map +0 -1
  54. package/dist/token-6GSAFR2W-K2BTU23I.js.map +0 -1
  55. package/dist/token-6GSAFR2W-VLY2XUPA.js.map +0 -1
  56. package/dist/token-6GSAFR2W-YCB5SK2Z.cjs.map +0 -1
  57. package/dist/token-util-NEHG7TUY-7IL6JUVY.cjs +0 -10
  58. package/dist/token-util-NEHG7TUY-HF7KBP2H.cjs +0 -10
  59. package/dist/token-util-NEHG7TUY-HF7KBP2H.cjs.map +0 -1
  60. package/dist/token-util-NEHG7TUY-KSXDO2NO.js +0 -8
  61. package/dist/token-util-NEHG7TUY-KSXDO2NO.js.map +0 -1
  62. package/dist/token-util-NEHG7TUY-TIJ3LMSH.js +0 -8
@@ -116,61 +116,61 @@ declare namespace _ai_sdk_provider {
116
116
  JSONSchema7Definition,
117
117
  AISDKError,
118
118
  APICallError,
119
- EmbeddingModelV2,
120
- EmbeddingModelV2Embedding,
119
+ EmbeddingModelV2_2 as EmbeddingModelV2,
120
+ EmbeddingModelV2Embedding_2 as EmbeddingModelV2Embedding,
121
121
  EmptyResponseBodyError,
122
- ImageModelV2,
123
- ImageModelV2CallOptions,
124
- ImageModelV2CallWarning,
125
- ImageModelV2ProviderMetadata,
122
+ ImageModelV2_2 as ImageModelV2,
123
+ ImageModelV2CallOptions_2 as ImageModelV2CallOptions,
124
+ ImageModelV2CallWarning_2 as ImageModelV2CallWarning,
125
+ ImageModelV2ProviderMetadata_2 as ImageModelV2ProviderMetadata,
126
126
  InvalidArgumentError_2 as InvalidArgumentError,
127
127
  InvalidPromptError,
128
128
  InvalidResponseDataError,
129
- JSONArray,
130
- JSONObject,
129
+ JSONArray_2 as JSONArray,
130
+ JSONObject_2 as JSONObject,
131
131
  JSONParseError,
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,
132
+ JSONValue_3 as JSONValue,
133
+ LanguageModelV2_2 as LanguageModelV2,
134
+ LanguageModelV2CallOptions_2 as LanguageModelV2CallOptions,
135
+ LanguageModelV2CallWarning_2 as LanguageModelV2CallWarning,
136
+ LanguageModelV2Content_2 as LanguageModelV2Content,
137
+ LanguageModelV2DataContent_2 as LanguageModelV2DataContent,
138
+ LanguageModelV2File_2 as LanguageModelV2File,
139
+ LanguageModelV2FilePart_2 as LanguageModelV2FilePart,
140
+ LanguageModelV2FinishReason_2 as LanguageModelV2FinishReason,
141
+ LanguageModelV2FunctionTool_2 as LanguageModelV2FunctionTool,
142
+ LanguageModelV2Message_2 as LanguageModelV2Message,
143
143
  LanguageModelV2Middleware,
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,
144
+ LanguageModelV2Prompt_2 as LanguageModelV2Prompt,
145
+ LanguageModelV2ProviderDefinedTool_2 as LanguageModelV2ProviderDefinedTool,
146
+ LanguageModelV2Reasoning_2 as LanguageModelV2Reasoning,
147
+ LanguageModelV2ReasoningPart_2 as LanguageModelV2ReasoningPart,
148
+ LanguageModelV2ResponseMetadata_2 as LanguageModelV2ResponseMetadata,
149
+ LanguageModelV2Source_2 as LanguageModelV2Source,
150
+ LanguageModelV2StreamPart_2 as LanguageModelV2StreamPart,
151
+ LanguageModelV2Text_2 as LanguageModelV2Text,
152
+ LanguageModelV2TextPart_2 as LanguageModelV2TextPart,
153
+ LanguageModelV2ToolCall_2 as LanguageModelV2ToolCall,
154
+ LanguageModelV2ToolCallPart_2 as LanguageModelV2ToolCallPart,
155
+ LanguageModelV2ToolChoice_2 as LanguageModelV2ToolChoice,
156
+ LanguageModelV2ToolResultOutput_2 as LanguageModelV2ToolResultOutput,
157
+ LanguageModelV2ToolResultPart_2 as LanguageModelV2ToolResultPart,
158
+ LanguageModelV2Usage_2 as LanguageModelV2Usage,
159
159
  LoadAPIKeyError,
160
160
  LoadSettingError,
161
161
  NoContentGeneratedError,
162
162
  NoSuchModelError,
163
- ProviderV2,
164
- SharedV2Headers,
165
- SharedV2ProviderMetadata,
166
- SharedV2ProviderOptions,
167
- SpeechModelV2,
168
- SpeechModelV2CallOptions,
169
- SpeechModelV2CallWarning,
163
+ ProviderV2_2 as ProviderV2,
164
+ SharedV2Headers_2 as SharedV2Headers,
165
+ SharedV2ProviderMetadata_2 as SharedV2ProviderMetadata,
166
+ SharedV2ProviderOptions_2 as SharedV2ProviderOptions,
167
+ SpeechModelV2_2 as SpeechModelV2,
168
+ SpeechModelV2CallOptions_2 as SpeechModelV2CallOptions,
169
+ SpeechModelV2CallWarning_2 as SpeechModelV2CallWarning,
170
170
  TooManyEmbeddingValuesForCallError,
171
- TranscriptionModelV2,
172
- TranscriptionModelV2CallOptions,
173
- TranscriptionModelV2CallWarning,
171
+ TranscriptionModelV2_2 as TranscriptionModelV2,
172
+ TranscriptionModelV2CallOptions_2 as TranscriptionModelV2CallOptions,
173
+ TranscriptionModelV2CallWarning_2 as TranscriptionModelV2CallWarning,
174
174
  TypeValidationError,
175
175
  UnsupportedFunctionalityError,
176
176
  getErrorMessage_2 as getErrorMessage,
@@ -290,7 +290,7 @@ declare namespace _ai_sdk_provider_utils {
290
290
  * @extends Error
291
291
  */
292
292
  export declare class AISDKError extends Error {
293
- private readonly [symbol$d];
293
+ private readonly [symbol$d_2];
294
294
  /**
295
295
  * The underlying cause of the error, if any.
296
296
  */
@@ -317,8 +317,40 @@ export declare class AISDKError extends Error {
317
317
  protected static hasMarker(error: unknown, marker: string): boolean;
318
318
  }
319
319
 
320
+ /**
321
+ * Custom error class for AI SDK related errors.
322
+ * @extends Error
323
+ */
324
+ declare class AISDKError_2 extends Error {
325
+ private readonly [symbol$d];
326
+ /**
327
+ * The underlying cause of the error, if any.
328
+ */
329
+ readonly cause?: unknown;
330
+ /**
331
+ * Creates an AI SDK Error.
332
+ *
333
+ * @param {Object} params - The parameters for creating the error.
334
+ * @param {string} params.name - The name of the error.
335
+ * @param {string} params.message - The error message.
336
+ * @param {unknown} [params.cause] - The underlying cause of the error.
337
+ */
338
+ constructor({ name, message, cause, }: {
339
+ name: string;
340
+ message: string;
341
+ cause?: unknown;
342
+ });
343
+ /**
344
+ * Checks if the given error is an AI SDK Error.
345
+ * @param {unknown} error - The error to check.
346
+ * @returns {boolean} True if the error is an AI SDK Error, false otherwise.
347
+ */
348
+ static isInstance(error: unknown): error is AISDKError_2;
349
+ protected static hasMarker(error: unknown, marker: string): boolean;
350
+ }
351
+
320
352
  export declare class APICallError extends AISDKError {
321
- private readonly [symbol$c];
353
+ private readonly [symbol$c_2];
322
354
  readonly url: string;
323
355
  readonly requestBodyValues: unknown;
324
356
  readonly statusCode?: number;
@@ -341,6 +373,30 @@ export declare class APICallError extends AISDKError {
341
373
  static isInstance(error: unknown): error is APICallError;
342
374
  }
343
375
 
376
+ declare class APICallError_2 extends AISDKError_2 {
377
+ private readonly [symbol$c];
378
+ readonly url: string;
379
+ readonly requestBodyValues: unknown;
380
+ readonly statusCode?: number;
381
+ readonly responseHeaders?: Record<string, string>;
382
+ readonly responseBody?: string;
383
+ readonly isRetryable: boolean;
384
+ readonly data?: unknown;
385
+ constructor({ message, url, requestBodyValues, statusCode, responseHeaders, responseBody, cause, isRetryable, // server error
386
+ data, }: {
387
+ message: string;
388
+ url: string;
389
+ requestBodyValues: unknown;
390
+ statusCode?: number;
391
+ responseHeaders?: Record<string, string>;
392
+ responseBody?: string;
393
+ cause?: unknown;
394
+ isRetryable?: boolean;
395
+ data?: unknown;
396
+ });
397
+ static isInstance(error: unknown): error is APICallError_2;
398
+ }
399
+
344
400
  export declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
345
401
 
346
402
  /**
@@ -482,7 +538,7 @@ export declare type CallSettings = {
482
538
  Warning from the model provider for this call. The call will proceed, but e.g.
483
539
  some settings might not be supported, which can lead to suboptimal results.
484
540
  */
485
- export declare type CallWarning = LanguageModelV2CallWarning;
541
+ export declare type CallWarning = LanguageModelV2CallWarning_2;
486
542
 
487
543
  export declare interface ChatInit<UI_MESSAGE extends UIMessage> {
488
544
  /**
@@ -879,7 +935,7 @@ declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage,
879
935
  errorSchema: FlexibleValidator<T>;
880
936
  errorToMessage: (error: T) => string;
881
937
  isRetryable?: (response: Response, error?: T) => boolean;
882
- }) => ResponseHandler<APICallError>;
938
+ }) => ResponseHandler<APICallError_2>;
883
939
 
884
940
  declare const createJsonResponseHandler: <T>(responseSchema: FlexibleValidator<T>) => ResponseHandler<T>;
885
941
 
@@ -910,12 +966,12 @@ declare function createProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT,
910
966
  * @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.
911
967
  * @returns A new ProviderRegistryProvider instance that provides access to all registered providers with optional middleware applied to language models.
912
968
  */
913
- export declare function createProviderRegistry<PROVIDERS extends Record<string, ProviderV2>, SEPARATOR extends string = ':'>(providers: PROVIDERS, { separator, languageModelMiddleware, }?: {
969
+ export declare function createProviderRegistry<PROVIDERS extends Record<string, ProviderV2_2>, SEPARATOR extends string = ':'>(providers: PROVIDERS, { separator, languageModelMiddleware, }?: {
914
970
  separator?: SEPARATOR;
915
971
  languageModelMiddleware?: LanguageModelMiddleware | LanguageModelMiddleware[];
916
972
  }): ProviderRegistryProvider<PROVIDERS, SEPARATOR>;
917
973
 
918
- declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
974
+ declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError_2>;
919
975
 
920
976
  export declare function createTextStreamResponse({ status, statusText, headers, textStream, }: ResponseInit & {
921
977
  textStream: ReadableStream<string>;
@@ -958,19 +1014,19 @@ export declare function createUIMessageStreamResponse({ status, statusText, head
958
1014
  *
959
1015
  * @throws {NoSuchModelError} Throws when a requested model is not found and no fallback provider is available.
960
1016
  */
961
- 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, }: {
1017
+ export declare function customProvider<LANGUAGE_MODELS extends Record<string, LanguageModelV2_2>, EMBEDDING_MODELS extends Record<string, EmbeddingModelV2_2<string>>, IMAGE_MODELS extends Record<string, ImageModelV2_2>, TRANSCRIPTION_MODELS extends Record<string, TranscriptionModelV2_2>, SPEECH_MODELS extends Record<string, SpeechModelV2_2>>({ languageModels, textEmbeddingModels, imageModels, transcriptionModels, speechModels, fallbackProvider, }: {
962
1018
  languageModels?: LANGUAGE_MODELS;
963
1019
  textEmbeddingModels?: EMBEDDING_MODELS;
964
1020
  imageModels?: IMAGE_MODELS;
965
1021
  transcriptionModels?: TRANSCRIPTION_MODELS;
966
1022
  speechModels?: SPEECH_MODELS;
967
- fallbackProvider?: ProviderV2;
968
- }): ProviderV2 & {
969
- languageModel(modelId: ExtractModelId<LANGUAGE_MODELS>): LanguageModelV2;
970
- textEmbeddingModel(modelId: ExtractModelId<EMBEDDING_MODELS>): EmbeddingModelV2<string>;
971
- imageModel(modelId: ExtractModelId<IMAGE_MODELS>): ImageModelV2;
972
- transcriptionModel(modelId: ExtractModelId<TRANSCRIPTION_MODELS>): TranscriptionModelV2;
973
- speechModel(modelId: ExtractModelId<SPEECH_MODELS>): SpeechModelV2;
1023
+ fallbackProvider?: ProviderV2_2;
1024
+ }): ProviderV2_2 & {
1025
+ languageModel(modelId: ExtractModelId<LANGUAGE_MODELS>): LanguageModelV2_2;
1026
+ textEmbeddingModel(modelId: ExtractModelId<EMBEDDING_MODELS>): EmbeddingModelV2_2<string>;
1027
+ imageModel(modelId: ExtractModelId<IMAGE_MODELS>): ImageModelV2_2;
1028
+ transcriptionModel(modelId: ExtractModelId<TRANSCRIPTION_MODELS>): TranscriptionModelV2_2;
1029
+ speechModel(modelId: ExtractModelId<SPEECH_MODELS>): SpeechModelV2_2;
974
1030
  };
975
1031
 
976
1032
  /**
@@ -1016,19 +1072,19 @@ export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends
1016
1072
  */
1017
1073
  export declare function defaultSettingsMiddleware({ settings, }: {
1018
1074
  settings: Partial<{
1019
- maxOutputTokens?: LanguageModelV2CallOptions['maxOutputTokens'];
1020
- temperature?: LanguageModelV2CallOptions['temperature'];
1021
- stopSequences?: LanguageModelV2CallOptions['stopSequences'];
1022
- topP?: LanguageModelV2CallOptions['topP'];
1023
- topK?: LanguageModelV2CallOptions['topK'];
1024
- presencePenalty?: LanguageModelV2CallOptions['presencePenalty'];
1025
- frequencyPenalty?: LanguageModelV2CallOptions['frequencyPenalty'];
1026
- responseFormat?: LanguageModelV2CallOptions['responseFormat'];
1027
- seed?: LanguageModelV2CallOptions['seed'];
1028
- tools?: LanguageModelV2CallOptions['tools'];
1029
- toolChoice?: LanguageModelV2CallOptions['toolChoice'];
1030
- headers?: LanguageModelV2CallOptions['headers'];
1031
- providerOptions?: LanguageModelV2CallOptions['providerOptions'];
1075
+ maxOutputTokens?: LanguageModelV2CallOptions_2['maxOutputTokens'];
1076
+ temperature?: LanguageModelV2CallOptions_2['temperature'];
1077
+ stopSequences?: LanguageModelV2CallOptions_2['stopSequences'];
1078
+ topP?: LanguageModelV2CallOptions_2['topP'];
1079
+ topK?: LanguageModelV2CallOptions_2['topK'];
1080
+ presencePenalty?: LanguageModelV2CallOptions_2['presencePenalty'];
1081
+ frequencyPenalty?: LanguageModelV2CallOptions_2['frequencyPenalty'];
1082
+ responseFormat?: LanguageModelV2CallOptions_2['responseFormat'];
1083
+ seed?: LanguageModelV2CallOptions_2['seed'];
1084
+ tools?: LanguageModelV2CallOptions_2['tools'];
1085
+ toolChoice?: LanguageModelV2CallOptions_2['toolChoice'];
1086
+ headers?: LanguageModelV2CallOptions_2['headers'];
1087
+ providerOptions?: LanguageModelV2CallOptions_2['providerOptions'];
1032
1088
  }>;
1033
1089
  }): LanguageModelMiddleware;
1034
1090
 
@@ -1223,12 +1279,12 @@ export declare function embed<VALUE = string>({ model: modelArg, value, provider
1223
1279
  /**
1224
1280
  Embedding.
1225
1281
  */
1226
- export declare type Embedding = EmbeddingModelV2Embedding;
1282
+ export declare type Embedding = EmbeddingModelV2Embedding_2;
1227
1283
 
1228
1284
  /**
1229
1285
  Embedding model that is used by the AI SDK Core functions.
1230
1286
  */
1231
- export declare type EmbeddingModel<VALUE = string> = string | EmbeddingModelV2<VALUE>;
1287
+ export declare type EmbeddingModel<VALUE = string> = string | EmbeddingModelV2_2<VALUE>;
1232
1288
 
1233
1289
  /**
1234
1290
  Represents the number of tokens used in an embedding.
@@ -1334,12 +1390,112 @@ declare type EmbeddingModelV2<VALUE> = {
1334
1390
  }>;
1335
1391
  };
1336
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
+
1337
1487
  /**
1338
1488
  An embedding is a vector, i.e. an array of numbers.
1339
1489
  It is e.g. used to represent a text as a vector of word embeddings.
1340
1490
  */
1341
1491
  declare type EmbeddingModelV2Embedding = Array<number>;
1342
1492
 
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
+
1343
1499
  /**
1344
1500
  Embed several values using an embedding model. The type of the value is defined
1345
1501
  by the embedding model.
@@ -1840,7 +1996,7 @@ export declare function experimental_generateSpeech({ model, text, voice, output
1840
1996
  /**
1841
1997
  The speech model to use.
1842
1998
  */
1843
- model: SpeechModelV2;
1999
+ model: SpeechModelV2_2;
1844
2000
  /**
1845
2001
  The text to convert to speech.
1846
2002
  */
@@ -1923,7 +2079,7 @@ export declare interface Experimental_SpeechResult {
1923
2079
  /**
1924
2080
  Provider metadata from the provider.
1925
2081
  */
1926
- readonly providerMetadata: Record<string, Record<string, JSONValue_2>>;
2082
+ readonly providerMetadata: Record<string, Record<string, JSONValue_3>>;
1927
2083
  }
1928
2084
 
1929
2085
  /**
@@ -1943,7 +2099,7 @@ export declare function experimental_transcribe({ model, audio, providerOptions,
1943
2099
  /**
1944
2100
  The transcription model to use.
1945
2101
  */
1946
- model: TranscriptionModelV2;
2102
+ model: TranscriptionModelV2_2;
1947
2103
  /**
1948
2104
  The audio data to transcribe.
1949
2105
  */
@@ -2028,10 +2184,10 @@ export declare interface Experimental_TranscriptionResult {
2028
2184
  /**
2029
2185
  Provider metadata from the provider.
2030
2186
  */
2031
- readonly providerMetadata: Record<string, Record<string, JSONValue_2>>;
2187
+ readonly providerMetadata: Record<string, Record<string, JSONValue_3>>;
2032
2188
  }
2033
2189
 
2034
- export declare type Experimental_Warning = LanguageModelV2CallWarning | ImageModelV2CallWarning | SpeechModelV2CallWarning | TranscriptionModelV2CallWarning;
2190
+ export declare type Experimental_Warning = LanguageModelV2CallWarning_2 | ImageModelV2CallWarning_2 | SpeechModelV2CallWarning_2 | TranscriptionModelV2CallWarning_2;
2035
2191
 
2036
2192
  declare type ExtractLiteralUnion<T> = T extends string ? string extends T ? never : T : never;
2037
2193
 
@@ -2133,7 +2289,7 @@ export declare type FileUIPart = {
2133
2289
  - `error`: model stopped because of an error
2134
2290
  - `other`: model stopped for other reasons
2135
2291
  */
2136
- export declare type FinishReason = LanguageModelV2FinishReason;
2292
+ export declare type FinishReason = LanguageModelV2FinishReason_2;
2137
2293
 
2138
2294
  declare type FlexibleSchema<SCHEMA> = z4.core.$ZodType<SCHEMA, any> | z3.Schema<SCHEMA, z3.ZodTypeDef, any> | Schema<SCHEMA> | LazySchema<SCHEMA>;
2139
2295
 
@@ -2154,7 +2310,7 @@ declare interface GatewayFetchMetadataResponse {
2154
2310
  models: GatewayLanguageModelEntry[];
2155
2311
  }
2156
2312
 
2157
- declare type GatewayImageModelId = 'google/imagen-4.0-generate' | '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' | (string & {});
2313
+ declare type GatewayImageModelId = 'google/imagen-4.0-generate' | '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' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | (string & {});
2158
2314
 
2159
2315
  declare interface GatewayLanguageModelEntry {
2160
2316
  /**
@@ -2205,7 +2361,7 @@ declare interface GatewayLanguageModelEntry {
2205
2361
 
2206
2362
  declare type GatewayLanguageModelSpecification = Pick<LanguageModelV2, 'specificationVersion' | 'provider' | 'modelId'>;
2207
2363
 
2208
- 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-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | '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-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3-opus' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.5-sonnet' | 'anthropic/claude-3.5-sonnet-20240620' | '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-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'arcee-ai/trinity-mini' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2-exp' | 'deepseek/deepseek-v3.2-exp-thinking' | '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-image-preview' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-flash-lite-preview-09-2025' | 'google/gemini-2.5-flash-preview-09-2025' | 'google/gemini-2.5-pro' | 'google/gemini-3-pro-preview' | 'google/gemini-3-pro-image' | 'inception/mercury-coder-small' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking' | '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' | 'mistral/codestral' | 'mistral/devstral-small' | 'mistral/magistral-medium' | 'mistral/magistral-medium-2506' | 'mistral/magistral-small' | 'mistral/magistral-small-2506' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large' | 'mistral/mistral-medium' | 'mistral/mistral-small' | 'mistral/mixtral-8x22b-instruct' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-0905' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | '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-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-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat-latest' | 'openai/gpt-5.2-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/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning' | 'perplexity/sonar-reasoning-pro' | 'prime-intellect/intellect-3' | 'stealth/sonoma-dusk-alpha' | 'stealth/sonoma-sky-alpha' | 'vercel/v0-1.0-md' | 'vercel/v0-1.5-md' | 'xai/grok-2' | 'xai/grok-2-vision' | '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-reasoning' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-code-fast-1' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | (string & {});
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-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3-opus' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.5-sonnet' | 'anthropic/claude-3.5-sonnet-20240620' | '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-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'arcee-ai/trinity-large-preview' | '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-exp' | 'deepseek/deepseek-v3.2-exp-thinking' | '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-image-preview' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-flash-lite-preview-09-2025' | 'google/gemini-2.5-flash-preview-09-2025' | 'google/gemini-2.5-pro' | 'google/gemini-3-pro-preview' | 'google/gemini-3-pro-image' | 'google/gemini-3-flash' | 'inception/mercury-coder-small' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking' | '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' | 'mistral/codestral' | 'mistral/devstral-small' | 'mistral/magistral-medium' | 'mistral/magistral-medium-2506' | 'mistral/magistral-small' | 'mistral/magistral-small-2506' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large' | 'mistral/mistral-medium' | 'mistral/mistral-small' | 'mistral/mixtral-8x22b-instruct' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-0905' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'moonshotai/kimi-k2.5' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | '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-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat-latest' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-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/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning' | 'perplexity/sonar-reasoning-pro' | 'prime-intellect/intellect-3' | 'vercel/v0-1.0-md' | 'vercel/v0-1.5-md' | 'xai/grok-2-vision' | '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-reasoning' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-code-fast-1' | '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-flashx' | (string & {});
2209
2365
 
2210
2366
  declare interface GatewayProvider extends ProviderV2 {
2211
2367
  (modelId: GatewayModelId): LanguageModelV2;
@@ -2229,6 +2385,10 @@ declare interface GatewayProvider extends ProviderV2 {
2229
2385
  Creates a model for generating images.
2230
2386
  */
2231
2387
  imageModel(modelId: GatewayImageModelId): ImageModelV2;
2388
+ /**
2389
+ Gateway-specific tools executed server-side.
2390
+ */
2391
+ tools: typeof gatewayTools;
2232
2392
  }
2233
2393
 
2234
2394
  declare interface GatewayProviderSettings {
@@ -2255,6 +2415,29 @@ declare interface GatewayProviderSettings {
2255
2415
  metadataCacheRefreshMillis?: number;
2256
2416
  }
2257
2417
 
2418
+ /**
2419
+ * Gateway-specific provider-defined tools.
2420
+ */
2421
+ declare const gatewayTools: {
2422
+ /**
2423
+ * Search the web using Parallel AI's Search API for LLM-optimized excerpts.
2424
+ *
2425
+ * Takes a natural language objective and returns relevant excerpts,
2426
+ * replacing multiple keyword searches with a single call for broad
2427
+ * or complex queries. Supports different search types for depth vs
2428
+ * breadth tradeoffs.
2429
+ */
2430
+ parallelSearch: (config?: ParallelSearchConfig) => ReturnType<typeof parallelSearchToolFactory>;
2431
+ /**
2432
+ * Search the web using Perplexity's Search API for real-time information,
2433
+ * news, research papers, and articles.
2434
+ *
2435
+ * Provides ranked search results with advanced filtering options including
2436
+ * domain, language, date range, and recency filters.
2437
+ */
2438
+ perplexitySearch: (config?: PerplexitySearchConfig) => ReturnType<typeof perplexitySearchToolFactory>;
2439
+ };
2440
+
2258
2441
  /**
2259
2442
  * A generated audio file.
2260
2443
  */
@@ -2357,7 +2540,7 @@ export declare const generateId: IdGenerator;
2357
2540
  @returns
2358
2541
  A result object that contains the generated object, the finish reason, the token usage, and additional information.
2359
2542
  */
2360
- 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' ? {
2543
+ export declare function generateObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue_3>, 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' ? {
2361
2544
  /**
2362
2545
  The enum values that the model should use.
2363
2546
  */
@@ -2750,6 +2933,10 @@ declare type GetMaxImagesPerCallFunction = (options: {
2750
2933
  modelId: string;
2751
2934
  }) => PromiseLike<number | undefined> | number | undefined;
2752
2935
 
2936
+ declare type GetMaxImagesPerCallFunction_2 = (options: {
2937
+ modelId: string;
2938
+ }) => PromiseLike<number | undefined> | number | undefined;
2939
+
2753
2940
  declare const getOriginalFetch: () => typeof fetch;
2754
2941
 
2755
2942
  declare function getRuntimeEnvironmentUserAgent(globalThisAny?: any): string;
@@ -2870,18 +3057,18 @@ export declare type IdGenerator = () => string;
2870
3057
  /**
2871
3058
  Image model that is used by the AI SDK Core functions.
2872
3059
  */
2873
- export declare type ImageModel = string | ImageModelV2;
3060
+ export declare type ImageModel = string | ImageModelV2_2;
2874
3061
 
2875
3062
  /**
2876
3063
  Warning from the model provider for this call. The call will proceed, but e.g.
2877
3064
  some settings might not be supported, which can lead to suboptimal results.
2878
3065
  */
2879
- export declare type ImageModelCallWarning = ImageModelV2CallWarning;
3066
+ export declare type ImageModelCallWarning = ImageModelV2CallWarning_2;
2880
3067
 
2881
3068
  /**
2882
3069
  Metadata from the model provider for this call
2883
3070
  */
2884
- export declare type ImageModelProviderMetadata = ImageModelV2ProviderMetadata;
3071
+ export declare type ImageModelProviderMetadata = ImageModelV2ProviderMetadata_2;
2885
3072
 
2886
3073
  export declare type ImageModelResponseMetadata = {
2887
3074
  /**
@@ -2979,6 +3166,87 @@ declare type ImageModelV2 = {
2979
3166
  }>;
2980
3167
  };
2981
3168
 
3169
+ /**
3170
+ Image generation model specification version 2.
3171
+ */
3172
+ declare type ImageModelV2_2 = {
3173
+ /**
3174
+ The image model must specify which image model interface
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.
3179
+ */
3180
+ readonly specificationVersion: 'v2';
3181
+ /**
3182
+ Name of the provider for logging purposes.
3183
+ */
3184
+ readonly provider: string;
3185
+ /**
3186
+ Provider-specific model ID for logging purposes.
3187
+ */
3188
+ readonly modelId: string;
3189
+ /**
3190
+ Limit of how many images can be generated in a single API call.
3191
+ Can be set to a number for a fixed limit, to undefined to use
3192
+ the global limit, or a function that returns a number or undefined,
3193
+ optionally as a promise.
3194
+ */
3195
+ readonly maxImagesPerCall: number | undefined | GetMaxImagesPerCallFunction_2;
3196
+ /**
3197
+ Generates an array of images.
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
+
2982
3250
  declare type ImageModelV2CallOptions = {
2983
3251
  /**
2984
3252
  Prompt for the image generation.
@@ -3031,23 +3299,92 @@ declare type ImageModelV2CallOptions = {
3031
3299
  headers?: Record<string, string | undefined>;
3032
3300
  };
3033
3301
 
3034
- /**
3035
- Warning from the model provider for this call. The call will proceed, but e.g.
3036
- some settings might not be supported, which can lead to suboptimal results.
3037
- */
3038
- declare type ImageModelV2CallWarning = {
3039
- type: 'unsupported-setting';
3040
- setting: keyof ImageModelV2CallOptions;
3041
- details?: string;
3042
- } | {
3043
- type: 'other';
3044
- message: string;
3045
- };
3046
-
3047
- declare type ImageModelV2ProviderMetadata = Record<string, {
3048
- images: JSONArray;
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
+ /**
3355
+ Warning from the model provider for this call. The call will proceed, but e.g.
3356
+ some settings might not be supported, which can lead to suboptimal results.
3357
+ */
3358
+ declare type ImageModelV2CallWarning = {
3359
+ type: 'unsupported-setting';
3360
+ setting: keyof ImageModelV2CallOptions;
3361
+ details?: string;
3362
+ } | {
3363
+ type: 'other';
3364
+ message: string;
3365
+ };
3366
+
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
+ declare type ImageModelV2ProviderMetadata = Record<string, {
3381
+ images: JSONArray;
3049
3382
  } & JSONValue_2>;
3050
3383
 
3384
+ declare type ImageModelV2ProviderMetadata_2 = Record<string, {
3385
+ images: JSONArray_2;
3386
+ } & JSONValue_3>;
3387
+
3051
3388
  /**
3052
3389
  Image content part of a prompt. It contains an image.
3053
3390
  */
@@ -3135,7 +3472,7 @@ declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPre
3135
3472
  }): LanguageModelV2Prompt;
3136
3473
 
3137
3474
  export declare class InvalidArgumentError extends AISDKError {
3138
- private readonly [symbol$c_2];
3475
+ private readonly [symbol$c_3];
3139
3476
  readonly parameter: string;
3140
3477
  readonly value: unknown;
3141
3478
  constructor({ parameter, value, message, }: {
@@ -3254,11 +3591,11 @@ export declare function isDeepEqualData(obj1: any, obj2: any): boolean;
3254
3591
  */
3255
3592
  export declare function isFileUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is FileUIPart;
3256
3593
 
3257
- declare function isJSONArray(value: unknown): value is JSONArray;
3594
+ declare function isJSONArray(value: unknown): value is JSONArray_2;
3258
3595
 
3259
- declare function isJSONObject(value: unknown): value is JSONObject;
3596
+ declare function isJSONObject(value: unknown): value is JSONObject_2;
3260
3597
 
3261
- declare function isJSONValue(value: unknown): value is JSONValue_2;
3598
+ declare function isJSONValue(value: unknown): value is JSONValue_3;
3262
3599
 
3263
3600
  declare function isParsableJson(input: string): boolean;
3264
3601
 
@@ -3299,12 +3636,18 @@ declare type Job = () => Promise<void>;
3299
3636
 
3300
3637
  declare type JSONArray = JSONValue_2[];
3301
3638
 
3639
+ declare type JSONArray_2 = JSONValue_3[];
3640
+
3302
3641
  declare type JSONObject = {
3303
3642
  [key: string]: JSONValue_2;
3304
3643
  };
3305
3644
 
3645
+ declare type JSONObject_2 = {
3646
+ [key: string]: JSONValue_3;
3647
+ };
3648
+
3306
3649
  export declare class JSONParseError extends AISDKError {
3307
- private readonly [symbol$7];
3650
+ private readonly [symbol$7_2];
3308
3651
  readonly text: string;
3309
3652
  constructor({ text, cause }: {
3310
3653
  text: string;
@@ -3313,6 +3656,16 @@ export declare class JSONParseError extends AISDKError {
3313
3656
  static isInstance(error: unknown): error is JSONParseError;
3314
3657
  }
3315
3658
 
3659
+ declare class JSONParseError_2 extends AISDKError_2 {
3660
+ private readonly [symbol$7];
3661
+ readonly text: string;
3662
+ constructor({ text, cause }: {
3663
+ text: string;
3664
+ cause: unknown;
3665
+ });
3666
+ static isInstance(error: unknown): error is JSONParseError_2;
3667
+ }
3668
+
3316
3669
  /**
3317
3670
  * Create a schema using a JSON Schema.
3318
3671
  *
@@ -3486,7 +3839,7 @@ export declare class JsonToSseTransformStream extends TransformStream<unknown, s
3486
3839
  constructor();
3487
3840
  }
3488
3841
 
3489
- export declare type JSONValue = JSONValue_2;
3842
+ export declare type JSONValue = JSONValue_3;
3490
3843
 
3491
3844
  /**
3492
3845
  A JSON value can be a string, number, boolean, object, array, or null.
@@ -3494,10 +3847,16 @@ export declare type JSONValue = JSONValue_2;
3494
3847
  */
3495
3848
  declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
3496
3849
 
3850
+ /**
3851
+ A JSON value can be a string, number, boolean, object, array, or null.
3852
+ JSON values can be serialized and deserialized by the JSON.stringify and JSON.parse methods.
3853
+ */
3854
+ declare type JSONValue_3 = null | string | number | boolean | JSONObject_2 | JSONArray_2;
3855
+
3497
3856
  /**
3498
3857
  Language model that is used by the AI SDK Core functions.
3499
3858
  */
3500
- export declare type LanguageModel = GlobalProviderModelId | LanguageModelV2;
3859
+ export declare type LanguageModel = GlobalProviderModelId | LanguageModelV2_2;
3501
3860
 
3502
3861
  export declare type LanguageModelMiddleware = LanguageModelV2Middleware;
3503
3862
 
@@ -3530,7 +3889,7 @@ export declare type LanguageModelResponseMetadata = {
3530
3889
  /**
3531
3890
  Represents the number of tokens used in a prompt and completion.
3532
3891
  */
3533
- export declare type LanguageModelUsage = LanguageModelV2Usage;
3892
+ export declare type LanguageModelUsage = LanguageModelV2Usage_2;
3534
3893
 
3535
3894
  /**
3536
3895
  Specification for a language model that implements the language model interface version 2.
@@ -3644,6 +4003,118 @@ declare type LanguageModelV2 = {
3644
4003
  }>;
3645
4004
  };
3646
4005
 
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
+
3647
4118
  declare type LanguageModelV2CallOptions = {
3648
4119
  /**
3649
4120
  A language mode prompt is a standardized prompt type.
@@ -3745,65 +4216,214 @@ declare type LanguageModelV2CallOptions = {
3745
4216
  providerOptions?: SharedV2ProviderOptions;
3746
4217
  };
3747
4218
 
3748
- /**
3749
- Warning from the model provider for this call. The call will proceed, but e.g.
3750
- some settings might not be supported, which can lead to suboptimal results.
3751
- */
3752
- declare type LanguageModelV2CallWarning = {
3753
- type: 'unsupported-setting';
3754
- setting: Omit<keyof LanguageModelV2CallOptions, 'prompt'>;
3755
- details?: string;
3756
- } | {
3757
- type: 'unsupported-tool';
3758
- tool: LanguageModelV2FunctionTool | LanguageModelV2ProviderDefinedTool;
3759
- details?: string;
3760
- } | {
3761
- type: 'other';
3762
- message: string;
3763
- };
3764
-
3765
- declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reasoning | LanguageModelV2File | LanguageModelV2Source | LanguageModelV2ToolCall | LanguageModelV2ToolResult;
3766
-
3767
- /**
3768
- Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
3769
- */
3770
- declare type LanguageModelV2DataContent = Uint8Array | string | URL;
3771
-
3772
- /**
3773
- A file that has been generated by the model.
3774
- Generated files as base64 encoded strings or binary data.
3775
- The files should be returned without any unnecessary conversion.
3776
- */
3777
- declare type LanguageModelV2File = {
3778
- type: 'file';
4219
+ declare type LanguageModelV2CallOptions_2 = {
3779
4220
  /**
3780
- The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
4221
+ A language mode prompt is a standardized prompt type.
3781
4222
 
3782
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
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.
3783
4227
  */
3784
- mediaType: string;
4228
+ prompt: LanguageModelV2Prompt_2;
3785
4229
  /**
3786
- Generated file data as base64 encoded strings or binary data.
3787
-
3788
- The file data should be returned without any unnecessary conversion.
3789
- If the API returns base64 encoded strings, the file data should be returned
3790
- as base64 encoded strings. If the API returns binary data, the file data should
3791
- be returned as binary data.
4230
+ Maximum number of tokens to generate.
3792
4231
  */
3793
- data: string | Uint8Array;
3794
- };
3795
-
3796
- /**
3797
- File content part of a prompt. It contains a file.
3798
- */
3799
- declare interface LanguageModelV2FilePart {
3800
- type: 'file';
4232
+ maxOutputTokens?: number;
3801
4233
  /**
3802
- * Optional filename of the file.
4234
+ Temperature setting. The range depends on the provider and model.
3803
4235
  */
3804
- filename?: string;
4236
+ temperature?: number;
3805
4237
  /**
3806
- File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
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
+ /**
4321
+ Warning from the model provider for this call. The call will proceed, but e.g.
4322
+ some settings might not be supported, which can lead to suboptimal results.
4323
+ */
4324
+ declare type LanguageModelV2CallWarning = {
4325
+ type: 'unsupported-setting';
4326
+ setting: Omit<keyof LanguageModelV2CallOptions, 'prompt'>;
4327
+ details?: string;
4328
+ } | {
4329
+ type: 'unsupported-tool';
4330
+ tool: LanguageModelV2FunctionTool | LanguageModelV2ProviderDefinedTool;
4331
+ details?: string;
4332
+ } | {
4333
+ type: 'other';
4334
+ message: string;
4335
+ };
4336
+
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
+ declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reasoning | LanguageModelV2File | LanguageModelV2Source | LanguageModelV2ToolCall | LanguageModelV2ToolResult;
4355
+
4356
+ declare type LanguageModelV2Content_2 = LanguageModelV2Text_2 | LanguageModelV2Reasoning_2 | LanguageModelV2File_2 | LanguageModelV2Source_2 | LanguageModelV2ToolCall_2 | LanguageModelV2ToolResult_2;
4357
+
4358
+ /**
4359
+ Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
4360
+ */
4361
+ declare type LanguageModelV2DataContent = Uint8Array | string | URL;
4362
+
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
+ /**
4369
+ A file that has been generated by the model.
4370
+ Generated files as base64 encoded strings or binary data.
4371
+ The files should be returned without any unnecessary conversion.
4372
+ */
4373
+ declare type LanguageModelV2File = {
4374
+ type: 'file';
4375
+ /**
4376
+ The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
4377
+
4378
+ @see https://www.iana.org/assignments/media-types/media-types.xhtml
4379
+ */
4380
+ mediaType: string;
4381
+ /**
4382
+ Generated file data as base64 encoded strings or binary data.
4383
+
4384
+ The file data should be returned without any unnecessary conversion.
4385
+ If the API returns base64 encoded strings, the file data should be returned
4386
+ as base64 encoded strings. If the API returns binary data, the file data should
4387
+ be returned as binary data.
4388
+ */
4389
+ data: string | Uint8Array;
4390
+ };
4391
+
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
+ /**
4417
+ File content part of a prompt. It contains a file.
4418
+ */
4419
+ declare interface LanguageModelV2FilePart {
4420
+ type: 'file';
4421
+ /**
4422
+ * Optional filename of the file.
4423
+ */
4424
+ filename?: string;
4425
+ /**
4426
+ File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
3807
4427
  */
3808
4428
  data: LanguageModelV2DataContent;
3809
4429
  /**
@@ -3822,6 +4442,35 @@ declare interface LanguageModelV2FilePart {
3822
4442
  providerOptions?: SharedV2ProviderOptions;
3823
4443
  }
3824
4444
 
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
+
3825
4474
  /**
3826
4475
  Reason why a language model finished generating a response.
3827
4476
 
@@ -3836,6 +4485,20 @@ declare interface LanguageModelV2FilePart {
3836
4485
  */
3837
4486
  declare type LanguageModelV2FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
3838
4487
 
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
+
3839
4502
  /**
3840
4503
  A tool has a name, a description, and a set of parameters.
3841
4504
 
@@ -3867,6 +4530,37 @@ declare type LanguageModelV2FunctionTool = {
3867
4530
  providerOptions?: SharedV2ProviderOptions;
3868
4531
  };
3869
4532
 
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
+
3870
4564
  declare type LanguageModelV2Message = ({
3871
4565
  role: 'system';
3872
4566
  content: string;
@@ -3888,6 +4582,27 @@ declare type LanguageModelV2Message = ({
3888
4582
  providerOptions?: SharedV2ProviderOptions;
3889
4583
  };
3890
4584
 
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
+
3891
4606
  /**
3892
4607
  * Experimental middleware for LanguageModelV2.
3893
4608
  * This type defines the structure for middleware that can be used to modify
@@ -3903,21 +4618,21 @@ declare type LanguageModelV2Middleware = {
3903
4618
  * @param options.model - The language model instance.
3904
4619
  */
3905
4620
  overrideProvider?: (options: {
3906
- model: LanguageModelV2;
4621
+ model: LanguageModelV2_2;
3907
4622
  }) => string;
3908
4623
  /**
3909
4624
  * Override the model ID if desired.
3910
4625
  * @param options.model - The language model instance.
3911
4626
  */
3912
4627
  overrideModelId?: (options: {
3913
- model: LanguageModelV2;
4628
+ model: LanguageModelV2_2;
3914
4629
  }) => string;
3915
4630
  /**
3916
4631
  * Override the supported URLs if desired.
3917
4632
  * @param options.model - The language model instance.
3918
4633
  */
3919
4634
  overrideSupportedUrls?: (options: {
3920
- model: LanguageModelV2;
4635
+ model: LanguageModelV2_2;
3921
4636
  }) => PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>;
3922
4637
  /**
3923
4638
  * Transforms the parameters before they are passed to the language model.
@@ -3928,9 +4643,9 @@ declare type LanguageModelV2Middleware = {
3928
4643
  */
3929
4644
  transformParams?: (options: {
3930
4645
  type: 'generate' | 'stream';
3931
- params: LanguageModelV2CallOptions;
3932
- model: LanguageModelV2;
3933
- }) => PromiseLike<LanguageModelV2CallOptions>;
4646
+ params: LanguageModelV2CallOptions_2;
4647
+ model: LanguageModelV2_2;
4648
+ }) => PromiseLike<LanguageModelV2CallOptions_2>;
3934
4649
  /**
3935
4650
  * Wraps the generate operation of the language model.
3936
4651
  * @param options - Object containing the generate function, parameters, and model.
@@ -3942,11 +4657,11 @@ declare type LanguageModelV2Middleware = {
3942
4657
  * @returns A promise that resolves to the result of the generate operation.
3943
4658
  */
3944
4659
  wrapGenerate?: (options: {
3945
- doGenerate: () => ReturnType<LanguageModelV2['doGenerate']>;
3946
- doStream: () => ReturnType<LanguageModelV2['doStream']>;
3947
- params: LanguageModelV2CallOptions;
3948
- model: LanguageModelV2;
3949
- }) => Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
4660
+ doGenerate: () => ReturnType<LanguageModelV2_2['doGenerate']>;
4661
+ doStream: () => ReturnType<LanguageModelV2_2['doStream']>;
4662
+ params: LanguageModelV2CallOptions_2;
4663
+ model: LanguageModelV2_2;
4664
+ }) => Promise<Awaited<ReturnType<LanguageModelV2_2['doGenerate']>>>;
3950
4665
  /**
3951
4666
  * Wraps the stream operation of the language model.
3952
4667
  *
@@ -3959,11 +4674,11 @@ declare type LanguageModelV2Middleware = {
3959
4674
  * @returns A promise that resolves to the result of the stream operation.
3960
4675
  */
3961
4676
  wrapStream?: (options: {
3962
- doGenerate: () => ReturnType<LanguageModelV2['doGenerate']>;
3963
- doStream: () => ReturnType<LanguageModelV2['doStream']>;
3964
- params: LanguageModelV2CallOptions;
3965
- model: LanguageModelV2;
3966
- }) => PromiseLike<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
4677
+ doGenerate: () => ReturnType<LanguageModelV2_2['doGenerate']>;
4678
+ doStream: () => ReturnType<LanguageModelV2_2['doStream']>;
4679
+ params: LanguageModelV2CallOptions_2;
4680
+ model: LanguageModelV2_2;
4681
+ }) => PromiseLike<Awaited<ReturnType<LanguageModelV2_2['doStream']>>>;
3967
4682
  };
3968
4683
 
3969
4684
  /**
@@ -3977,6 +4692,17 @@ declare type LanguageModelV2Middleware = {
3977
4692
  */
3978
4693
  declare type LanguageModelV2Prompt = Array<LanguageModelV2Message>;
3979
4694
 
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
+
3980
4706
  /**
3981
4707
  The configuration of a tool that is defined by the provider.
3982
4708
  */
@@ -3999,6 +4725,28 @@ declare type LanguageModelV2ProviderDefinedTool = {
3999
4725
  args: Record<string, unknown>;
4000
4726
  };
4001
4727
 
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
+
4002
4750
  /**
4003
4751
  Reasoning that the model has generated.
4004
4752
  */
@@ -4011,6 +4759,18 @@ declare type LanguageModelV2Reasoning = {
4011
4759
  providerMetadata?: SharedV2ProviderMetadata;
4012
4760
  };
4013
4761
 
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
+
4014
4774
  /**
4015
4775
  Reasoning content part of a prompt. It contains a string of reasoning text.
4016
4776
  */
@@ -4028,6 +4788,23 @@ declare interface LanguageModelV2ReasoningPart {
4028
4788
  providerOptions?: SharedV2ProviderOptions;
4029
4789
  }
4030
4790
 
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
+
4031
4808
  declare interface LanguageModelV2ResponseMetadata {
4032
4809
  /**
4033
4810
  ID for the generated response, if the provider sends one.
@@ -4043,6 +4820,21 @@ declare interface LanguageModelV2ResponseMetadata {
4043
4820
  modelId?: string;
4044
4821
  }
4045
4822
 
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
+
4046
4838
  /**
4047
4839
  A source that has been used as input to generate the response.
4048
4840
  */
@@ -4096,6 +4888,59 @@ declare type LanguageModelV2Source = {
4096
4888
  providerMetadata?: SharedV2ProviderMetadata;
4097
4889
  };
4098
4890
 
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
+
4099
4944
  declare type LanguageModelV2StreamPart = {
4100
4945
  type: 'text-start';
4101
4946
  providerMetadata?: SharedV2ProviderMetadata;
@@ -4155,6 +5000,65 @@ declare type LanguageModelV2StreamPart = {
4155
5000
  error: unknown;
4156
5001
  };
4157
5002
 
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
+
4158
5062
  /**
4159
5063
  Text that the model has generated.
4160
5064
  */
@@ -4167,6 +5071,18 @@ declare type LanguageModelV2Text = {
4167
5071
  providerMetadata?: SharedV2ProviderMetadata;
4168
5072
  };
4169
5073
 
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
+
4170
5086
  /**
4171
5087
  Text content part of a prompt. It contains a string of text.
4172
5088
  */
@@ -4177,17 +5093,63 @@ declare interface LanguageModelV2TextPart {
4177
5093
  */
4178
5094
  text: string;
4179
5095
  /**
4180
- * Additional provider-specific options. They are passed through
4181
- * to the provider from the AI SDK and enable provider-specific
4182
- * functionality that can be fully encapsulated in the provider.
5096
+ * Additional provider-specific options. They are passed through
5097
+ * to the provider from the AI SDK and enable provider-specific
5098
+ * functionality that can be fully encapsulated in the provider.
5099
+ */
5100
+ providerOptions?: SharedV2ProviderOptions;
5101
+ }
5102
+
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
+ /**
5121
+ * Tool calls that the model has generated.
5122
+ */
5123
+ declare type LanguageModelV2ToolCall = {
5124
+ type: 'tool-call';
5125
+ /**
5126
+ * The identifier of the tool call. It must be unique across all tool calls.
5127
+ */
5128
+ toolCallId: string;
5129
+ /**
5130
+ * The name of the tool that should be called.
5131
+ */
5132
+ toolName: string;
5133
+ /**
5134
+ * Stringified JSON object with the tool call arguments. Must match the
5135
+ * parameters schema of the tool.
5136
+ */
5137
+ input: string;
5138
+ /**
5139
+ * Whether the tool call will be executed by the provider.
5140
+ * If this flag is not set or is false, the tool call will be executed by the client.
5141
+ */
5142
+ providerExecuted?: boolean;
5143
+ /**
5144
+ * Additional provider-specific metadata for the tool call.
4183
5145
  */
4184
- providerOptions?: SharedV2ProviderOptions;
4185
- }
5146
+ providerMetadata?: SharedV2ProviderMetadata;
5147
+ };
4186
5148
 
4187
5149
  /**
4188
5150
  Tool calls that the model has generated.
4189
5151
  */
4190
- declare type LanguageModelV2ToolCall = {
5152
+ declare type LanguageModelV2ToolCall_2 = {
4191
5153
  type: 'tool-call';
4192
5154
  toolCallId: string;
4193
5155
  toolName: string;
@@ -4204,7 +5166,7 @@ declare type LanguageModelV2ToolCall = {
4204
5166
  /**
4205
5167
  * Additional provider-specific metadata for the tool call.
4206
5168
  */
4207
- providerMetadata?: SharedV2ProviderMetadata;
5169
+ providerMetadata?: SharedV2ProviderMetadata_2;
4208
5170
  };
4209
5171
 
4210
5172
  /**
@@ -4237,6 +5199,36 @@ declare interface LanguageModelV2ToolCallPart {
4237
5199
  providerOptions?: SharedV2ProviderOptions;
4238
5200
  }
4239
5201
 
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
+
4240
5232
  declare type LanguageModelV2ToolChoice = {
4241
5233
  type: 'auto';
4242
5234
  } | {
@@ -4248,6 +5240,17 @@ declare type LanguageModelV2ToolChoice = {
4248
5240
  toolName: string;
4249
5241
  };
4250
5242
 
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
+
4251
5254
  /**
4252
5255
  Result of a tool call that has been executed by the provider.
4253
5256
  */
@@ -4281,6 +5284,39 @@ declare type LanguageModelV2ToolResult = {
4281
5284
  providerMetadata?: SharedV2ProviderMetadata;
4282
5285
  };
4283
5286
 
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
+
4284
5320
  declare type LanguageModelV2ToolResultOutput = {
4285
5321
  type: 'text';
4286
5322
  value: string;
@@ -4315,6 +5351,40 @@ declare type LanguageModelV2ToolResultOutput = {
4315
5351
  }>;
4316
5352
  };
4317
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
+
4318
5388
  /**
4319
5389
  Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
4320
5390
  */
@@ -4340,6 +5410,31 @@ declare interface LanguageModelV2ToolResultPart {
4340
5410
  providerOptions?: SharedV2ProviderOptions;
4341
5411
  }
4342
5412
 
5413
+ /**
5414
+ Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
5415
+ */
5416
+ declare interface LanguageModelV2ToolResultPart_2 {
5417
+ type: 'tool-result';
5418
+ /**
5419
+ ID of the tool call that this result is associated with.
5420
+ */
5421
+ toolCallId: string;
5422
+ /**
5423
+ Name of the tool that generated this result.
5424
+ */
5425
+ toolName: string;
5426
+ /**
5427
+ Result of the tool call.
5428
+ */
5429
+ output: LanguageModelV2ToolResultOutput_2;
5430
+ /**
5431
+ * Additional provider-specific options. They are passed through
5432
+ * to the provider from the AI SDK and enable provider-specific
5433
+ * functionality that can be fully encapsulated in the provider.
5434
+ */
5435
+ providerOptions?: SharedV2ProviderOptions_2;
5436
+ }
5437
+
4343
5438
  /**
4344
5439
  Usage information for a language model call.
4345
5440
 
@@ -4371,6 +5466,37 @@ declare type LanguageModelV2Usage = {
4371
5466
  cachedInputTokens?: number | undefined;
4372
5467
  };
4373
5468
 
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
+
4374
5500
  /**
4375
5501
  Check if the message is an assistant message with completed tool calls.
4376
5502
  The last step of the message must have at least one tool invocation and
@@ -4597,7 +5723,7 @@ export declare class NoOutputGeneratedError extends AISDKError {
4597
5723
  Thrown when no output type is specified and output-related methods are called.
4598
5724
  */
4599
5725
  export declare class NoOutputSpecifiedError extends AISDKError {
4600
- private readonly [symbol$7_2];
5726
+ private readonly [symbol$7_3];
4601
5727
  constructor({ message }?: {
4602
5728
  message?: string;
4603
5729
  });
@@ -4650,52 +5776,202 @@ export declare class NoSuchProviderError extends NoSuchModelError {
4650
5776
  static isInstance(error: unknown): error is NoSuchProviderError;
4651
5777
  }
4652
5778
 
4653
- export declare class NoSuchToolError extends AISDKError {
4654
- private readonly [symbol$d_2];
4655
- readonly toolName: string;
4656
- readonly availableTools: string[] | undefined;
4657
- constructor({ toolName, availableTools, message, }: {
4658
- toolName: string;
4659
- availableTools?: string[] | undefined;
4660
- message?: string;
4661
- });
4662
- static isInstance(error: unknown): error is NoSuchToolError;
5779
+ export declare class NoSuchToolError extends AISDKError {
5780
+ private readonly [symbol$d_3];
5781
+ readonly toolName: string;
5782
+ readonly availableTools: string[] | undefined;
5783
+ constructor({ toolName, availableTools, message, }: {
5784
+ toolName: string;
5785
+ availableTools?: string[] | undefined;
5786
+ message?: string;
5787
+ });
5788
+ static isInstance(error: unknown): error is NoSuchToolError;
5789
+ }
5790
+
5791
+ export declare type ObjectStreamPart<PARTIAL> = {
5792
+ type: 'object';
5793
+ object: PARTIAL;
5794
+ } | {
5795
+ type: 'text-delta';
5796
+ textDelta: string;
5797
+ } | {
5798
+ type: 'error';
5799
+ error: unknown;
5800
+ } | {
5801
+ type: 'finish';
5802
+ finishReason: FinishReason;
5803
+ usage: LanguageModelUsage;
5804
+ response: LanguageModelResponseMetadata;
5805
+ providerMetadata?: ProviderMetadata;
5806
+ };
5807
+
5808
+ export declare namespace Output {
5809
+ export {
5810
+ output_Output as Output,
5811
+ output_object as object,
5812
+ output_text as text,
5813
+ };
5814
+ }
5815
+
5816
+ declare interface Output_2<OUTPUT, PARTIAL> {
5817
+ readonly type: 'object' | 'text';
5818
+ responseFormat: LanguageModelV2CallOptions_2['responseFormat'];
5819
+ parsePartial(options: {
5820
+ text: string;
5821
+ }): Promise<{
5822
+ partial: PARTIAL;
5823
+ } | undefined>;
5824
+ parseOutput(options: {
5825
+ text: string;
5826
+ }, context: {
5827
+ response: LanguageModelResponseMetadata;
5828
+ usage: LanguageModelUsage;
5829
+ finishReason: FinishReason;
5830
+ }): Promise<OUTPUT>;
5831
+ }
5832
+
5833
+ declare interface ParallelSearchConfig {
5834
+ /**
5835
+ * Mode preset for different use cases:
5836
+ * - "one-shot": Comprehensive results with longer excerpts for single-response answers (default)
5837
+ * - "agentic": Concise, token-efficient results for multi-step agentic workflows
5838
+ */
5839
+ mode?: 'one-shot' | 'agentic';
5840
+ /**
5841
+ * Default maximum number of results to return (1-20).
5842
+ * Defaults to 10 if not specified.
5843
+ */
5844
+ maxResults?: number;
5845
+ /**
5846
+ * Default source policy for controlling which domains to include/exclude.
5847
+ */
5848
+ sourcePolicy?: ParallelSearchSourcePolicy;
5849
+ /**
5850
+ * Default excerpt configuration for controlling result length.
5851
+ */
5852
+ excerpts?: ParallelSearchExcerpts;
5853
+ /**
5854
+ * Default fetch policy for controlling content freshness.
5855
+ */
5856
+ fetchPolicy?: ParallelSearchFetchPolicy;
5857
+ }
5858
+
5859
+ declare interface ParallelSearchError {
5860
+ /** Error type */
5861
+ error: 'api_error' | 'rate_limit' | 'timeout' | 'invalid_input' | 'configuration_error' | 'unknown';
5862
+ /** HTTP status code if applicable */
5863
+ statusCode?: number;
5864
+ /** Human-readable error message */
5865
+ message: string;
5866
+ }
5867
+
5868
+ declare interface ParallelSearchExcerpts {
5869
+ /**
5870
+ * Maximum characters per result.
5871
+ */
5872
+ maxCharsPerResult?: number;
5873
+ /**
5874
+ * Maximum total characters across all results.
5875
+ */
5876
+ maxCharsTotal?: number;
5877
+ }
5878
+
5879
+ declare interface ParallelSearchFetchPolicy {
5880
+ /**
5881
+ * Maximum age in seconds for cached content.
5882
+ * Set to 0 to always fetch fresh content.
5883
+ */
5884
+ maxAgeSeconds?: number;
5885
+ }
5886
+
5887
+ declare interface ParallelSearchInput {
5888
+ /**
5889
+ * Natural-language description of the web research goal.
5890
+ * Include source or freshness guidance and broader context from the task.
5891
+ * Maximum 5000 characters.
5892
+ */
5893
+ objective: string;
5894
+ /**
5895
+ * Optional search queries to supplement the objective.
5896
+ * Maximum 200 characters per query.
5897
+ */
5898
+ search_queries?: string[];
5899
+ /**
5900
+ * Mode preset for different use cases:
5901
+ * - "one-shot": Comprehensive results with longer excerpts
5902
+ * - "agentic": Concise, token-efficient results for multi-step workflows
5903
+ */
5904
+ mode?: 'one-shot' | 'agentic';
5905
+ /**
5906
+ * Maximum number of results to return (1-20).
5907
+ * Defaults to 10 if not specified.
5908
+ */
5909
+ max_results?: number;
5910
+ /**
5911
+ * Source policy for controlling which domains to include/exclude.
5912
+ */
5913
+ source_policy?: {
5914
+ include_domains?: string[];
5915
+ exclude_domains?: string[];
5916
+ after_date?: string;
5917
+ };
5918
+ /**
5919
+ * Excerpt configuration for controlling result length.
5920
+ */
5921
+ excerpts?: {
5922
+ max_chars_per_result?: number;
5923
+ max_chars_total?: number;
5924
+ };
5925
+ /**
5926
+ * Fetch policy for controlling content freshness.
5927
+ */
5928
+ fetch_policy?: {
5929
+ max_age_seconds?: number;
5930
+ };
5931
+ }
5932
+
5933
+ declare type ParallelSearchOutput = ParallelSearchResponse | ParallelSearchError;
5934
+
5935
+ declare interface ParallelSearchResponse {
5936
+ /** Unique identifier for this search request */
5937
+ searchId: string;
5938
+ /** Array of search results */
5939
+ results: ParallelSearchResult[];
4663
5940
  }
4664
5941
 
4665
- export declare type ObjectStreamPart<PARTIAL> = {
4666
- type: 'object';
4667
- object: PARTIAL;
4668
- } | {
4669
- type: 'text-delta';
4670
- textDelta: string;
4671
- } | {
4672
- type: 'error';
4673
- error: unknown;
4674
- } | {
4675
- type: 'finish';
4676
- finishReason: FinishReason;
4677
- usage: LanguageModelUsage;
4678
- response: LanguageModelResponseMetadata;
4679
- providerMetadata?: ProviderMetadata;
4680
- };
4681
-
4682
- declare interface Output_2<OUTPUT, PARTIAL> {
4683
- readonly type: 'object' | 'text';
4684
- responseFormat: LanguageModelV2CallOptions['responseFormat'];
4685
- parsePartial(options: {
4686
- text: string;
4687
- }): Promise<{
4688
- partial: PARTIAL;
4689
- } | undefined>;
4690
- parseOutput(options: {
4691
- text: string;
4692
- }, context: {
4693
- response: LanguageModelResponseMetadata;
4694
- usage: LanguageModelUsage;
4695
- finishReason: FinishReason;
4696
- }): Promise<OUTPUT>;
5942
+ declare interface ParallelSearchResult {
5943
+ /** URL of the search result */
5944
+ url: string;
5945
+ /** Title of the search result */
5946
+ title: string;
5947
+ /** Extracted text excerpt/content from the page */
5948
+ excerpt: string;
5949
+ /** Publication date of the content (may be null) */
5950
+ publishDate?: string | null;
5951
+ /** Relevance score for the result */
5952
+ relevanceScore?: number;
5953
+ }
5954
+
5955
+ declare interface ParallelSearchSourcePolicy {
5956
+ /**
5957
+ * List of domains to include in search results.
5958
+ * Example: ['wikipedia.org', 'nature.com']
5959
+ */
5960
+ includeDomains?: string[];
5961
+ /**
5962
+ * List of domains to exclude from search results.
5963
+ * Example: ['reddit.com', 'twitter.com']
5964
+ */
5965
+ excludeDomains?: string[];
5966
+ /**
5967
+ * Only include results published after this date (ISO 8601 format).
5968
+ * Example: '2024-01-01'
5969
+ */
5970
+ afterDate?: string;
4697
5971
  }
4698
5972
 
5973
+ declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<ParallelSearchInput, ParallelSearchOutput, ParallelSearchConfig>;
5974
+
4699
5975
  /**
4700
5976
  * Parses a JSON string into an unknown object.
4701
5977
  *
@@ -4729,7 +6005,7 @@ export declare function parseJsonEventStream<T>({ stream, schema, }: {
4729
6005
  }): ReadableStream<ParseResult<T>>;
4730
6006
 
4731
6007
  export declare function parsePartialJson(jsonText: string | undefined): Promise<{
4732
- value: JSONValue_2 | undefined;
6008
+ value: JSONValue_3 | undefined;
4733
6009
  state: 'undefined-input' | 'successful-parse' | 'repaired-parse' | 'failed-parse';
4734
6010
  }>;
4735
6011
 
@@ -4745,7 +6021,7 @@ declare type ParseResult<T> = {
4745
6021
  rawValue: unknown;
4746
6022
  } | {
4747
6023
  success: false;
4748
- error: JSONParseError | TypeValidationError;
6024
+ error: JSONParseError_2 | TypeValidationError_2;
4749
6025
  rawValue: unknown;
4750
6026
  };
4751
6027
 
@@ -4761,6 +6037,140 @@ declare type PartialReadonlySet<T> = {} & ReadonlySet<DeepPartialInternal<T>>;
4761
6037
 
4762
6038
  declare type PartialSet<T> = {} & Set<DeepPartialInternal<T>>;
4763
6039
 
6040
+ declare interface PerplexitySearchConfig {
6041
+ /**
6042
+ * Default maximum number of search results to return (1-20, default: 10).
6043
+ */
6044
+ maxResults?: number;
6045
+ /**
6046
+ * Default maximum tokens to extract per search result page (256-2048, default: 2048).
6047
+ */
6048
+ maxTokensPerPage?: number;
6049
+ /**
6050
+ * Default maximum total tokens across all search results (default: 25000, max: 1000000).
6051
+ */
6052
+ maxTokens?: number;
6053
+ /**
6054
+ * Default two-letter ISO 3166-1 alpha-2 country code for regional search results.
6055
+ * Examples: 'US', 'GB', 'FR'
6056
+ */
6057
+ country?: string;
6058
+ /**
6059
+ * Default list of domains to include or exclude from search results (max 20).
6060
+ * To include: ['nature.com', 'science.org']
6061
+ * To exclude: ['-example.com', '-spam.net']
6062
+ */
6063
+ searchDomainFilter?: string[];
6064
+ /**
6065
+ * Default list of ISO 639-1 language codes to filter results (max 10, lowercase).
6066
+ * Examples: ['en', 'fr', 'de']
6067
+ */
6068
+ searchLanguageFilter?: string[];
6069
+ /**
6070
+ * Default recency filter for results.
6071
+ * Cannot be combined with searchAfterDate/searchBeforeDate at runtime.
6072
+ */
6073
+ searchRecencyFilter?: 'day' | 'week' | 'month' | 'year';
6074
+ }
6075
+
6076
+ declare interface PerplexitySearchError {
6077
+ /** Error type */
6078
+ error: 'api_error' | 'rate_limit' | 'timeout' | 'invalid_input' | 'unknown';
6079
+ /** HTTP status code if applicable */
6080
+ statusCode?: number;
6081
+ /** Human-readable error message */
6082
+ message: string;
6083
+ }
6084
+
6085
+ declare interface PerplexitySearchInput {
6086
+ /**
6087
+ * Search query (string) or multiple queries (array of up to 5 strings).
6088
+ * Multi-query searches return combined results from all queries.
6089
+ */
6090
+ query: string | string[];
6091
+ /**
6092
+ * Maximum number of search results to return (1-20, default: 10).
6093
+ */
6094
+ max_results?: number;
6095
+ /**
6096
+ * Maximum number of tokens to extract per search result page (256-2048, default: 2048).
6097
+ */
6098
+ max_tokens_per_page?: number;
6099
+ /**
6100
+ * Maximum total tokens across all search results (default: 25000, max: 1000000).
6101
+ */
6102
+ max_tokens?: number;
6103
+ /**
6104
+ * Two-letter ISO 3166-1 alpha-2 country code for regional search results.
6105
+ * Examples: 'US', 'GB', 'FR'
6106
+ */
6107
+ country?: string;
6108
+ /**
6109
+ * List of domains to include or exclude from search results (max 20).
6110
+ * To include: ['nature.com', 'science.org']
6111
+ * To exclude: ['-example.com', '-spam.net']
6112
+ */
6113
+ search_domain_filter?: string[];
6114
+ /**
6115
+ * List of ISO 639-1 language codes to filter results (max 10, lowercase).
6116
+ * Examples: ['en', 'fr', 'de']
6117
+ */
6118
+ search_language_filter?: string[];
6119
+ /**
6120
+ * Include only results published after this date.
6121
+ * Format: 'MM/DD/YYYY' (e.g., '3/1/2025')
6122
+ * Cannot be used with search_recency_filter.
6123
+ */
6124
+ search_after_date?: string;
6125
+ /**
6126
+ * Include only results published before this date.
6127
+ * Format: 'MM/DD/YYYY' (e.g., '3/15/2025')
6128
+ * Cannot be used with search_recency_filter.
6129
+ */
6130
+ search_before_date?: string;
6131
+ /**
6132
+ * Include only results last updated after this date.
6133
+ * Format: 'MM/DD/YYYY' (e.g., '3/1/2025')
6134
+ * Cannot be used with search_recency_filter.
6135
+ */
6136
+ last_updated_after_filter?: string;
6137
+ /**
6138
+ * Include only results last updated before this date.
6139
+ * Format: 'MM/DD/YYYY' (e.g., '3/15/2025')
6140
+ * Cannot be used with search_recency_filter.
6141
+ */
6142
+ last_updated_before_filter?: string;
6143
+ /**
6144
+ * Filter results by relative time period.
6145
+ * Cannot be used with search_after_date or search_before_date.
6146
+ */
6147
+ search_recency_filter?: 'day' | 'week' | 'month' | 'year';
6148
+ }
6149
+
6150
+ declare type PerplexitySearchOutput = PerplexitySearchResponse | PerplexitySearchError;
6151
+
6152
+ declare interface PerplexitySearchResponse {
6153
+ /** Array of search results */
6154
+ results: PerplexitySearchResult[];
6155
+ /** Unique identifier for this search request */
6156
+ id: string;
6157
+ }
6158
+
6159
+ declare interface PerplexitySearchResult {
6160
+ /** Title of the search result */
6161
+ title: string;
6162
+ /** URL of the search result */
6163
+ url: string;
6164
+ /** Text snippet/preview of the content */
6165
+ snippet: string;
6166
+ /** Publication date of the content */
6167
+ date?: string;
6168
+ /** Last updated date of the content */
6169
+ lastUpdated?: string;
6170
+ }
6171
+
6172
+ declare const perplexitySearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<PerplexitySearchInput, PerplexitySearchOutput, PerplexitySearchConfig>;
6173
+
4764
6174
  export declare function pipeTextStreamToResponse({ response, status, statusText, headers, textStream, }: {
4765
6175
  response: ServerResponse;
4766
6176
  textStream: ReadableStream<string>;
@@ -4775,7 +6185,7 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
4775
6185
  url: string;
4776
6186
  headers?: Record<string, string | undefined>;
4777
6187
  formData: FormData;
4778
- failedResponseHandler: ResponseHandler<APICallError>;
6188
+ failedResponseHandler: ResponseHandler<APICallError_2>;
4779
6189
  successfulResponseHandler: ResponseHandler<T>;
4780
6190
  abortSignal?: AbortSignal;
4781
6191
  fetch?: FetchFunction;
@@ -4789,7 +6199,7 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
4789
6199
  url: string;
4790
6200
  headers?: Record<string, string | undefined>;
4791
6201
  body: unknown;
4792
- failedResponseHandler: ResponseHandler<APICallError>;
6202
+ failedResponseHandler: ResponseHandler<APICallError_2>;
4793
6203
  successfulResponseHandler: ResponseHandler<T>;
4794
6204
  abortSignal?: AbortSignal;
4795
6205
  fetch?: FetchFunction;
@@ -4978,7 +6388,7 @@ declare type ProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS exte
4978
6388
  This is needed to enable provider-specific functionality that can be
4979
6389
  fully encapsulated in the provider.
4980
6390
  */
4981
- export declare type ProviderMetadata = SharedV2ProviderMetadata;
6391
+ export declare type ProviderMetadata = SharedV2ProviderMetadata_2;
4982
6392
 
4983
6393
  /**
4984
6394
  Additional provider-specific options.
@@ -4988,17 +6398,17 @@ export declare type ProviderMetadata = SharedV2ProviderMetadata;
4988
6398
  */
4989
6399
  declare type ProviderOptions = SharedV2ProviderOptions;
4990
6400
 
4991
- export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV2> = Record<string, ProviderV2>, SEPARATOR extends string = ':'> {
4992
- languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV2;
4993
- languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): LanguageModelV2;
4994
- textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['textEmbeddingModel']>>[0]>}` : never): EmbeddingModelV2<string>;
4995
- textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): EmbeddingModelV2<string>;
4996
- imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['imageModel']>>[0]>}` : never): ImageModelV2;
4997
- imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): ImageModelV2;
4998
- transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['transcriptionModel']>>[0]>}` : never): TranscriptionModelV2;
4999
- transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): TranscriptionModelV2;
5000
- speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['speechModel']>>[0]>}` : never): SpeechModelV2;
5001
- speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): SpeechModelV2;
6401
+ export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV2_2> = Record<string, ProviderV2_2>, SEPARATOR extends string = ':'> {
6402
+ languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV2_2;
6403
+ languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): LanguageModelV2_2;
6404
+ textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['textEmbeddingModel']>>[0]>}` : never): EmbeddingModelV2_2<string>;
6405
+ textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): EmbeddingModelV2_2<string>;
6406
+ imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['imageModel']>>[0]>}` : never): ImageModelV2_2;
6407
+ imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): ImageModelV2_2;
6408
+ transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['transcriptionModel']>>[0]>}` : never): TranscriptionModelV2_2;
6409
+ transcriptionModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): TranscriptionModelV2_2;
6410
+ speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['speechModel']>>[0]>}` : never): SpeechModelV2_2;
6411
+ speechModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): SpeechModelV2_2;
5002
6412
  }
5003
6413
 
5004
6414
  /**
@@ -5056,6 +6466,61 @@ declare interface ProviderV2 {
5056
6466
  speechModel?(modelId: string): SpeechModelV2;
5057
6467
  }
5058
6468
 
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
+
5059
6524
  /**
5060
6525
  * Prunes model messages from a list of model messages.
5061
6526
  *
@@ -5190,7 +6655,7 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
5190
6655
  declare type ResponseMessage = AssistantModelMessage | ToolModelMessage;
5191
6656
 
5192
6657
  export declare class RetryError extends AISDKError {
5193
- private readonly [symbol$1_2];
6658
+ private readonly [symbol$1_3];
5194
6659
  readonly reason: RetryErrorReason;
5195
6660
  readonly lastError: unknown;
5196
6661
  readonly errors: Array<unknown>;
@@ -5246,7 +6711,7 @@ declare function safeValidateTypes<OBJECT>({ value, schema, }: {
5246
6711
  rawValue: unknown;
5247
6712
  } | {
5248
6713
  success: false;
5249
- error: TypeValidationError;
6714
+ error: TypeValidationError_2;
5250
6715
  rawValue: unknown;
5251
6716
  }>;
5252
6717
 
@@ -5303,6 +6768,8 @@ export declare class SerialJobExecutor {
5303
6768
 
5304
6769
  declare type SharedV2Headers = Record<string, string>;
5305
6770
 
6771
+ declare type SharedV2Headers_2 = Record<string, string>;
6772
+
5306
6773
  /**
5307
6774
  * Additional provider-specific metadata.
5308
6775
  * Metadata are additional outputs from the provider.
@@ -5326,6 +6793,29 @@ declare type SharedV2Headers = Record<string, string>;
5326
6793
  */
5327
6794
  declare type SharedV2ProviderMetadata = Record<string, Record<string, JSONValue_2>>;
5328
6795
 
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
+
5329
6819
  /**
5330
6820
  * Additional provider-specific options.
5331
6821
  * Options are additional input to the provider.
@@ -5349,6 +6839,29 @@ declare type SharedV2ProviderMetadata = Record<string, Record<string, JSONValue_
5349
6839
  */
5350
6840
  declare type SharedV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
5351
6841
 
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
+
5352
6865
  /**
5353
6866
  * Creates a ReadableStream that emits the provided values with an optional delay between each value.
5354
6867
  *
@@ -5428,7 +6941,7 @@ declare type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
5428
6941
  file: GeneratedFile;
5429
6942
  } | {
5430
6943
  type: 'stream-start';
5431
- warnings: LanguageModelV2CallWarning[];
6944
+ warnings: LanguageModelV2CallWarning_2[];
5432
6945
  } | {
5433
6946
  type: 'response-metadata';
5434
6947
  id?: string;
@@ -5471,7 +6984,7 @@ export declare function smoothStream<TOOLS extends ToolSet>({ delayInMs, chunkin
5471
6984
  /**
5472
6985
  A source that has been used as input to generate the response.
5473
6986
  */
5474
- declare type Source = LanguageModelV2Source;
6987
+ declare type Source = LanguageModelV2Source_2;
5475
6988
 
5476
6989
  /**
5477
6990
  * A document source part of a message.
@@ -5747,7 +7260,7 @@ declare enum SpanStatusCode {
5747
7260
  /**
5748
7261
  Speech model that is used by the AI SDK Core functions.
5749
7262
  */
5750
- export declare type SpeechModel = SpeechModelV2;
7263
+ export declare type SpeechModel = SpeechModelV2_2;
5751
7264
 
5752
7265
  export declare type SpeechModelResponseMetadata = {
5753
7266
  /**
@@ -5771,7 +7284,82 @@ export declare type SpeechModelResponseMetadata = {
5771
7284
  /**
5772
7285
  * Speech model specification version 2.
5773
7286
  */
5774
- declare type SpeechModelV2 = {
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
+ }>;
7357
+ };
7358
+
7359
+ /**
7360
+ * Speech model specification version 2.
7361
+ */
7362
+ declare type SpeechModelV2_2 = {
5775
7363
  /**
5776
7364
  * The speech model must specify which speech model interface
5777
7365
  * version it implements. This will allow us to evolve the speech
@@ -5791,7 +7379,7 @@ declare type SpeechModelV2 = {
5791
7379
  /**
5792
7380
  * Generates speech audio from text.
5793
7381
  */
5794
- doGenerate(options: SpeechModelV2CallOptions): PromiseLike<{
7382
+ doGenerate(options: SpeechModelV2CallOptions_2): PromiseLike<{
5795
7383
  /**
5796
7384
  * Generated audio as an ArrayBuffer.
5797
7385
  * The audio should be returned without any unnecessary conversion.
@@ -5803,7 +7391,7 @@ declare type SpeechModelV2 = {
5803
7391
  /**
5804
7392
  * Warnings for the call, e.g. unsupported settings.
5805
7393
  */
5806
- warnings: Array<SpeechModelV2CallWarning>;
7394
+ warnings: Array<SpeechModelV2CallWarning_2>;
5807
7395
  /**
5808
7396
  * Optional request information for telemetry and debugging purposes.
5809
7397
  */
@@ -5828,7 +7416,7 @@ declare type SpeechModelV2 = {
5828
7416
  /**
5829
7417
  * Response headers.
5830
7418
  */
5831
- headers?: SharedV2Headers;
7419
+ headers?: SharedV2Headers_2;
5832
7420
  /**
5833
7421
  * Response body.
5834
7422
  */
@@ -5839,7 +7427,7 @@ declare type SpeechModelV2 = {
5839
7427
  * from the provider to the AI SDK and enable provider-specific
5840
7428
  * results that can be fully encapsulated in the provider.
5841
7429
  */
5842
- providerMetadata?: Record<string, Record<string, JSONValue_2>>;
7430
+ providerMetadata?: Record<string, Record<string, JSONValue_3>>;
5843
7431
  }>;
5844
7432
  };
5845
7433
 
@@ -5894,6 +7482,57 @@ declare type SpeechModelV2CallOptions = {
5894
7482
  headers?: Record<string, string | undefined>;
5895
7483
  };
5896
7484
 
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
+
5897
7536
  /**
5898
7537
  * Warning from the model provider for this call. The call will proceed, but e.g.
5899
7538
  * some settings might not be supported, which can lead to suboptimal results.
@@ -5907,13 +7546,28 @@ declare type SpeechModelV2CallWarning = {
5907
7546
  message: string;
5908
7547
  };
5909
7548
 
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
+
5910
7562
  declare type SpeechModelV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
5911
7563
 
7564
+ declare type SpeechModelV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
7565
+
5912
7566
  /**
5913
7567
  Warning from the model provider for this call. The call will proceed, but e.g.
5914
7568
  some settings might not be supported, which can lead to suboptimal results.
5915
7569
  */
5916
- export declare type SpeechWarning = SpeechModelV2CallWarning;
7570
+ export declare type SpeechWarning = SpeechModelV2CallWarning_2;
5917
7571
 
5918
7572
  /** The Standard JSON Schema interface. */
5919
7573
  declare interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
@@ -6246,7 +7900,7 @@ export declare type StopCondition<TOOLS extends ToolSet> = (options: {
6246
7900
  @returns
6247
7901
  A result object for accessing the partial object stream and additional information.
6248
7902
  */
6249
- 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' ? {
7903
+ export declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue_3>, 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' ? {
6250
7904
  /**
6251
7905
  The enum values that the model should use.
6252
7906
  */
@@ -6915,6 +8569,8 @@ declare const symbol$1: unique symbol;
6915
8569
 
6916
8570
  declare const symbol$1_2: unique symbol;
6917
8571
 
8572
+ declare const symbol$1_3: unique symbol;
8573
+
6918
8574
  declare const symbol$2: unique symbol;
6919
8575
 
6920
8576
  declare const symbol$2_2: unique symbol;
@@ -6939,6 +8595,8 @@ declare const symbol$7: unique symbol;
6939
8595
 
6940
8596
  declare const symbol$7_2: unique symbol;
6941
8597
 
8598
+ declare const symbol$7_3: unique symbol;
8599
+
6942
8600
  declare const symbol$8: unique symbol;
6943
8601
 
6944
8602
  declare const symbol$8_2: unique symbol;
@@ -6959,10 +8617,14 @@ declare const symbol$c: unique symbol;
6959
8617
 
6960
8618
  declare const symbol$c_2: unique symbol;
6961
8619
 
8620
+ declare const symbol$c_3: unique symbol;
8621
+
6962
8622
  declare const symbol$d: unique symbol;
6963
8623
 
6964
8624
  declare const symbol$d_2: unique symbol;
6965
8625
 
8626
+ declare const symbol$d_3: unique symbol;
8627
+
6966
8628
  declare const symbol$e: unique symbol;
6967
8629
 
6968
8630
  declare const symbol: unique symbol;
@@ -7353,13 +9015,13 @@ export declare class ToolCallRepairError extends AISDKError {
7353
9015
  export declare type ToolCallRepairFunction<TOOLS extends ToolSet> = (options: {
7354
9016
  system: string | undefined;
7355
9017
  messages: ModelMessage[];
7356
- toolCall: LanguageModelV2ToolCall;
9018
+ toolCall: LanguageModelV2ToolCall_2;
7357
9019
  tools: TOOLS;
7358
9020
  inputSchema: (options: {
7359
9021
  toolName: string;
7360
9022
  }) => JSONSchema7;
7361
9023
  error: NoSuchToolError | InvalidToolInputError;
7362
- }) => Promise<LanguageModelV2ToolCall | null>;
9024
+ }) => Promise<LanguageModelV2ToolCall_2 | null>;
7363
9025
 
7364
9026
  /**
7365
9027
  Tool choice for the generation. It supports the following settings:
@@ -7600,7 +9262,7 @@ declare interface TraceState {
7600
9262
  /**
7601
9263
  Transcription model that is used by the AI SDK Core functions.
7602
9264
  */
7603
- export declare type TranscriptionModel = TranscriptionModelV2;
9265
+ export declare type TranscriptionModel = TranscriptionModelV2_2;
7604
9266
 
7605
9267
  export declare type TranscriptionModelResponseMetadata = {
7606
9268
  /**
@@ -7717,6 +9379,106 @@ declare type TranscriptionModelV2 = {
7717
9379
  }>;
7718
9380
  };
7719
9381
 
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
+
7720
9482
  declare type TranscriptionModelV2CallOptions = {
7721
9483
  /**
7722
9484
  Audio data to transcribe.
@@ -7755,6 +9517,44 @@ declare type TranscriptionModelV2CallOptions = {
7755
9517
  headers?: Record<string, string | undefined>;
7756
9518
  };
7757
9519
 
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
+
7758
9558
  /**
7759
9559
  Warning from the model provider for this call. The call will proceed, but e.g.
7760
9560
  some settings might not be supported, which can lead to suboptimal results.
@@ -7768,13 +9568,28 @@ declare type TranscriptionModelV2CallWarning = {
7768
9568
  message: string;
7769
9569
  };
7770
9570
 
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
+
7771
9584
  declare type TranscriptionModelV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
7772
9585
 
9586
+ declare type TranscriptionModelV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
9587
+
7773
9588
  /**
7774
9589
  Warning from the model provider for this call. The call will proceed, but e.g.
7775
9590
  some settings might not be supported, which can lead to suboptimal results.
7776
9591
  */
7777
- export declare type TranscriptionWarning = TranscriptionModelV2CallWarning;
9592
+ export declare type TranscriptionWarning = TranscriptionModelV2CallWarning_2;
7778
9593
 
7779
9594
  export declare type TypedToolCall<TOOLS extends ToolSet> = StaticToolCall<TOOLS> | DynamicToolCall;
7780
9595
 
@@ -7783,7 +9598,7 @@ export declare type TypedToolError<TOOLS extends ToolSet> = StaticToolError<TOOL
7783
9598
  export declare type TypedToolResult<TOOLS extends ToolSet> = StaticToolResult<TOOLS> | DynamicToolResult;
7784
9599
 
7785
9600
  export declare class TypeValidationError extends AISDKError {
7786
- private readonly [symbol$1];
9601
+ private readonly [symbol$1_2];
7787
9602
  readonly value: unknown;
7788
9603
  constructor({ value, cause }: {
7789
9604
  value: unknown;
@@ -7806,6 +9621,30 @@ export declare class TypeValidationError extends AISDKError {
7806
9621
  }): TypeValidationError;
7807
9622
  }
7808
9623
 
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
+
7809
9648
  export declare const UI_MESSAGE_STREAM_HEADERS: {
7810
9649
  'content-type': string;
7811
9650
  'cache-control': string;
@@ -8469,11 +10308,11 @@ declare function withUserAgentSuffix(headers: HeadersInit | Record<string, strin
8469
10308
  * @returns A new LanguageModelV2 instance with middleware applied.
8470
10309
  */
8471
10310
  export declare const wrapLanguageModel: ({ model, middleware: middlewareArg, modelId, providerId, }: {
8472
- model: LanguageModelV2;
10311
+ model: LanguageModelV2_2;
8473
10312
  middleware: LanguageModelMiddleware | LanguageModelMiddleware[];
8474
10313
  modelId?: string;
8475
10314
  providerId?: string;
8476
- }) => LanguageModelV2;
10315
+ }) => LanguageModelV2_2;
8477
10316
 
8478
10317
  /**
8479
10318
  * Wraps a ProviderV2 instance with middleware functionality.
@@ -8487,9 +10326,9 @@ export declare const wrapLanguageModel: ({ model, middleware: middlewareArg, mod
8487
10326
  * @returns A new ProviderV2 instance with middleware applied to all language models.
8488
10327
  */
8489
10328
  export declare function wrapProvider({ provider, languageModelMiddleware, }: {
8490
- provider: ProviderV2;
10329
+ provider: ProviderV2_2;
8491
10330
  languageModelMiddleware: LanguageModelMiddleware | LanguageModelMiddleware[];
8492
- }): ProviderV2;
10331
+ }): ProviderV2_2;
8493
10332
 
8494
10333
  export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, any> | z3.Schema<OBJECT, z3.ZodTypeDef, any>, options?: {
8495
10334
  /**
@@ -8502,10 +10341,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
8502
10341
  }): Schema<OBJECT>;
8503
10342
 
8504
10343
  export { }
8505
- export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult, FlexibleSchema as FlexibleSchema, LanguageModelV2ToolResultOutput as LanguageModelV2ToolResultOutput, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, ToolOutputProperties as ToolOutputProperties, LanguageModelV2ToolResultPart as LanguageModelV2ToolResultPart, JSONSchema7Version as JSONSchema7Version, JSONSchema7Definition as JSONSchema7Definition, JSONSchema7TypeName as JSONSchema7TypeName, JSONSchema7Type as JSONSchema7Type, 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, ContentPart as ContentPart, 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, ImageModelV2CallWarning as ImageModelV2CallWarning, SpeechModelV2CallWarning as SpeechModelV2CallWarning, TranscriptionModelV2CallWarning as TranscriptionModelV2CallWarning, 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 };
8506
-
8507
- export namespace Output {
8508
- export { output_Output as Output, output_object as object, output_text as text };
8509
- }
8510
-
8511
- 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, validatorSymbol };
10344
+ export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult, FlexibleSchema as FlexibleSchema, LanguageModelV2ToolResultOutput as LanguageModelV2ToolResultOutput, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, JSONValue_2 as JSONValue_2, ToolOutputProperties as ToolOutputProperties, LanguageModelV2ToolResultPart as LanguageModelV2ToolResultPart, JSONSchema7Version as JSONSchema7Version, JSONSchema7Definition as JSONSchema7Definition, JSONSchema7TypeName as JSONSchema7TypeName, JSONSchema7Type as JSONSchema7Type, AttributeValue as AttributeValue, Tracer as Tracer, EmbeddingModelV2Embedding_2 as EmbeddingModelV2Embedding_2, ImageModelV2ProviderMetadata_2 as ImageModelV2ProviderMetadata_2, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2FinishReason_2 as LanguageModelV2FinishReason_2, LanguageModelV2CallWarning_2 as LanguageModelV2CallWarning_2, LanguageModelV2Middleware as LanguageModelV2Middleware, SharedV2ProviderMetadata_2 as SharedV2ProviderMetadata_2, LanguageModelV2Usage_2 as LanguageModelV2Usage_2, ContentPart as ContentPart, Source as Source, ResponseMessage as ResponseMessage, DeepPartialInternal as DeepPartialInternal, LanguageModelV2ToolCall_2 as LanguageModelV2ToolCall_2, 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_3 as JSONValue_3, ImageModelV2CallWarning_2 as ImageModelV2CallWarning_2, SpeechModelV2CallWarning_2 as SpeechModelV2CallWarning_2, TranscriptionModelV2CallWarning_2 as TranscriptionModelV2CallWarning_2, LanguageModelV2CallOptions_2 as LanguageModelV2CallOptions_2, LanguageModelV2_2 as LanguageModelV2_2, EmbeddingModelV2_2 as EmbeddingModelV2_2, ImageModelV2_2 as ImageModelV2_2, TranscriptionModelV2_2 as TranscriptionModelV2_2, SpeechModelV2_2 as SpeechModelV2_2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV2_2 as ProviderV2_2, 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 };
10345
+ export { schemaSymbol, symbol$1, symbol$1_2, symbol$1_3, 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$7_3, 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$c_3, symbol$d, symbol$d_2, symbol$d_3, symbol$e, symbol, symbol_2, validatorSymbol };