@ai-sdk/google 4.0.7 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/google",
3
- "version": "4.0.7",
3
+ "version": "4.0.9",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -35,8 +35,8 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@ai-sdk/provider-utils": "5.0.4",
39
- "@ai-sdk/provider": "4.0.1"
38
+ "@ai-sdk/provider": "4.0.2",
39
+ "@ai-sdk/provider-utils": "5.0.5"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "22.19.19",
@@ -159,6 +159,37 @@ export interface GoogleProviderSettings {
159
159
  name?: string;
160
160
  }
161
161
 
162
+ const supportedExternalUrlMediaTypes = [
163
+ 'text/html',
164
+ 'text/css',
165
+ 'text/plain',
166
+ 'text/xml',
167
+ 'text/csv',
168
+ 'text/rtf',
169
+ 'text/javascript',
170
+ 'application/json',
171
+ 'application/pdf',
172
+ 'image/bmp',
173
+ 'image/jpeg',
174
+ 'image/png',
175
+ 'image/webp',
176
+ 'video/mp4',
177
+ 'video/mpeg',
178
+ 'video/quicktime',
179
+ 'video/avi',
180
+ 'video/x-flv',
181
+ 'video/mpg',
182
+ 'video/webm',
183
+ 'video/wmv',
184
+ 'video/3gpp',
185
+ ];
186
+
187
+ const externalHttpsUrlPattern = /^https:\/\/.*$/;
188
+
189
+ function supportsExternalFileUrls(modelId: string) {
190
+ return /(^|\/)gemini-/.test(modelId) && !/(^|\/)gemini-2\.0/.test(modelId);
191
+ }
192
+
162
193
  /**
163
194
  * Create a Google provider instance.
164
195
  */
@@ -201,6 +232,14 @@ export function createGoogle(
201
232
  ),
202
233
  new RegExp(`^https://youtu\\.be/[\\w-]+(?:\\?[\\w=&.-]*)?$`),
203
234
  ],
235
+ ...(supportsExternalFileUrls(modelId)
236
+ ? Object.fromEntries(
237
+ supportedExternalUrlMediaTypes.map(mediaType => [
238
+ mediaType,
239
+ [externalHttpsUrlPattern],
240
+ ]),
241
+ )
242
+ : {}),
204
243
  }),
205
244
  fetch: options.fetch,
206
245
  });