@ai-sdk/google 3.0.127 → 3.0.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -232,10 +232,10 @@ var googleInteractionsTranscriptionResponseSchema = import_v43.z.object({
232
232
  });
233
233
 
234
234
  // src/google-provider.ts
235
- var import_provider_utils24 = require("@ai-sdk/provider-utils");
235
+ var import_provider_utils25 = require("@ai-sdk/provider-utils");
236
236
 
237
237
  // src/version.ts
238
- var VERSION = true ? "3.0.127" : "0.0.0-test";
238
+ var VERSION = true ? "3.0.128" : "0.0.0-test";
239
239
 
240
240
  // src/google-generative-ai-embedding-model.ts
241
241
  var import_provider2 = require("@ai-sdk/provider");
@@ -457,7 +457,7 @@ function validateMultimodalContentLength({
457
457
  }
458
458
 
459
459
  // src/google-generative-ai-language-model.ts
460
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
460
+ var import_provider_utils8 = require("@ai-sdk/provider-utils");
461
461
  var import_v47 = require("zod/v4");
462
462
 
463
463
  // src/convert-google-generative-ai-usage.ts
@@ -800,19 +800,28 @@ function parseBase64DataUrl(value) {
800
800
  data: match[2]
801
801
  };
802
802
  }
803
- function convertUrlToolResultPart(url) {
803
+ function convertUrlToolResultPart(url, mediaType, supportedFunctionResponseUrls) {
804
804
  const parsedDataUrl = parseBase64DataUrl(url);
805
- if (parsedDataUrl == null) {
806
- return void 0;
805
+ if (parsedDataUrl != null) {
806
+ return {
807
+ inlineData: {
808
+ mimeType: parsedDataUrl.mediaType,
809
+ data: parsedDataUrl.data
810
+ }
811
+ };
807
812
  }
808
- return {
809
- inlineData: {
810
- mimeType: parsedDataUrl.mediaType,
811
- data: parsedDataUrl.data
813
+ return mediaType != null && (0, import_provider_utils5.isUrlSupported)({
814
+ url,
815
+ mediaType,
816
+ supportedUrls: supportedFunctionResponseUrls
817
+ }) ? {
818
+ fileData: {
819
+ mimeType: mediaType,
820
+ fileUri: url
812
821
  }
813
- };
822
+ } : void 0;
814
823
  }
815
- function appendToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true) {
824
+ function appendToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true, supportedFunctionResponseUrls = {}) {
816
825
  const functionResponseParts = [];
817
826
  const responseTextParts = [];
818
827
  for (const contentPart of outputValue) {
@@ -834,7 +843,9 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId, include
834
843
  case "image-url":
835
844
  case "file-url": {
836
845
  const functionResponsePart = convertUrlToolResultPart(
837
- contentPart.url
846
+ contentPart.url,
847
+ contentPart.mediaType,
848
+ supportedFunctionResponseUrls
838
849
  );
839
850
  if (functionResponsePart != null) {
840
851
  functionResponseParts.push(functionResponsePart);
@@ -899,7 +910,7 @@ function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId, i
899
910
  }
900
911
  }
901
912
  function convertToGoogleGenerativeAIMessages(prompt, options) {
902
- var _a2, _b, _c, _d, _e, _f;
913
+ var _a2, _b, _c, _d, _e, _f, _g;
903
914
  const systemInstructionParts = [];
904
915
  const contents = [];
905
916
  let systemMessagesAllowed = true;
@@ -909,6 +920,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
909
920
  const supportsFunctionResponseParts = (_d = options == null ? void 0 : options.supportsFunctionResponseParts) != null ? _d : true;
910
921
  const onWarning = options == null ? void 0 : options.onWarning;
911
922
  const includeFunctionCallIds = (_e = options == null ? void 0 : options.includeFunctionCallIds) != null ? _e : true;
923
+ const supportedFunctionResponseUrls = (_f = options == null ? void 0 : options.supportedFunctionResponseUrls) != null ? _f : {};
912
924
  let sentinelInjected = false;
913
925
  const missingSignatureToolNames = [];
914
926
  const injectSkipSignature = (toolName) => {
@@ -1090,7 +1102,8 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
1090
1102
  part.toolName,
1091
1103
  output.value,
1092
1104
  part.toolCallId,
1093
- includeFunctionCallIds
1105
+ includeFunctionCallIds,
1106
+ supportedFunctionResponseUrls
1094
1107
  );
1095
1108
  } else {
1096
1109
  appendLegacyToolResultParts(
@@ -1108,7 +1121,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
1108
1121
  name: part.toolName,
1109
1122
  response: {
1110
1123
  name: part.toolName,
1111
- content: output.type === "execution-denied" ? (_f = output.reason) != null ? _f : "Tool call execution denied." : output.value
1124
+ content: output.type === "execution-denied" ? (_g = output.reason) != null ? _g : "Tool call execution denied." : output.value
1112
1125
  }
1113
1126
  }
1114
1127
  });
@@ -1139,16 +1152,82 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
1139
1152
  };
1140
1153
  }
1141
1154
 
1155
+ // src/download-tool-result-files.ts
1156
+ var import_provider_utils6 = require("@ai-sdk/provider-utils");
1157
+ async function downloadToolResultFiles(prompt, {
1158
+ abortSignal,
1159
+ supportedUrls = {}
1160
+ }) {
1161
+ async function downloadOutput(output) {
1162
+ if (output.type !== "content") {
1163
+ return output;
1164
+ }
1165
+ return {
1166
+ ...output,
1167
+ value: await Promise.all(
1168
+ output.value.map(async (part) => {
1169
+ var _a2;
1170
+ if (part.type !== "file-url" && part.type !== "image-url") {
1171
+ return part;
1172
+ }
1173
+ if (part.type === "file-url" && part.mediaType != null && (0, import_provider_utils6.isUrlSupported)({
1174
+ url: part.url,
1175
+ mediaType: part.mediaType,
1176
+ supportedUrls
1177
+ })) {
1178
+ return part;
1179
+ }
1180
+ const blob = await (0, import_provider_utils6.downloadBlob)(part.url, { abortSignal });
1181
+ return {
1182
+ type: part.type === "file-url" ? "file-data" : "image-data",
1183
+ data: (0, import_provider_utils6.convertUint8ArrayToBase64)(
1184
+ new Uint8Array(await blob.arrayBuffer())
1185
+ ),
1186
+ mediaType: blob.type || (part.type === "file-url" ? (_a2 = part.mediaType) != null ? _a2 : "application/octet-stream" : "image/*"),
1187
+ providerOptions: part.providerOptions
1188
+ };
1189
+ })
1190
+ )
1191
+ };
1192
+ }
1193
+ return Promise.all(
1194
+ prompt.map(async (message) => {
1195
+ switch (message.role) {
1196
+ case "assistant":
1197
+ return {
1198
+ ...message,
1199
+ content: await Promise.all(
1200
+ message.content.map(
1201
+ async (part) => part.type === "tool-result" ? { ...part, output: await downloadOutput(part.output) } : part
1202
+ )
1203
+ )
1204
+ };
1205
+ case "tool":
1206
+ return {
1207
+ ...message,
1208
+ content: await Promise.all(
1209
+ message.content.map(
1210
+ async (part) => part.type === "tool-result" ? { ...part, output: await downloadOutput(part.output) } : part
1211
+ )
1212
+ )
1213
+ };
1214
+ default:
1215
+ return message;
1216
+ }
1217
+ })
1218
+ );
1219
+ }
1220
+
1142
1221
  // src/get-model-path.ts
1143
1222
  function getModelPath(modelId) {
1144
1223
  return modelId.includes("/") ? modelId : `models/${modelId}`;
1145
1224
  }
1146
1225
 
1147
1226
  // src/google-generative-ai-options.ts
1148
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
1227
+ var import_provider_utils7 = require("@ai-sdk/provider-utils");
1149
1228
  var import_v46 = require("zod/v4");
1150
- var googleLanguageModelOptions = (0, import_provider_utils6.lazySchema)(
1151
- () => (0, import_provider_utils6.zodSchema)(
1229
+ var googleLanguageModelOptions = (0, import_provider_utils7.lazySchema)(
1230
+ () => (0, import_provider_utils7.zodSchema)(
1152
1231
  import_v46.z.object({
1153
1232
  responseModalities: import_v46.z.array(import_v46.z.enum(["TEXT", "IMAGE"])).optional(),
1154
1233
  thinkingConfig: import_v46.z.object({
@@ -1882,13 +1961,20 @@ var configurableSafetySettingCategories = [
1882
1961
  "HARM_CATEGORY_SEXUALLY_EXPLICIT"
1883
1962
  ];
1884
1963
  var gemini25ModelPattern2 = /(^|\/)gemini-2\.5(?:[.-]|$)/i;
1964
+ var googleCloudStorageFunctionResponseUrls = {
1965
+ "image/png": [/^gs:\/\/.*$/],
1966
+ "image/jpeg": [/^gs:\/\/.*$/],
1967
+ "image/webp": [/^gs:\/\/.*$/],
1968
+ "application/pdf": [/^gs:\/\/.*$/],
1969
+ "text/plain": [/^gs:\/\/.*$/]
1970
+ };
1885
1971
  var GoogleGenerativeAILanguageModel = class {
1886
1972
  constructor(modelId, config) {
1887
1973
  this.specificationVersion = "v3";
1888
1974
  var _a2;
1889
1975
  this.modelId = modelId;
1890
1976
  this.config = config;
1891
- this.generateId = (_a2 = config.generateId) != null ? _a2 : import_provider_utils7.generateId;
1977
+ this.generateId = (_a2 = config.generateId) != null ? _a2 : import_provider_utils8.generateId;
1892
1978
  }
1893
1979
  get provider() {
1894
1980
  return this.config.provider;
@@ -1910,18 +1996,19 @@ var GoogleGenerativeAILanguageModel = class {
1910
1996
  seed,
1911
1997
  tools,
1912
1998
  toolChoice,
1913
- providerOptions
1999
+ providerOptions,
2000
+ abortSignal
1914
2001
  }, { isStreaming = false } = {}) {
1915
2002
  var _a2, _b, _c;
1916
2003
  const warnings = [];
1917
2004
  const providerOptionsName = this.config.provider.includes("vertex") ? "vertex" : "google";
1918
- let googleOptions = await (0, import_provider_utils7.parseProviderOptions)({
2005
+ let googleOptions = await (0, import_provider_utils8.parseProviderOptions)({
1919
2006
  provider: providerOptionsName,
1920
2007
  providerOptions,
1921
2008
  schema: googleLanguageModelOptions
1922
2009
  });
1923
2010
  if (googleOptions == null && providerOptionsName !== "google") {
1924
- googleOptions = await (0, import_provider_utils7.parseProviderOptions)({
2011
+ googleOptions = await (0, import_provider_utils8.parseProviderOptions)({
1925
2012
  provider: "google",
1926
2013
  providerOptions,
1927
2014
  schema: googleLanguageModelOptions
@@ -1999,15 +2086,21 @@ var GoogleGenerativeAILanguageModel = class {
1999
2086
  });
2000
2087
  }
2001
2088
  const { usesGemini3Features } = getGoogleModelCapabilities(this.modelId);
2089
+ const supportedFunctionResponseUrls = usesGemini3Features && isVertexProvider ? googleCloudStorageFunctionResponseUrls : void 0;
2090
+ const promptWithDownloadedToolResultFiles = isVertexProvider ? await downloadToolResultFiles(prompt, {
2091
+ abortSignal,
2092
+ supportedUrls: supportedFunctionResponseUrls
2093
+ }) : prompt;
2002
2094
  const { contents, systemInstruction } = convertToGoogleGenerativeAIMessages(
2003
- prompt,
2095
+ promptWithDownloadedToolResultFiles,
2004
2096
  {
2005
2097
  isGemmaModel,
2006
2098
  isGemini3Model: usesGemini3Features,
2007
2099
  providerOptionsName,
2008
2100
  supportsFunctionResponseParts: usesGemini3Features,
2009
2101
  onWarning: (warning) => warnings.push(warning),
2010
- includeFunctionCallIds: !isVertexProvider
2102
+ includeFunctionCallIds: !isVertexProvider,
2103
+ supportedFunctionResponseUrls
2011
2104
  }
2012
2105
  );
2013
2106
  const {
@@ -2084,8 +2177,8 @@ var GoogleGenerativeAILanguageModel = class {
2084
2177
  async doGenerate(options) {
2085
2178
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
2086
2179
  const { args, warnings, providerOptionsName, extraHeaders } = await this.getArgs(options);
2087
- const mergedHeaders = (0, import_provider_utils7.combineHeaders)(
2088
- await (0, import_provider_utils7.resolve)(this.config.headers),
2180
+ const mergedHeaders = (0, import_provider_utils8.combineHeaders)(
2181
+ await (0, import_provider_utils8.resolve)(this.config.headers),
2089
2182
  options.headers,
2090
2183
  extraHeaders
2091
2184
  );
@@ -2093,14 +2186,14 @@ var GoogleGenerativeAILanguageModel = class {
2093
2186
  responseHeaders,
2094
2187
  value: response,
2095
2188
  rawValue: rawResponse
2096
- } = await (0, import_provider_utils7.postJsonToApi)({
2189
+ } = await (0, import_provider_utils8.postJsonToApi)({
2097
2190
  url: `${this.config.baseURL}/${getModelPath(
2098
2191
  this.modelId
2099
2192
  )}:generateContent`,
2100
2193
  headers: mergedHeaders,
2101
2194
  body: args,
2102
2195
  failedResponseHandler: googleFailedResponseHandler,
2103
- successfulResponseHandler: (0, import_provider_utils7.createJsonResponseHandler)(responseSchema),
2196
+ successfulResponseHandler: (0, import_provider_utils8.createJsonResponseHandler)(responseSchema),
2104
2197
  abortSignal: options.abortSignal,
2105
2198
  fetch: this.config.fetch
2106
2199
  });
@@ -2271,19 +2364,19 @@ var GoogleGenerativeAILanguageModel = class {
2271
2364
  }
2272
2365
  async doStream(options) {
2273
2366
  const { args, warnings, providerOptionsName, extraHeaders } = await this.getArgs(options, { isStreaming: true });
2274
- const headers = (0, import_provider_utils7.combineHeaders)(
2275
- await (0, import_provider_utils7.resolve)(this.config.headers),
2367
+ const headers = (0, import_provider_utils8.combineHeaders)(
2368
+ await (0, import_provider_utils8.resolve)(this.config.headers),
2276
2369
  options.headers,
2277
2370
  extraHeaders
2278
2371
  );
2279
- const { responseHeaders, value: response } = await (0, import_provider_utils7.postJsonToApi)({
2372
+ const { responseHeaders, value: response } = await (0, import_provider_utils8.postJsonToApi)({
2280
2373
  url: `${this.config.baseURL}/${getModelPath(
2281
2374
  this.modelId
2282
2375
  )}:streamGenerateContent?alt=sse`,
2283
2376
  headers,
2284
2377
  body: args,
2285
2378
  failedResponseHandler: googleFailedResponseHandler,
2286
- successfulResponseHandler: (0, import_provider_utils7.createEventSourceResponseHandler)(chunkSchema),
2379
+ successfulResponseHandler: (0, import_provider_utils8.createEventSourceResponseHandler)(chunkSchema),
2287
2380
  abortSignal: options.abortSignal,
2288
2381
  fetch: this.config.fetch
2289
2382
  });
@@ -2962,8 +3055,8 @@ var getUrlContextMetadataSchema = () => import_v47.z.object({
2962
3055
  })
2963
3056
  ).nullish()
2964
3057
  });
2965
- var responseSchema = (0, import_provider_utils7.lazySchema)(
2966
- () => (0, import_provider_utils7.zodSchema)(
3058
+ var responseSchema = (0, import_provider_utils8.lazySchema)(
3059
+ () => (0, import_provider_utils8.zodSchema)(
2967
3060
  import_v47.z.object({
2968
3061
  responseId: import_v47.z.string().nullish(),
2969
3062
  candidates: import_v47.z.array(
@@ -2984,8 +3077,8 @@ var responseSchema = (0, import_provider_utils7.lazySchema)(
2984
3077
  })
2985
3078
  )
2986
3079
  );
2987
- var chunkSchema = (0, import_provider_utils7.lazySchema)(
2988
- () => (0, import_provider_utils7.zodSchema)(
3080
+ var chunkSchema = (0, import_provider_utils8.lazySchema)(
3081
+ () => (0, import_provider_utils8.zodSchema)(
2989
3082
  import_v47.z.object({
2990
3083
  responseId: import_v47.z.string().nullish(),
2991
3084
  candidates: import_v47.z.array(
@@ -3011,9 +3104,9 @@ function isConfirmedPromptBlockReason(blockReason) {
3011
3104
  }
3012
3105
 
3013
3106
  // src/tool/code-execution.ts
3014
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
3107
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
3015
3108
  var import_v48 = require("zod/v4");
3016
- var codeExecution = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
3109
+ var codeExecution = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
3017
3110
  id: "google.code_execution",
3018
3111
  inputSchema: import_v48.z.object({
3019
3112
  language: import_v48.z.string().describe("The programming language of the code."),
@@ -3026,15 +3119,15 @@ var codeExecution = (0, import_provider_utils8.createProviderToolFactoryWithOutp
3026
3119
  });
3027
3120
 
3028
3121
  // src/tool/enterprise-web-search.ts
3029
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
3122
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
3030
3123
  var import_v49 = require("zod/v4");
3031
- var enterpriseWebSearch = (0, import_provider_utils9.createProviderToolFactory)({
3124
+ var enterpriseWebSearch = (0, import_provider_utils10.createProviderToolFactory)({
3032
3125
  id: "google.enterprise_web_search",
3033
- inputSchema: (0, import_provider_utils9.lazySchema)(() => (0, import_provider_utils9.zodSchema)(import_v49.z.object({})))
3126
+ inputSchema: (0, import_provider_utils10.lazySchema)(() => (0, import_provider_utils10.zodSchema)(import_v49.z.object({})))
3034
3127
  });
3035
3128
 
3036
3129
  // src/tool/file-search.ts
3037
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
3130
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
3038
3131
  var import_v410 = require("zod/v4");
3039
3132
  var fileSearchArgsBaseSchema = import_v410.z.object({
3040
3133
  /** The names of the file_search_stores to retrieve from.
@@ -3052,24 +3145,24 @@ var fileSearchArgsBaseSchema = import_v410.z.object({
3052
3145
  "Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
3053
3146
  ).optional()
3054
3147
  }).passthrough();
3055
- var fileSearchArgsSchema = (0, import_provider_utils10.lazySchema)(
3056
- () => (0, import_provider_utils10.zodSchema)(fileSearchArgsBaseSchema)
3148
+ var fileSearchArgsSchema = (0, import_provider_utils11.lazySchema)(
3149
+ () => (0, import_provider_utils11.zodSchema)(fileSearchArgsBaseSchema)
3057
3150
  );
3058
- var fileSearch = (0, import_provider_utils10.createProviderToolFactory)({
3151
+ var fileSearch = (0, import_provider_utils11.createProviderToolFactory)({
3059
3152
  id: "google.file_search",
3060
3153
  inputSchema: fileSearchArgsSchema
3061
3154
  });
3062
3155
 
3063
3156
  // src/tool/google-maps.ts
3064
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
3157
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
3065
3158
  var import_v411 = require("zod/v4");
3066
- var googleMaps = (0, import_provider_utils11.createProviderToolFactory)({
3159
+ var googleMaps = (0, import_provider_utils12.createProviderToolFactory)({
3067
3160
  id: "google.google_maps",
3068
- inputSchema: (0, import_provider_utils11.lazySchema)(() => (0, import_provider_utils11.zodSchema)(import_v411.z.object({})))
3161
+ inputSchema: (0, import_provider_utils12.lazySchema)(() => (0, import_provider_utils12.zodSchema)(import_v411.z.object({})))
3069
3162
  });
3070
3163
 
3071
3164
  // src/tool/google-search.ts
3072
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
3165
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
3073
3166
  var import_v412 = require("zod/v4");
3074
3167
  var googleSearchToolArgsBaseSchema = import_v412.z.object({
3075
3168
  searchTypes: import_v412.z.object({
@@ -3081,10 +3174,10 @@ var googleSearchToolArgsBaseSchema = import_v412.z.object({
3081
3174
  endTime: import_v412.z.string()
3082
3175
  }).optional()
3083
3176
  }).passthrough();
3084
- var googleSearchToolArgsSchema = (0, import_provider_utils12.lazySchema)(
3085
- () => (0, import_provider_utils12.zodSchema)(googleSearchToolArgsBaseSchema)
3177
+ var googleSearchToolArgsSchema = (0, import_provider_utils13.lazySchema)(
3178
+ () => (0, import_provider_utils13.zodSchema)(googleSearchToolArgsBaseSchema)
3086
3179
  );
3087
- var googleSearch = (0, import_provider_utils12.createProviderToolFactory)(
3180
+ var googleSearch = (0, import_provider_utils13.createProviderToolFactory)(
3088
3181
  {
3089
3182
  id: "google.google_search",
3090
3183
  inputSchema: googleSearchToolArgsSchema
@@ -3092,17 +3185,17 @@ var googleSearch = (0, import_provider_utils12.createProviderToolFactory)(
3092
3185
  );
3093
3186
 
3094
3187
  // src/tool/url-context.ts
3095
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
3188
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
3096
3189
  var import_v413 = require("zod/v4");
3097
- var urlContext = (0, import_provider_utils13.createProviderToolFactory)({
3190
+ var urlContext = (0, import_provider_utils14.createProviderToolFactory)({
3098
3191
  id: "google.url_context",
3099
- inputSchema: (0, import_provider_utils13.lazySchema)(() => (0, import_provider_utils13.zodSchema)(import_v413.z.object({})))
3192
+ inputSchema: (0, import_provider_utils14.lazySchema)(() => (0, import_provider_utils14.zodSchema)(import_v413.z.object({})))
3100
3193
  });
3101
3194
 
3102
3195
  // src/tool/vertex-rag-store.ts
3103
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
3196
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
3104
3197
  var import_v414 = require("zod/v4");
3105
- var vertexRagStore = (0, import_provider_utils14.createProviderToolFactory)({
3198
+ var vertexRagStore = (0, import_provider_utils15.createProviderToolFactory)({
3106
3199
  id: "google.vertex_rag_store",
3107
3200
  inputSchema: import_v414.z.object({
3108
3201
  ragCorpus: import_v414.z.string(),
@@ -3171,7 +3264,7 @@ var googleTools = {
3171
3264
  };
3172
3265
 
3173
3266
  // src/google-generative-ai-image-model.ts
3174
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
3267
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
3175
3268
  var import_v415 = require("zod/v4");
3176
3269
  var GoogleGenerativeAIImageModel = class {
3177
3270
  constructor(modelId, settings, config) {
@@ -3237,7 +3330,7 @@ var GoogleGenerativeAIImageModel = class {
3237
3330
  details: "This model does not support the `seed` option through this provider."
3238
3331
  });
3239
3332
  }
3240
- const googleOptions = await (0, import_provider_utils15.parseProviderOptions)({
3333
+ const googleOptions = await (0, import_provider_utils16.parseProviderOptions)({
3241
3334
  provider: "google",
3242
3335
  providerOptions,
3243
3336
  schema: googleImageModelOptionsSchema
@@ -3264,12 +3357,12 @@ var GoogleGenerativeAIImageModel = class {
3264
3357
  instances: [{ prompt }],
3265
3358
  parameters
3266
3359
  };
3267
- const { responseHeaders, value: response } = await (0, import_provider_utils15.postJsonToApi)({
3360
+ const { responseHeaders, value: response } = await (0, import_provider_utils16.postJsonToApi)({
3268
3361
  url: `${this.config.baseURL}/models/${this.modelId}:predict`,
3269
- headers: (0, import_provider_utils15.combineHeaders)(await (0, import_provider_utils15.resolve)(this.config.headers), headers),
3362
+ headers: (0, import_provider_utils16.combineHeaders)(await (0, import_provider_utils16.resolve)(this.config.headers), headers),
3270
3363
  body,
3271
3364
  failedResponseHandler: googleFailedResponseHandler,
3272
- successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
3365
+ successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
3273
3366
  googleImageResponseSchema
3274
3367
  ),
3275
3368
  abortSignal,
@@ -3356,7 +3449,7 @@ var GoogleGenerativeAIImageModel = class {
3356
3449
  const languageModelPrompt = [
3357
3450
  { role: "user", content: userContent }
3358
3451
  ];
3359
- const googleImageOptions = await (0, import_provider_utils15.parseProviderOptions)({
3452
+ const googleImageOptions = await (0, import_provider_utils16.parseProviderOptions)({
3360
3453
  provider: "google",
3361
3454
  providerOptions,
3362
3455
  schema: googleImageModelOptionsSchema
@@ -3367,7 +3460,7 @@ var GoogleGenerativeAIImageModel = class {
3367
3460
  baseURL: this.config.baseURL,
3368
3461
  headers: (_b = this.config.headers) != null ? _b : {},
3369
3462
  fetch: this.config.fetch,
3370
- generateId: (_c = this.config.generateId) != null ? _c : import_provider_utils15.generateId
3463
+ generateId: (_c = this.config.generateId) != null ? _c : import_provider_utils16.generateId
3371
3464
  });
3372
3465
  const result = await languageModel.doGenerate({
3373
3466
  prompt: languageModelPrompt,
@@ -3396,7 +3489,7 @@ var GoogleGenerativeAIImageModel = class {
3396
3489
  const images = [];
3397
3490
  for (const part of result.content) {
3398
3491
  if (part.type === "file" && part.mediaType.startsWith("image/")) {
3399
- images.push((0, import_provider_utils15.convertToBase64)(part.data));
3492
+ images.push((0, import_provider_utils16.convertToBase64)(part.data));
3400
3493
  }
3401
3494
  }
3402
3495
  const languageModelGoogleMetadata = (_h = (_g = result.providerMetadata) == null ? void 0 : _g.google) != null ? _h : {};
@@ -3426,8 +3519,8 @@ var GoogleGenerativeAIImageModel = class {
3426
3519
  function isGeminiModel(modelId) {
3427
3520
  return modelId.startsWith("gemini-");
3428
3521
  }
3429
- var googleImageResponseSchema = (0, import_provider_utils15.lazySchema)(
3430
- () => (0, import_provider_utils15.zodSchema)(
3522
+ var googleImageResponseSchema = (0, import_provider_utils16.lazySchema)(
3523
+ () => (0, import_provider_utils16.zodSchema)(
3431
3524
  import_v415.z.object({
3432
3525
  predictions: import_v415.z.array(
3433
3526
  import_v415.z.union([
@@ -3438,8 +3531,8 @@ var googleImageResponseSchema = (0, import_provider_utils15.lazySchema)(
3438
3531
  })
3439
3532
  )
3440
3533
  );
3441
- var googleImageModelOptionsSchema = (0, import_provider_utils15.lazySchema)(
3442
- () => (0, import_provider_utils15.zodSchema)(
3534
+ var googleImageModelOptionsSchema = (0, import_provider_utils16.lazySchema)(
3535
+ () => (0, import_provider_utils16.zodSchema)(
3443
3536
  import_v415.z.object({
3444
3537
  personGeneration: import_v415.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
3445
3538
  aspectRatio: import_v415.z.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish(),
@@ -3459,7 +3552,7 @@ var googleImageModelOptionsSchema = (0, import_provider_utils15.lazySchema)(
3459
3552
 
3460
3553
  // src/google-generative-ai-video-model.ts
3461
3554
  var import_provider6 = require("@ai-sdk/provider");
3462
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
3555
+ var import_provider_utils17 = require("@ai-sdk/provider-utils");
3463
3556
  var import_v416 = require("zod/v4");
3464
3557
  function getFirstFrameImage(options) {
3465
3558
  var _a2, _b;
@@ -3494,7 +3587,7 @@ function convertFileToGoogleImage(file, warnings) {
3494
3587
  });
3495
3588
  return void 0;
3496
3589
  }
3497
- const base64Data = typeof file.data === "string" ? file.data : (0, import_provider_utils16.convertUint8ArrayToBase64)(file.data);
3590
+ const base64Data = typeof file.data === "string" ? file.data : (0, import_provider_utils17.convertUint8ArrayToBase64)(file.data);
3498
3591
  return {
3499
3592
  bytesBase64Encoded: base64Data,
3500
3593
  mimeType: file.mediaType || "image/png"
@@ -3539,7 +3632,7 @@ var GoogleGenerativeAIVideoModel = class {
3539
3632
  var _a2, _b, _c, _d, _e, _f, _g, _h;
3540
3633
  const currentDate = (_c = (_b = (_a2 = this.config._internal) == null ? void 0 : _a2.currentDate) == null ? void 0 : _b.call(_a2)) != null ? _c : /* @__PURE__ */ new Date();
3541
3634
  const warnings = [];
3542
- const googleOptions = await (0, import_provider_utils16.parseProviderOptions)({
3635
+ const googleOptions = await (0, import_provider_utils17.parseProviderOptions)({
3543
3636
  provider: "google",
3544
3637
  providerOptions: options.providerOptions,
3545
3638
  schema: googleVideoModelOptionsSchema
@@ -3614,17 +3707,17 @@ var GoogleGenerativeAIVideoModel = class {
3614
3707
  }
3615
3708
  }
3616
3709
  }
3617
- const { value: operation } = await (0, import_provider_utils16.postJsonToApi)({
3710
+ const { value: operation } = await (0, import_provider_utils17.postJsonToApi)({
3618
3711
  url: `${this.config.baseURL}/models/${this.modelId}:predictLongRunning`,
3619
- headers: (0, import_provider_utils16.combineHeaders)(
3620
- await (0, import_provider_utils16.resolve)(this.config.headers),
3712
+ headers: (0, import_provider_utils17.combineHeaders)(
3713
+ await (0, import_provider_utils17.resolve)(this.config.headers),
3621
3714
  options.headers
3622
3715
  ),
3623
3716
  body: {
3624
3717
  instances,
3625
3718
  parameters
3626
3719
  },
3627
- successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
3720
+ successfulResponseHandler: (0, import_provider_utils17.createJsonResponseHandler)(
3628
3721
  googleOperationSchema
3629
3722
  ),
3630
3723
  failedResponseHandler: googleFailedResponseHandler,
@@ -3650,20 +3743,20 @@ var GoogleGenerativeAIVideoModel = class {
3650
3743
  message: `Video generation timed out after ${pollTimeoutMs}ms`
3651
3744
  });
3652
3745
  }
3653
- await (0, import_provider_utils16.delay)(pollIntervalMs);
3746
+ await (0, import_provider_utils17.delay)(pollIntervalMs);
3654
3747
  if ((_f = options.abortSignal) == null ? void 0 : _f.aborted) {
3655
3748
  throw new import_provider6.AISDKError({
3656
3749
  name: "GOOGLE_VIDEO_GENERATION_ABORTED",
3657
3750
  message: "Video generation request was aborted"
3658
3751
  });
3659
3752
  }
3660
- const { value: statusOperation, responseHeaders: pollHeaders } = await (0, import_provider_utils16.getFromApi)({
3753
+ const { value: statusOperation, responseHeaders: pollHeaders } = await (0, import_provider_utils17.getFromApi)({
3661
3754
  url: `${this.config.baseURL}/${operationName}`,
3662
- headers: (0, import_provider_utils16.combineHeaders)(
3663
- await (0, import_provider_utils16.resolve)(this.config.headers),
3755
+ headers: (0, import_provider_utils17.combineHeaders)(
3756
+ await (0, import_provider_utils17.resolve)(this.config.headers),
3664
3757
  options.headers
3665
3758
  ),
3666
- successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
3759
+ successfulResponseHandler: (0, import_provider_utils17.createJsonResponseHandler)(
3667
3760
  googleOperationSchema
3668
3761
  ),
3669
3762
  failedResponseHandler: googleFailedResponseHandler,
@@ -3688,11 +3781,11 @@ var GoogleGenerativeAIVideoModel = class {
3688
3781
  }
3689
3782
  const videos = [];
3690
3783
  const videoMetadata = [];
3691
- const resolvedHeaders = await (0, import_provider_utils16.resolve)(this.config.headers);
3784
+ const resolvedHeaders = await (0, import_provider_utils17.resolve)(this.config.headers);
3692
3785
  const apiKey = resolvedHeaders == null ? void 0 : resolvedHeaders["x-goog-api-key"];
3693
3786
  for (const generatedSample of response.generateVideoResponse.generatedSamples) {
3694
3787
  if ((_h = generatedSample.video) == null ? void 0 : _h.uri) {
3695
- const urlWithAuth = apiKey && (0, import_provider_utils16.isSameOrigin)(generatedSample.video.uri, this.config.baseURL) ? `${generatedSample.video.uri}${generatedSample.video.uri.includes("?") ? "&" : "?"}key=${apiKey}` : generatedSample.video.uri;
3788
+ const urlWithAuth = apiKey && (0, import_provider_utils17.isSameOrigin)(generatedSample.video.uri, this.config.baseURL) ? `${generatedSample.video.uri}${generatedSample.video.uri.includes("?") ? "&" : "?"}key=${apiKey}` : generatedSample.video.uri;
3696
3789
  videos.push({
3697
3790
  type: "url",
3698
3791
  url: urlWithAuth,
@@ -3745,8 +3838,8 @@ var googleOperationSchema = import_v416.z.object({
3745
3838
  }).nullish()
3746
3839
  }).nullish()
3747
3840
  });
3748
- var googleVideoModelOptionsSchema = (0, import_provider_utils16.lazySchema)(
3749
- () => (0, import_provider_utils16.zodSchema)(
3841
+ var googleVideoModelOptionsSchema = (0, import_provider_utils17.lazySchema)(
3842
+ () => (0, import_provider_utils17.zodSchema)(
3750
3843
  import_v416.z.object({
3751
3844
  pollIntervalMs: import_v416.z.number().positive().nullish(),
3752
3845
  pollTimeoutMs: import_v416.z.number().positive().nullish(),
@@ -3763,7 +3856,7 @@ var googleVideoModelOptionsSchema = (0, import_provider_utils16.lazySchema)(
3763
3856
  );
3764
3857
 
3765
3858
  // src/interactions/google-interactions-language-model.ts
3766
- var import_provider_utils23 = require("@ai-sdk/provider-utils");
3859
+ var import_provider_utils24 = require("@ai-sdk/provider-utils");
3767
3860
 
3768
3861
  // src/interactions/convert-google-interactions-usage.ts
3769
3862
  function convertGoogleInteractionsUsage(usage) {
@@ -4529,7 +4622,7 @@ function buildGoogleInteractionsStreamTransform({
4529
4622
  }
4530
4623
 
4531
4624
  // src/interactions/convert-to-google-interactions-input.ts
4532
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
4625
+ var import_provider_utils18 = require("@ai-sdk/provider-utils");
4533
4626
  function getTopLevelMediaType(mediaType) {
4534
4627
  const slashIndex = mediaType.indexOf("/");
4535
4628
  return slashIndex === -1 ? mediaType : mediaType.substring(0, slashIndex);
@@ -4718,7 +4811,7 @@ function convertFilePartToContent({
4718
4811
  }
4719
4812
  return {
4720
4813
  type: kind,
4721
- data: (0, import_provider_utils17.convertToBase64)(part.data),
4814
+ data: (0, import_provider_utils18.convertToBase64)(part.data),
4722
4815
  mime_type: part.mediaType,
4723
4816
  ...resolutionField
4724
4817
  };
@@ -4769,7 +4862,7 @@ function compactPromptForPreviousInteraction({
4769
4862
  }
4770
4863
  function safeParseToolArgs(input) {
4771
4864
  try {
4772
- const parsed = (0, import_provider_utils17.secureJsonParse)(input);
4865
+ const parsed = (0, import_provider_utils18.secureJsonParse)(input);
4773
4866
  if (parsed != null && typeof parsed === "object" && !Array.isArray(parsed)) {
4774
4867
  return parsed;
4775
4868
  }
@@ -4892,7 +4985,7 @@ function filePartToImageBlock({
4892
4985
  }
4893
4986
  return {
4894
4987
  type: "image",
4895
- data: (0, import_provider_utils17.convertToBase64)(part.data),
4988
+ data: (0, import_provider_utils18.convertToBase64)(part.data),
4896
4989
  mime_type: part.mediaType
4897
4990
  };
4898
4991
  }
@@ -4919,7 +5012,7 @@ ${block.text}`
4919
5012
  }
4920
5013
 
4921
5014
  // src/interactions/google-interactions-api.ts
4922
- var import_provider_utils18 = require("@ai-sdk/provider-utils");
5015
+ var import_provider_utils19 = require("@ai-sdk/provider-utils");
4923
5016
  var import_v417 = require("zod/v4");
4924
5017
  var tokenByModalitySchema = () => import_v417.z.object({
4925
5018
  modality: import_v417.z.string().nullish(),
@@ -5082,8 +5175,8 @@ var stepSchema = () => {
5082
5175
  import_v417.z.object({ type: import_v417.z.string() }).loose()
5083
5176
  ]);
5084
5177
  };
5085
- var googleInteractionsResponseSchema = (0, import_provider_utils18.lazySchema)(
5086
- () => (0, import_provider_utils18.zodSchema)(
5178
+ var googleInteractionsResponseSchema = (0, import_provider_utils19.lazySchema)(
5179
+ () => (0, import_provider_utils19.zodSchema)(
5087
5180
  import_v417.z.object({
5088
5181
  /*
5089
5182
  * `id` is omitted from the response body when `store: false` (fully
@@ -5104,8 +5197,8 @@ var googleInteractionsResponseSchema = (0, import_provider_utils18.lazySchema)(
5104
5197
  }).loose()
5105
5198
  )
5106
5199
  );
5107
- var googleInteractionsEventSchema = (0, import_provider_utils18.lazySchema)(
5108
- () => (0, import_provider_utils18.zodSchema)(
5200
+ var googleInteractionsEventSchema = (0, import_provider_utils19.lazySchema)(
5201
+ () => (0, import_provider_utils19.zodSchema)(
5109
5202
  (() => {
5110
5203
  const status = interactionStatusSchema();
5111
5204
  const annotation = annotationSchema();
@@ -5262,10 +5355,10 @@ var googleInteractionsEventSchema = (0, import_provider_utils18.lazySchema)(
5262
5355
  );
5263
5356
 
5264
5357
  // src/interactions/google-interactions-language-model-options.ts
5265
- var import_provider_utils19 = require("@ai-sdk/provider-utils");
5358
+ var import_provider_utils20 = require("@ai-sdk/provider-utils");
5266
5359
  var import_v418 = require("zod/v4");
5267
- var googleInteractionsLanguageModelOptions = (0, import_provider_utils19.lazySchema)(
5268
- () => (0, import_provider_utils19.zodSchema)(
5360
+ var googleInteractionsLanguageModelOptions = (0, import_provider_utils20.lazySchema)(
5361
+ () => (0, import_provider_utils20.zodSchema)(
5269
5362
  import_v418.z.object({
5270
5363
  previousInteractionId: import_v418.z.string().nullish(),
5271
5364
  store: import_v418.z.boolean().nullish(),
@@ -5632,10 +5725,10 @@ function parseGoogleInteractionsOutputs({
5632
5725
  }
5633
5726
 
5634
5727
  // src/interactions/poll-google-interactions.ts
5635
- var import_provider_utils21 = require("@ai-sdk/provider-utils");
5728
+ var import_provider_utils22 = require("@ai-sdk/provider-utils");
5636
5729
 
5637
5730
  // src/interactions/cancel-google-interaction.ts
5638
- var import_provider_utils20 = require("@ai-sdk/provider-utils");
5731
+ var import_provider_utils21 = require("@ai-sdk/provider-utils");
5639
5732
  var getOriginalFetch = () => globalThis.fetch;
5640
5733
  async function cancelGoogleInteraction({
5641
5734
  baseURL,
@@ -5650,9 +5743,9 @@ async function cancelGoogleInteraction({
5650
5743
  try {
5651
5744
  const response = await fetch(url, {
5652
5745
  method: "POST",
5653
- headers: (0, import_provider_utils20.withUserAgentSuffix)(
5654
- (0, import_provider_utils20.combineHeaders)({ "Content-Type": "application/json" }, headers),
5655
- (0, import_provider_utils20.getRuntimeEnvironmentUserAgent)()
5746
+ headers: (0, import_provider_utils21.withUserAgentSuffix)(
5747
+ (0, import_provider_utils21.combineHeaders)({ "Content-Type": "application/json" }, headers),
5748
+ (0, import_provider_utils21.getRuntimeEnvironmentUserAgent)()
5656
5749
  ),
5657
5750
  body: "{}"
5658
5751
  });
@@ -5702,16 +5795,16 @@ async function pollGoogleInteractionUntilTerminal({
5702
5795
  `google.interactions: timed out polling interaction ${interactionId} after ${timeoutMs}ms.`
5703
5796
  );
5704
5797
  }
5705
- await (0, import_provider_utils21.delay)(nextDelayMs, { abortSignal });
5798
+ await (0, import_provider_utils22.delay)(nextDelayMs, { abortSignal });
5706
5799
  const {
5707
5800
  value: response,
5708
5801
  rawValue: rawResponse,
5709
5802
  responseHeaders
5710
- } = await (0, import_provider_utils21.getFromApi)({
5803
+ } = await (0, import_provider_utils22.getFromApi)({
5711
5804
  url,
5712
5805
  headers,
5713
5806
  failedResponseHandler: googleFailedResponseHandler,
5714
- successfulResponseHandler: (0, import_provider_utils21.createJsonResponseHandler)(
5807
+ successfulResponseHandler: (0, import_provider_utils22.createJsonResponseHandler)(
5715
5808
  googleInteractionsResponseSchema
5716
5809
  ),
5717
5810
  abortSignal,
@@ -5723,7 +5816,7 @@ async function pollGoogleInteractionUntilTerminal({
5723
5816
  nextDelayMs = Math.min(nextDelayMs * 2, maxDelayMs);
5724
5817
  }
5725
5818
  } catch (error) {
5726
- if ((0, import_provider_utils21.isAbortError)(error)) {
5819
+ if ((0, import_provider_utils22.isAbortError)(error)) {
5727
5820
  await cancelOnServer();
5728
5821
  }
5729
5822
  throw error;
@@ -5879,7 +5972,7 @@ function prepareGoogleInteractionsTools({
5879
5972
  }
5880
5973
 
5881
5974
  // src/interactions/stream-google-interactions.ts
5882
- var import_provider_utils22 = require("@ai-sdk/provider-utils");
5975
+ var import_provider_utils23 = require("@ai-sdk/provider-utils");
5883
5976
  var DEFAULT_MAX_RETRIES = 3;
5884
5977
  var DEFAULT_RETRY_DELAY_MS = 500;
5885
5978
  function streamGoogleInteractionEvents({
@@ -5926,11 +6019,11 @@ function streamGoogleInteractionEvents({
5926
6019
  return `${base}?${params.toString()}`;
5927
6020
  }
5928
6021
  async function openReader() {
5929
- const { value: stream } = await (0, import_provider_utils22.getFromApi)({
6022
+ const { value: stream } = await (0, import_provider_utils23.getFromApi)({
5930
6023
  url: buildUrl(),
5931
6024
  headers: eventSourceHeaders,
5932
6025
  failedResponseHandler: googleFailedResponseHandler,
5933
- successfulResponseHandler: (0, import_provider_utils22.createEventSourceResponseHandler)(
6026
+ successfulResponseHandler: (0, import_provider_utils23.createEventSourceResponseHandler)(
5934
6027
  googleInteractionsEventSchema
5935
6028
  ),
5936
6029
  abortSignal: effectiveSignal,
@@ -5947,7 +6040,7 @@ function streamGoogleInteractionEvents({
5947
6040
  currentReader = await openReader();
5948
6041
  receivedAnyEventThisAttempt = false;
5949
6042
  } catch (error) {
5950
- if ((0, import_provider_utils22.isAbortError)(error) || effectiveSignal.aborted) {
6043
+ if ((0, import_provider_utils23.isAbortError)(error) || effectiveSignal.aborted) {
5951
6044
  controller.error(error);
5952
6045
  return;
5953
6046
  }
@@ -5956,7 +6049,7 @@ function streamGoogleInteractionEvents({
5956
6049
  controller.error(error);
5957
6050
  return;
5958
6051
  }
5959
- await (0, import_provider_utils22.delay)(retryDelayMs * attempt, {
6052
+ await (0, import_provider_utils23.delay)(retryDelayMs * attempt, {
5960
6053
  abortSignal: effectiveSignal
5961
6054
  });
5962
6055
  continue;
@@ -5977,7 +6070,7 @@ function streamGoogleInteractionEvents({
5977
6070
  );
5978
6071
  return;
5979
6072
  }
5980
- await (0, import_provider_utils22.delay)(retryDelayMs * attempt, {
6073
+ await (0, import_provider_utils23.delay)(retryDelayMs * attempt, {
5981
6074
  abortSignal: effectiveSignal
5982
6075
  });
5983
6076
  } else {
@@ -5997,7 +6090,7 @@ function streamGoogleInteractionEvents({
5997
6090
  }
5998
6091
  controller.enqueue(value);
5999
6092
  } catch (error) {
6000
- if ((0, import_provider_utils22.isAbortError)(error) || effectiveSignal.aborted) {
6093
+ if ((0, import_provider_utils23.isAbortError)(error) || effectiveSignal.aborted) {
6001
6094
  controller.error(error);
6002
6095
  return;
6003
6096
  }
@@ -6007,7 +6100,7 @@ function streamGoogleInteractionEvents({
6007
6100
  controller.error(error);
6008
6101
  return;
6009
6102
  }
6010
- await (0, import_provider_utils22.delay)(retryDelayMs * attempt, {
6103
+ await (0, import_provider_utils23.delay)(retryDelayMs * attempt, {
6011
6104
  abortSignal: effectiveSignal
6012
6105
  });
6013
6106
  }
@@ -6219,7 +6312,7 @@ var GoogleInteractionsLanguageModel = class {
6219
6312
  async getArgs(options) {
6220
6313
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
6221
6314
  const warnings = [];
6222
- const opts = await (0, import_provider_utils23.parseProviderOptions)({
6315
+ const opts = await (0, import_provider_utils24.parseProviderOptions)({
6223
6316
  provider: "google",
6224
6317
  providerOptions: options.providerOptions,
6225
6318
  schema: googleInteractionsLanguageModelOptions
@@ -6476,17 +6569,17 @@ var GoogleInteractionsLanguageModel = class {
6476
6569
  var _a2, _b, _c, _d, _e, _f;
6477
6570
  const { args, warnings, isAgent, pollingTimeoutMs } = await this.getArgs(options);
6478
6571
  const url = `${this.config.baseURL}/interactions`;
6479
- const mergedHeaders = (0, import_provider_utils23.combineHeaders)(
6572
+ const mergedHeaders = (0, import_provider_utils24.combineHeaders)(
6480
6573
  INTERACTIONS_API_REVISION_HEADER,
6481
- this.config.headers ? await (0, import_provider_utils23.resolve)(this.config.headers) : void 0,
6574
+ this.config.headers ? await (0, import_provider_utils24.resolve)(this.config.headers) : void 0,
6482
6575
  options.headers
6483
6576
  );
6484
- const postResult = await (0, import_provider_utils23.postJsonToApi)({
6577
+ const postResult = await (0, import_provider_utils24.postJsonToApi)({
6485
6578
  url,
6486
6579
  headers: mergedHeaders,
6487
6580
  body: args,
6488
6581
  failedResponseHandler: googleFailedResponseHandler,
6489
- successfulResponseHandler: (0, import_provider_utils23.createJsonResponseHandler)(
6582
+ successfulResponseHandler: (0, import_provider_utils24.createJsonResponseHandler)(
6490
6583
  googleInteractionsResponseSchema
6491
6584
  ),
6492
6585
  abortSignal: options.abortSignal,
@@ -6513,7 +6606,7 @@ var GoogleInteractionsLanguageModel = class {
6513
6606
  const interactionId = typeof response.id === "string" && response.id.length > 0 ? response.id : void 0;
6514
6607
  const { content, hasFunctionCall } = parseGoogleInteractionsOutputs({
6515
6608
  steps: (_b = response.steps) != null ? _b : null,
6516
- generateId: (_c = this.config.generateId) != null ? _c : import_provider_utils23.generateId,
6609
+ generateId: (_c = this.config.generateId) != null ? _c : import_provider_utils24.generateId,
6517
6610
  interactionId
6518
6611
  });
6519
6612
  const finishReason = {
@@ -6561,9 +6654,9 @@ var GoogleInteractionsLanguageModel = class {
6561
6654
  var _a2;
6562
6655
  const { args, warnings, isBackground, pollingTimeoutMs } = await this.getArgs(options);
6563
6656
  const url = `${this.config.baseURL}/interactions`;
6564
- const mergedHeaders = (0, import_provider_utils23.combineHeaders)(
6657
+ const mergedHeaders = (0, import_provider_utils24.combineHeaders)(
6565
6658
  INTERACTIONS_API_REVISION_HEADER,
6566
- this.config.headers ? await (0, import_provider_utils23.resolve)(this.config.headers) : void 0,
6659
+ this.config.headers ? await (0, import_provider_utils24.resolve)(this.config.headers) : void 0,
6567
6660
  options.headers
6568
6661
  );
6569
6662
  if (isBackground) {
@@ -6577,12 +6670,12 @@ var GoogleInteractionsLanguageModel = class {
6577
6670
  });
6578
6671
  }
6579
6672
  const body = { ...args, stream: true };
6580
- const { responseHeaders, value: response } = await (0, import_provider_utils23.postJsonToApi)({
6673
+ const { responseHeaders, value: response } = await (0, import_provider_utils24.postJsonToApi)({
6581
6674
  url,
6582
6675
  headers: mergedHeaders,
6583
6676
  body,
6584
6677
  failedResponseHandler: googleFailedResponseHandler,
6585
- successfulResponseHandler: (0, import_provider_utils23.createEventSourceResponseHandler)(
6678
+ successfulResponseHandler: (0, import_provider_utils24.createEventSourceResponseHandler)(
6586
6679
  googleInteractionsEventSchema
6587
6680
  ),
6588
6681
  abortSignal: options.abortSignal,
@@ -6591,7 +6684,7 @@ var GoogleInteractionsLanguageModel = class {
6591
6684
  const headerServiceTier = responseHeaders == null ? void 0 : responseHeaders["x-gemini-service-tier"];
6592
6685
  const transform = buildGoogleInteractionsStreamTransform({
6593
6686
  warnings,
6594
- generateId: (_a2 = this.config.generateId) != null ? _a2 : import_provider_utils23.generateId,
6687
+ generateId: (_a2 = this.config.generateId) != null ? _a2 : import_provider_utils24.generateId,
6595
6688
  includeRawChunks: options.includeRawChunks,
6596
6689
  serviceTier: headerServiceTier
6597
6690
  });
@@ -6628,12 +6721,12 @@ var GoogleInteractionsLanguageModel = class {
6628
6721
  pollingTimeoutMs
6629
6722
  }) {
6630
6723
  var _a2, _b;
6631
- const postResult = await (0, import_provider_utils23.postJsonToApi)({
6724
+ const postResult = await (0, import_provider_utils24.postJsonToApi)({
6632
6725
  url,
6633
6726
  headers: mergedHeaders,
6634
6727
  body: args,
6635
6728
  failedResponseHandler: googleFailedResponseHandler,
6636
- successfulResponseHandler: (0, import_provider_utils23.createJsonResponseHandler)(
6729
+ successfulResponseHandler: (0, import_provider_utils24.createJsonResponseHandler)(
6637
6730
  googleInteractionsResponseSchema
6638
6731
  ),
6639
6732
  abortSignal: options.abortSignal,
@@ -6651,7 +6744,7 @@ var GoogleInteractionsLanguageModel = class {
6651
6744
  const synthesized = synthesizeGoogleInteractionsAgentStream({
6652
6745
  response: postResponse,
6653
6746
  warnings,
6654
- generateId: (_a2 = this.config.generateId) != null ? _a2 : import_provider_utils23.generateId,
6747
+ generateId: (_a2 = this.config.generateId) != null ? _a2 : import_provider_utils24.generateId,
6655
6748
  includeRawChunks: options.includeRawChunks,
6656
6749
  headerServiceTier
6657
6750
  });
@@ -6671,7 +6764,7 @@ var GoogleInteractionsLanguageModel = class {
6671
6764
  });
6672
6765
  const transform = buildGoogleInteractionsStreamTransform({
6673
6766
  warnings,
6674
- generateId: (_b = this.config.generateId) != null ? _b : import_provider_utils23.generateId,
6767
+ generateId: (_b = this.config.generateId) != null ? _b : import_provider_utils24.generateId,
6675
6768
  includeRawChunks: options.includeRawChunks,
6676
6769
  serviceTier: headerServiceTier
6677
6770
  });
@@ -6725,11 +6818,11 @@ function supportsExternalFileUrls(modelId) {
6725
6818
  }
6726
6819
  function createGoogleGenerativeAI(options = {}) {
6727
6820
  var _a2, _b;
6728
- const baseURL = (_a2 = (0, import_provider_utils24.withoutTrailingSlash)(options.baseURL)) != null ? _a2 : "https://generativelanguage.googleapis.com/v1beta";
6821
+ const baseURL = (_a2 = (0, import_provider_utils25.withoutTrailingSlash)(options.baseURL)) != null ? _a2 : "https://generativelanguage.googleapis.com/v1beta";
6729
6822
  const providerName = (_b = options.name) != null ? _b : "google.generative-ai";
6730
- const getHeaders = () => (0, import_provider_utils24.withUserAgentSuffix)(
6823
+ const getHeaders = () => (0, import_provider_utils25.withUserAgentSuffix)(
6731
6824
  {
6732
- "x-goog-api-key": (0, import_provider_utils24.loadApiKey)({
6825
+ "x-goog-api-key": (0, import_provider_utils25.loadApiKey)({
6733
6826
  apiKey: options.apiKey,
6734
6827
  environmentVariableName: "GOOGLE_GENERATIVE_AI_API_KEY",
6735
6828
  description: "Google Generative AI"
@@ -6744,7 +6837,7 @@ function createGoogleGenerativeAI(options = {}) {
6744
6837
  provider: providerName,
6745
6838
  baseURL,
6746
6839
  headers: getHeaders,
6747
- generateId: (_a3 = options.generateId) != null ? _a3 : import_provider_utils24.generateId,
6840
+ generateId: (_a3 = options.generateId) != null ? _a3 : import_provider_utils25.generateId,
6748
6841
  supportedUrls: () => ({
6749
6842
  "*": [
6750
6843
  // Google Generative Language "files" endpoint
@@ -6791,7 +6884,7 @@ function createGoogleGenerativeAI(options = {}) {
6791
6884
  baseURL,
6792
6885
  headers: getHeaders,
6793
6886
  fetch: options.fetch,
6794
- generateId: (_a3 = options.generateId) != null ? _a3 : import_provider_utils24.generateId
6887
+ generateId: (_a3 = options.generateId) != null ? _a3 : import_provider_utils25.generateId
6795
6888
  });
6796
6889
  };
6797
6890
  const createInteractionsModel = (modelIdOrAgent) => {
@@ -6802,7 +6895,7 @@ function createGoogleGenerativeAI(options = {}) {
6802
6895
  provider: `${providerName}.interactions`,
6803
6896
  baseURL,
6804
6897
  headers: getHeaders,
6805
- generateId: (_a3 = options.generateId) != null ? _a3 : import_provider_utils24.generateId,
6898
+ generateId: (_a3 = options.generateId) != null ? _a3 : import_provider_utils25.generateId,
6806
6899
  fetch: options.fetch
6807
6900
  }
6808
6901
  );