@ai-sdk/google-vertex 4.0.233 → 4.0.235

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.d.ts CHANGED
@@ -114,7 +114,7 @@ declare class GoogleVertexEmbeddingModel implements EmbeddingModelV3 {
114
114
  doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV3['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV3['doEmbed']>>>;
115
115
  }
116
116
 
117
- type GoogleVertexModelId = 'gemini-nano-banana-2.1' | 'gemini-4-argon' | 'gemini-4-carbon' | 'gemini-3.8-flash' | 'gemini-3.7-flash' | 'gemini-3.6-flash' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-002' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
117
+ type GoogleVertexModelId = 'gemini-nano-banana-2.1' | 'gemini-4-argon' | 'gemini-4-carbon' | 'gemini-4-neon' | 'gemini-3.8-flash' | 'gemini-3.7-flash' | 'gemini-3.6-flash' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-002' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
118
118
 
119
119
  declare const googleVertexTools: {
120
120
  googleSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
@@ -221,8 +221,12 @@ interface GoogleVertexProviderSettings$1 {
221
221
  */
222
222
  headers?: Resolvable<Record<string, string | undefined>>;
223
223
  /**
224
- * Custom fetch implementation. You can use it as a middleware to intercept requests,
225
- * or to provide a custom fetch implementation for e.g. testing.
224
+ * Custom fetch implementation for Vertex API requests. You can use it as a
225
+ * middleware to intercept requests, or to provide a custom fetch
226
+ * implementation for e.g. testing.
227
+ *
228
+ * It is not used to download tool result files; those downloads use the
229
+ * validated default transport unless `toolResultDownloads.fetch` is set.
226
230
  */
227
231
  fetch?: FetchFunction;
228
232
  generateId?: () => string;
@@ -230,6 +234,30 @@ interface GoogleVertexProviderSettings$1 {
230
234
  * Base URL for the Google Vertex API calls.
231
235
  */
232
236
  baseURL?: string;
237
+ /**
238
+ * Configuration for downloading tool result files whose URLs cannot be
239
+ * referenced in Vertex function responses.
240
+ */
241
+ toolResultDownloads?: {
242
+ /**
243
+ * Maximum number of bytes per downloaded tool result file.
244
+ * Defaults to 7 MiB.
245
+ */
246
+ maxBytes?: number;
247
+ /**
248
+ * Transport used to download tool result files.
249
+ *
250
+ * Downloads default to a validated transport that resolves every hostname
251
+ * through a validating lookup hook and pins the connection to the resolved
252
+ * address on Node.js. Pass a fetch here only if it provides equivalent
253
+ * connect-time DNS validation for the URLs you download, e.g. a guarded
254
+ * fetch on Bun or Deno.
255
+ *
256
+ * The `fetch` option is not used for these downloads, and the Vertex API key
257
+ * is never attached to them.
258
+ */
259
+ fetch?: FetchFunction;
260
+ };
233
261
  }
234
262
 
235
263
  interface GoogleVertexProviderSettings extends GoogleVertexProviderSettings$1 {
package/dist/index.js CHANGED
@@ -284,7 +284,7 @@ var import_internal3 = require("@ai-sdk/google/internal");
284
284
  var import_provider_utils10 = require("@ai-sdk/provider-utils");
285
285
 
286
286
  // src/version.ts
287
- var VERSION = true ? "4.0.233" : "0.0.0-test";
287
+ var VERSION = true ? "4.0.235" : "0.0.0-test";
288
288
 
289
289
  // src/google-vertex-embedding-model.ts
290
290
  var import_provider2 = require("@ai-sdk/provider");
@@ -1356,6 +1356,7 @@ var googleVertexVideoModelOptionsSchema = (0, import_provider_utils9.lazySchema)
1356
1356
 
1357
1357
  // src/google-vertex-provider.ts
1358
1358
  var EXPRESS_MODE_BASE_URL = "https://aiplatform.googleapis.com/v1/publishers/google";
1359
+ var DEFAULT_TOOL_RESULT_DOWNLOAD_MAX_BYTES = 7 * 1024 * 1024;
1359
1360
  function createExpressModeFetch(apiKey, customFetch) {
1360
1361
  return async (url, init) => {
1361
1362
  const modifiedInit = {
@@ -1420,7 +1421,7 @@ function createVertex(options = {}) {
1420
1421
  };
1421
1422
  };
1422
1423
  const createChatModel = (modelId) => {
1423
- var _a;
1424
+ var _a, _b, _c, _d;
1424
1425
  return new import_internal3.GoogleGenerativeAILanguageModel(modelId, {
1425
1426
  ...createConfig("chat"),
1426
1427
  generateId: (_a = options.generateId) != null ? _a : import_provider_utils10.generateId,
@@ -1431,7 +1432,15 @@ function createVertex(options = {}) {
1431
1432
  // Google Cloud Storage URLs:
1432
1433
  /^gs:\/\/.*$/
1433
1434
  ]
1434
- })
1435
+ }),
1436
+ downloadToolResultFiles: {
1437
+ maxBytes: (_c = (_b = options.toolResultDownloads) == null ? void 0 : _b.maxBytes) != null ? _c : DEFAULT_TOOL_RESULT_DOWNLOAD_MAX_BYTES,
1438
+ // Tool result hosts are unrelated to the Vertex API, so this must be an
1439
+ // explicit download transport. The provider `fetch` is often a logging
1440
+ // or proxy wrapper that would replace the DNS-pinned default transport,
1441
+ // and the Express Mode wrapper would leak the API key to those hosts.
1442
+ fetch: (_d = options.toolResultDownloads) == null ? void 0 : _d.fetch
1443
+ }
1435
1444
  });
1436
1445
  };
1437
1446
  const createInteractionsModel = (modelIdOrAgent) => {