@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 +6 -0
- package/dist/index.js +36 -2
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/google-provider.ts +39 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/google",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,16 +35,16 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ai-sdk/provider
|
|
39
|
-
"@ai-sdk/provider": "
|
|
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",
|
|
43
43
|
"tsup": "^8.5.1",
|
|
44
44
|
"typescript": "5.8.3",
|
|
45
45
|
"zod": "3.25.76",
|
|
46
|
-
"@
|
|
47
|
-
"@ai-
|
|
46
|
+
"@ai-sdk/test-server": "2.0.0",
|
|
47
|
+
"@vercel/ai-tsconfig": "0.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"zod": "^3.25.76 || ^4.1.8"
|
package/src/google-provider.ts
CHANGED
|
@@ -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
|
});
|