@ai-sdk/google 3.0.96 → 3.0.98

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.
@@ -1455,7 +1455,7 @@ var GoogleGenerativeAILanguageModel = class {
1455
1455
  };
1456
1456
  }
1457
1457
  async doGenerate(options) {
1458
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
1458
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
1459
1459
  const { args, warnings, providerOptionsName, extraHeaders } = await this.getArgs(options);
1460
1460
  const mergedHeaders = combineHeaders(
1461
1461
  await resolve(this.config.headers),
@@ -1629,7 +1629,8 @@ var GoogleGenerativeAILanguageModel = class {
1629
1629
  },
1630
1630
  request: { body: args },
1631
1631
  response: {
1632
- // TODO timestamp, model id, id
1632
+ // TODO timestamp, model id
1633
+ id: (_s = response.responseId) != null ? _s : void 0,
1633
1634
  headers: responseHeaders,
1634
1635
  body: rawResponse
1635
1636
  }
@@ -1663,6 +1664,7 @@ var GoogleGenerativeAILanguageModel = class {
1663
1664
  let lastUrlContextMetadata = null;
1664
1665
  const generateId2 = this.config.generateId;
1665
1666
  let hasToolCalls = false;
1667
+ let hasEmittedResponseMetadata = false;
1666
1668
  let currentTextBlockId = null;
1667
1669
  let currentReasoningBlockId = null;
1668
1670
  let blockCounter = 0;
@@ -1714,6 +1716,13 @@ var GoogleGenerativeAILanguageModel = class {
1714
1716
  return;
1715
1717
  }
1716
1718
  const value = chunk.value;
1719
+ if (!hasEmittedResponseMetadata && value.responseId != null) {
1720
+ hasEmittedResponseMetadata = true;
1721
+ controller.enqueue({
1722
+ type: "response-metadata",
1723
+ id: value.responseId
1724
+ });
1725
+ }
1717
1726
  const usageMetadata = value.usageMetadata;
1718
1727
  if (usageMetadata != null) {
1719
1728
  usage = usageMetadata;
@@ -2299,6 +2308,7 @@ var getUrlContextMetadataSchema = () => z3.object({
2299
2308
  var responseSchema = lazySchema3(
2300
2309
  () => zodSchema3(
2301
2310
  z3.object({
2311
+ responseId: z3.string().nullish(),
2302
2312
  candidates: z3.array(
2303
2313
  z3.object({
2304
2314
  content: getContentSchema().nullish().or(z3.object({}).strict()),
@@ -2320,6 +2330,7 @@ var responseSchema = lazySchema3(
2320
2330
  var chunkSchema = lazySchema3(
2321
2331
  () => zodSchema3(
2322
2332
  z3.object({
2333
+ responseId: z3.string().nullish(),
2323
2334
  candidates: z3.array(
2324
2335
  z3.object({
2325
2336
  content: getContentSchema().nullish(),