@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/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 ? "3.0.0-beta.55" : "0.0.0-test";
10
+ var VERSION = true ? "3.0.0-beta.57" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -1275,7 +1275,7 @@ function extractSources({
1275
1275
  groundingMetadata,
1276
1276
  generateId: generateId3
1277
1277
  }) {
1278
- var _a, _b, _c;
1278
+ var _a, _b, _c, _d;
1279
1279
  if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
1280
1280
  return void 0;
1281
1281
  }
@@ -1291,7 +1291,8 @@ function extractSources({
1291
1291
  });
1292
1292
  } else if (chunk.retrievedContext != null) {
1293
1293
  const uri = chunk.retrievedContext.uri;
1294
- if (uri.startsWith("http://") || uri.startsWith("https://")) {
1294
+ const fileSearchStore = chunk.retrievedContext.fileSearchStore;
1295
+ if (uri && (uri.startsWith("http://") || uri.startsWith("https://"))) {
1295
1296
  sources.push({
1296
1297
  type: "source",
1297
1298
  sourceType: "url",
@@ -1299,7 +1300,7 @@ function extractSources({
1299
1300
  url: uri,
1300
1301
  title: (_b = chunk.retrievedContext.title) != null ? _b : void 0
1301
1302
  });
1302
- } else {
1303
+ } else if (uri) {
1303
1304
  const title = (_c = chunk.retrievedContext.title) != null ? _c : "Unknown Document";
1304
1305
  let mediaType = "application/octet-stream";
1305
1306
  let filename = void 0;
@@ -1329,6 +1330,16 @@ function extractSources({
1329
1330
  title,
1330
1331
  filename
1331
1332
  });
1333
+ } else if (fileSearchStore) {
1334
+ const title = (_d = chunk.retrievedContext.title) != null ? _d : "Unknown Document";
1335
+ sources.push({
1336
+ type: "source",
1337
+ sourceType: "document",
1338
+ id: generateId3(),
1339
+ mediaType: "application/octet-stream",
1340
+ title,
1341
+ filename: fileSearchStore.split("/").pop()
1342
+ });
1332
1343
  }
1333
1344
  }
1334
1345
  }
@@ -1342,9 +1353,10 @@ var getGroundingMetadataSchema = () => z5.object({
1342
1353
  z5.object({
1343
1354
  web: z5.object({ uri: z5.string(), title: z5.string().nullish() }).nullish(),
1344
1355
  retrievedContext: z5.object({
1345
- uri: z5.string(),
1356
+ uri: z5.string().nullish(),
1346
1357
  title: z5.string().nullish(),
1347
- text: z5.string().nullish()
1358
+ text: z5.string().nullish(),
1359
+ fileSearchStore: z5.string().nullish()
1348
1360
  }).nullish()
1349
1361
  })
1350
1362
  ).nullish(),