@ai-sdk/google 2.0.42 → 2.0.44
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 +13 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +18 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -6
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +4 -2
- package/dist/internal/index.d.ts +4 -2
- package/dist/internal/index.js +17 -5
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +17 -5
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 2.0.44
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [d1dbe5d]
|
|
8
|
+
- @ai-sdk/provider-utils@3.0.18
|
|
9
|
+
|
|
10
|
+
## 2.0.43
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 7b2c30f: Fixed Zod validation error when using `google.tools.fileSearch()`. The Google File Search API returns `fileSearchStore` instead of `uri` in `retrievedContext`. Updated `extractSources()` function to handle both the old format (Google Search with `uri`) and new format (File Search with `fileSearchStore`), maintaining backward compatibility while preventing validation errors. Also fixed title handling to use `undefined` for URL sources and `'Unknown Document'` for document sources.
|
|
15
|
+
|
|
3
16
|
## 2.0.42
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -85,9 +85,10 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
85
85
|
title?: string | null | undefined;
|
|
86
86
|
} | null | undefined;
|
|
87
87
|
retrievedContext?: {
|
|
88
|
-
uri
|
|
88
|
+
uri?: string | null | undefined;
|
|
89
89
|
title?: string | null | undefined;
|
|
90
90
|
text?: string | null | undefined;
|
|
91
|
+
fileSearchStore?: string | null | undefined;
|
|
91
92
|
} | null | undefined;
|
|
92
93
|
}[] | null | undefined;
|
|
93
94
|
groundingSupports?: {
|
package/dist/index.d.ts
CHANGED
|
@@ -85,9 +85,10 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
85
85
|
title?: string | null | undefined;
|
|
86
86
|
} | null | undefined;
|
|
87
87
|
retrievedContext?: {
|
|
88
|
-
uri
|
|
88
|
+
uri?: string | null | undefined;
|
|
89
89
|
title?: string | null | undefined;
|
|
90
90
|
text?: string | null | undefined;
|
|
91
|
+
fileSearchStore?: string | null | undefined;
|
|
91
92
|
} | null | undefined;
|
|
92
93
|
}[] | null | undefined;
|
|
93
94
|
groundingSupports?: {
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
30
30
|
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = true ? "2.0.
|
|
33
|
+
var VERSION = true ? "2.0.44" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/google-generative-ai-embedding-model.ts
|
|
36
36
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -1272,7 +1272,7 @@ function extractSources({
|
|
|
1272
1272
|
groundingMetadata,
|
|
1273
1273
|
generateId: generateId3
|
|
1274
1274
|
}) {
|
|
1275
|
-
var _a, _b, _c;
|
|
1275
|
+
var _a, _b, _c, _d;
|
|
1276
1276
|
if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
|
|
1277
1277
|
return void 0;
|
|
1278
1278
|
}
|
|
@@ -1288,7 +1288,8 @@ function extractSources({
|
|
|
1288
1288
|
});
|
|
1289
1289
|
} else if (chunk.retrievedContext != null) {
|
|
1290
1290
|
const uri = chunk.retrievedContext.uri;
|
|
1291
|
-
|
|
1291
|
+
const fileSearchStore = chunk.retrievedContext.fileSearchStore;
|
|
1292
|
+
if (uri && (uri.startsWith("http://") || uri.startsWith("https://"))) {
|
|
1292
1293
|
sources.push({
|
|
1293
1294
|
type: "source",
|
|
1294
1295
|
sourceType: "url",
|
|
@@ -1296,7 +1297,7 @@ function extractSources({
|
|
|
1296
1297
|
url: uri,
|
|
1297
1298
|
title: (_b = chunk.retrievedContext.title) != null ? _b : void 0
|
|
1298
1299
|
});
|
|
1299
|
-
} else {
|
|
1300
|
+
} else if (uri) {
|
|
1300
1301
|
const title = (_c = chunk.retrievedContext.title) != null ? _c : "Unknown Document";
|
|
1301
1302
|
let mediaType = "application/octet-stream";
|
|
1302
1303
|
let filename = void 0;
|
|
@@ -1326,6 +1327,16 @@ function extractSources({
|
|
|
1326
1327
|
title,
|
|
1327
1328
|
filename
|
|
1328
1329
|
});
|
|
1330
|
+
} else if (fileSearchStore) {
|
|
1331
|
+
const title = (_d = chunk.retrievedContext.title) != null ? _d : "Unknown Document";
|
|
1332
|
+
sources.push({
|
|
1333
|
+
type: "source",
|
|
1334
|
+
sourceType: "document",
|
|
1335
|
+
id: generateId3(),
|
|
1336
|
+
mediaType: "application/octet-stream",
|
|
1337
|
+
title,
|
|
1338
|
+
filename: fileSearchStore.split("/").pop()
|
|
1339
|
+
});
|
|
1329
1340
|
}
|
|
1330
1341
|
}
|
|
1331
1342
|
}
|
|
@@ -1339,9 +1350,10 @@ var getGroundingMetadataSchema = () => import_v45.z.object({
|
|
|
1339
1350
|
import_v45.z.object({
|
|
1340
1351
|
web: import_v45.z.object({ uri: import_v45.z.string(), title: import_v45.z.string().nullish() }).nullish(),
|
|
1341
1352
|
retrievedContext: import_v45.z.object({
|
|
1342
|
-
uri: import_v45.z.string(),
|
|
1353
|
+
uri: import_v45.z.string().nullish(),
|
|
1343
1354
|
title: import_v45.z.string().nullish(),
|
|
1344
|
-
text: import_v45.z.string().nullish()
|
|
1355
|
+
text: import_v45.z.string().nullish(),
|
|
1356
|
+
fileSearchStore: import_v45.z.string().nullish()
|
|
1345
1357
|
}).nullish()
|
|
1346
1358
|
})
|
|
1347
1359
|
).nullish(),
|