@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/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  } from "@ai-sdk/provider-utils";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "2.0.42" : "0.0.0-test";
10
+ var VERSION = true ? "2.0.44" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -1283,7 +1283,7 @@ function extractSources({
1283
1283
  groundingMetadata,
1284
1284
  generateId: generateId3
1285
1285
  }) {
1286
- var _a, _b, _c;
1286
+ var _a, _b, _c, _d;
1287
1287
  if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
1288
1288
  return void 0;
1289
1289
  }
@@ -1299,7 +1299,8 @@ function extractSources({
1299
1299
  });
1300
1300
  } else if (chunk.retrievedContext != null) {
1301
1301
  const uri = chunk.retrievedContext.uri;
1302
- if (uri.startsWith("http://") || uri.startsWith("https://")) {
1302
+ const fileSearchStore = chunk.retrievedContext.fileSearchStore;
1303
+ if (uri && (uri.startsWith("http://") || uri.startsWith("https://"))) {
1303
1304
  sources.push({
1304
1305
  type: "source",
1305
1306
  sourceType: "url",
@@ -1307,7 +1308,7 @@ function extractSources({
1307
1308
  url: uri,
1308
1309
  title: (_b = chunk.retrievedContext.title) != null ? _b : void 0
1309
1310
  });
1310
- } else {
1311
+ } else if (uri) {
1311
1312
  const title = (_c = chunk.retrievedContext.title) != null ? _c : "Unknown Document";
1312
1313
  let mediaType = "application/octet-stream";
1313
1314
  let filename = void 0;
@@ -1337,6 +1338,16 @@ function extractSources({
1337
1338
  title,
1338
1339
  filename
1339
1340
  });
1341
+ } else if (fileSearchStore) {
1342
+ const title = (_d = chunk.retrievedContext.title) != null ? _d : "Unknown Document";
1343
+ sources.push({
1344
+ type: "source",
1345
+ sourceType: "document",
1346
+ id: generateId3(),
1347
+ mediaType: "application/octet-stream",
1348
+ title,
1349
+ filename: fileSearchStore.split("/").pop()
1350
+ });
1340
1351
  }
1341
1352
  }
1342
1353
  }
@@ -1350,9 +1361,10 @@ var getGroundingMetadataSchema = () => z5.object({
1350
1361
  z5.object({
1351
1362
  web: z5.object({ uri: z5.string(), title: z5.string().nullish() }).nullish(),
1352
1363
  retrievedContext: z5.object({
1353
- uri: z5.string(),
1364
+ uri: z5.string().nullish(),
1354
1365
  title: z5.string().nullish(),
1355
- text: z5.string().nullish()
1366
+ text: z5.string().nullish(),
1367
+ fileSearchStore: z5.string().nullish()
1356
1368
  }).nullish()
1357
1369
  })
1358
1370
  ).nullish(),