@ai-sdk/google 2.0.57 → 2.0.59

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.57" : "0.0.0-test";
10
+ var VERSION = true ? "2.0.59" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -1107,6 +1107,8 @@ var GoogleGenerativeAILanguageModel = class {
1107
1107
  totalTokens: void 0
1108
1108
  };
1109
1109
  let providerMetadata = void 0;
1110
+ let lastGroundingMetadata = null;
1111
+ let lastUrlContextMetadata = null;
1110
1112
  const generateId3 = this.config.generateId;
1111
1113
  let hasToolCalls = false;
1112
1114
  let currentTextBlockId = null;
@@ -1121,7 +1123,7 @@ var GoogleGenerativeAILanguageModel = class {
1121
1123
  controller.enqueue({ type: "stream-start", warnings });
1122
1124
  },
1123
1125
  transform(chunk, controller) {
1124
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1126
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
1125
1127
  if (options.includeRawChunks) {
1126
1128
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
1127
1129
  }
@@ -1143,6 +1145,12 @@ var GoogleGenerativeAILanguageModel = class {
1143
1145
  return;
1144
1146
  }
1145
1147
  const content = candidate.content;
1148
+ if (candidate.groundingMetadata != null) {
1149
+ lastGroundingMetadata = candidate.groundingMetadata;
1150
+ }
1151
+ if (candidate.urlContextMetadata != null) {
1152
+ lastUrlContextMetadata = candidate.urlContextMetadata;
1153
+ }
1146
1154
  const sources = extractSources({
1147
1155
  groundingMetadata: candidate.groundingMetadata,
1148
1156
  generateId: generateId3
@@ -1294,9 +1302,9 @@ var GoogleGenerativeAILanguageModel = class {
1294
1302
  providerMetadata = {
1295
1303
  google: {
1296
1304
  promptFeedback: (_i = value.promptFeedback) != null ? _i : null,
1297
- groundingMetadata: (_j = candidate.groundingMetadata) != null ? _j : null,
1298
- urlContextMetadata: (_k = candidate.urlContextMetadata) != null ? _k : null,
1299
- safetyRatings: (_l = candidate.safetyRatings) != null ? _l : null
1305
+ groundingMetadata: lastGroundingMetadata,
1306
+ urlContextMetadata: lastUrlContextMetadata,
1307
+ safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null
1300
1308
  }
1301
1309
  };
1302
1310
  if (usageMetadata != null) {