@ai-sdk/google 3.0.44 → 3.0.46

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.44" : "0.0.0-test";
10
+ var VERSION = true ? "3.0.46" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -1173,6 +1173,8 @@ var GoogleGenerativeAILanguageModel = class {
1173
1173
  };
1174
1174
  let usage = void 0;
1175
1175
  let providerMetadata = void 0;
1176
+ let lastGroundingMetadata = null;
1177
+ let lastUrlContextMetadata = null;
1176
1178
  const generateId3 = this.config.generateId;
1177
1179
  let hasToolCalls = false;
1178
1180
  let currentTextBlockId = null;
@@ -1187,7 +1189,7 @@ var GoogleGenerativeAILanguageModel = class {
1187
1189
  controller.enqueue({ type: "stream-start", warnings });
1188
1190
  },
1189
1191
  transform(chunk, controller) {
1190
- var _a, _b, _c, _d, _e, _f, _g, _h;
1192
+ var _a, _b, _c, _d, _e, _f;
1191
1193
  if (options.includeRawChunks) {
1192
1194
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
1193
1195
  }
@@ -1205,6 +1207,12 @@ var GoogleGenerativeAILanguageModel = class {
1205
1207
  return;
1206
1208
  }
1207
1209
  const content = candidate.content;
1210
+ if (candidate.groundingMetadata != null) {
1211
+ lastGroundingMetadata = candidate.groundingMetadata;
1212
+ }
1213
+ if (candidate.urlContextMetadata != null) {
1214
+ lastUrlContextMetadata = candidate.urlContextMetadata;
1215
+ }
1208
1216
  const sources = extractSources({
1209
1217
  groundingMetadata: candidate.groundingMetadata,
1210
1218
  generateId: generateId3
@@ -1378,9 +1386,9 @@ var GoogleGenerativeAILanguageModel = class {
1378
1386
  providerMetadata = {
1379
1387
  [providerOptionsName]: {
1380
1388
  promptFeedback: (_e = value.promptFeedback) != null ? _e : null,
1381
- groundingMetadata: (_f = candidate.groundingMetadata) != null ? _f : null,
1382
- urlContextMetadata: (_g = candidate.urlContextMetadata) != null ? _g : null,
1383
- safetyRatings: (_h = candidate.safetyRatings) != null ? _h : null
1389
+ groundingMetadata: lastGroundingMetadata,
1390
+ urlContextMetadata: lastUrlContextMetadata,
1391
+ safetyRatings: (_f = candidate.safetyRatings) != null ? _f : null
1384
1392
  }
1385
1393
  };
1386
1394
  if (usageMetadata != null) {