@ai-sdk/google 3.0.0-beta.55 → 3.0.0-beta.57

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,19 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.0-beta.57
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [10d819b]
8
+ - @ai-sdk/provider@3.0.0-beta.18
9
+ - @ai-sdk/provider-utils@4.0.0-beta.35
10
+
11
+ ## 3.0.0-beta.56
12
+
13
+ ### Patch Changes
14
+
15
+ - e300a3b: 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.
16
+
3
17
  ## 3.0.0-beta.55
4
18
 
5
19
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -86,9 +86,10 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
86
86
  title?: string | null | undefined;
87
87
  } | null | undefined;
88
88
  retrievedContext?: {
89
- uri: string;
89
+ uri?: string | null | undefined;
90
90
  title?: string | null | undefined;
91
91
  text?: string | null | undefined;
92
+ fileSearchStore?: string | null | undefined;
92
93
  } | null | undefined;
93
94
  }[] | null | undefined;
94
95
  groundingSupports?: {
package/dist/index.d.ts CHANGED
@@ -86,9 +86,10 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
86
86
  title?: string | null | undefined;
87
87
  } | null | undefined;
88
88
  retrievedContext?: {
89
- uri: string;
89
+ uri?: string | null | undefined;
90
90
  title?: string | null | undefined;
91
91
  text?: string | null | undefined;
92
+ fileSearchStore?: string | null | undefined;
92
93
  } | null | undefined;
93
94
  }[] | null | undefined;
94
95
  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 ? "3.0.0-beta.55" : "0.0.0-test";
33
+ var VERSION = true ? "3.0.0-beta.57" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -1267,7 +1267,7 @@ function extractSources({
1267
1267
  groundingMetadata,
1268
1268
  generateId: generateId3
1269
1269
  }) {
1270
- var _a, _b, _c;
1270
+ var _a, _b, _c, _d;
1271
1271
  if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
1272
1272
  return void 0;
1273
1273
  }
@@ -1283,7 +1283,8 @@ function extractSources({
1283
1283
  });
1284
1284
  } else if (chunk.retrievedContext != null) {
1285
1285
  const uri = chunk.retrievedContext.uri;
1286
- if (uri.startsWith("http://") || uri.startsWith("https://")) {
1286
+ const fileSearchStore = chunk.retrievedContext.fileSearchStore;
1287
+ if (uri && (uri.startsWith("http://") || uri.startsWith("https://"))) {
1287
1288
  sources.push({
1288
1289
  type: "source",
1289
1290
  sourceType: "url",
@@ -1291,7 +1292,7 @@ function extractSources({
1291
1292
  url: uri,
1292
1293
  title: (_b = chunk.retrievedContext.title) != null ? _b : void 0
1293
1294
  });
1294
- } else {
1295
+ } else if (uri) {
1295
1296
  const title = (_c = chunk.retrievedContext.title) != null ? _c : "Unknown Document";
1296
1297
  let mediaType = "application/octet-stream";
1297
1298
  let filename = void 0;
@@ -1321,6 +1322,16 @@ function extractSources({
1321
1322
  title,
1322
1323
  filename
1323
1324
  });
1325
+ } else if (fileSearchStore) {
1326
+ const title = (_d = chunk.retrievedContext.title) != null ? _d : "Unknown Document";
1327
+ sources.push({
1328
+ type: "source",
1329
+ sourceType: "document",
1330
+ id: generateId3(),
1331
+ mediaType: "application/octet-stream",
1332
+ title,
1333
+ filename: fileSearchStore.split("/").pop()
1334
+ });
1324
1335
  }
1325
1336
  }
1326
1337
  }
@@ -1334,9 +1345,10 @@ var getGroundingMetadataSchema = () => import_v45.z.object({
1334
1345
  import_v45.z.object({
1335
1346
  web: import_v45.z.object({ uri: import_v45.z.string(), title: import_v45.z.string().nullish() }).nullish(),
1336
1347
  retrievedContext: import_v45.z.object({
1337
- uri: import_v45.z.string(),
1348
+ uri: import_v45.z.string().nullish(),
1338
1349
  title: import_v45.z.string().nullish(),
1339
- text: import_v45.z.string().nullish()
1350
+ text: import_v45.z.string().nullish(),
1351
+ fileSearchStore: import_v45.z.string().nullish()
1340
1352
  }).nullish()
1341
1353
  })
1342
1354
  ).nullish(),