@ai-sdk/google 4.0.8 → 4.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 4.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 7401c2c: Pass documented Gemini external HTTPS file URLs through without downloading them.
8
+
3
9
  ## 4.0.8
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  } from "@ai-sdk/provider-utils";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "4.0.8" : "0.0.0-test";
10
+ var VERSION = true ? "4.0.9" : "0.0.0-test";
11
11
 
12
12
  // src/google-embedding-model.ts
13
13
  import {
@@ -7231,6 +7231,34 @@ var GoogleRealtimeModel = class {
7231
7231
  };
7232
7232
 
7233
7233
  // src/google-provider.ts
7234
+ var supportedExternalUrlMediaTypes = [
7235
+ "text/html",
7236
+ "text/css",
7237
+ "text/plain",
7238
+ "text/xml",
7239
+ "text/csv",
7240
+ "text/rtf",
7241
+ "text/javascript",
7242
+ "application/json",
7243
+ "application/pdf",
7244
+ "image/bmp",
7245
+ "image/jpeg",
7246
+ "image/png",
7247
+ "image/webp",
7248
+ "video/mp4",
7249
+ "video/mpeg",
7250
+ "video/quicktime",
7251
+ "video/avi",
7252
+ "video/x-flv",
7253
+ "video/mpg",
7254
+ "video/webm",
7255
+ "video/wmv",
7256
+ "video/3gpp"
7257
+ ];
7258
+ var externalHttpsUrlPattern = /^https:\/\/.*$/;
7259
+ function supportsExternalFileUrls(modelId) {
7260
+ return /(^|\/)gemini-/.test(modelId) && !/(^|\/)gemini-2\.0/.test(modelId);
7261
+ }
7234
7262
  function createGoogle(options = {}) {
7235
7263
  var _a, _b;
7236
7264
  const baseURL = (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : "https://generativelanguage.googleapis.com/v1beta";
@@ -7263,7 +7291,13 @@ function createGoogle(options = {}) {
7263
7291
  `^https://(?:www\\.)?youtube\\.com/watch\\?v=[\\w-]+(?:&[\\w=&.-]*)?$`
7264
7292
  ),
7265
7293
  new RegExp(`^https://youtu\\.be/[\\w-]+(?:\\?[\\w=&.-]*)?$`)
7266
- ]
7294
+ ],
7295
+ ...supportsExternalFileUrls(modelId) ? Object.fromEntries(
7296
+ supportedExternalUrlMediaTypes.map((mediaType) => [
7297
+ mediaType,
7298
+ [externalHttpsUrlPattern]
7299
+ ])
7300
+ ) : {}
7267
7301
  }),
7268
7302
  fetch: options.fetch
7269
7303
  });