@ai-sdk/google 3.0.96 → 3.0.97

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.
@@ -199,6 +199,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
199
199
  }[] | null | undefined;
200
200
  } | null | undefined;
201
201
  }[];
202
+ responseId?: string | null | undefined;
202
203
  usageMetadata?: {
203
204
  cachedContentTokenCount?: number | null | undefined;
204
205
  thoughtsTokenCount?: number | null | undefined;
@@ -199,6 +199,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
199
199
  }[] | null | undefined;
200
200
  } | null | undefined;
201
201
  }[];
202
+ responseId?: string | null | undefined;
202
203
  usageMetadata?: {
203
204
  cachedContentTokenCount?: number | null | undefined;
204
205
  thoughtsTokenCount?: number | null | undefined;
@@ -1464,7 +1464,7 @@ var GoogleGenerativeAILanguageModel = class {
1464
1464
  };
1465
1465
  }
1466
1466
  async doGenerate(options) {
1467
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
1467
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
1468
1468
  const { args, warnings, providerOptionsName, extraHeaders } = await this.getArgs(options);
1469
1469
  const mergedHeaders = (0, import_provider_utils4.combineHeaders)(
1470
1470
  await (0, import_provider_utils4.resolve)(this.config.headers),
@@ -1638,7 +1638,8 @@ var GoogleGenerativeAILanguageModel = class {
1638
1638
  },
1639
1639
  request: { body: args },
1640
1640
  response: {
1641
- // TODO timestamp, model id, id
1641
+ // TODO timestamp, model id
1642
+ id: (_s = response.responseId) != null ? _s : void 0,
1642
1643
  headers: responseHeaders,
1643
1644
  body: rawResponse
1644
1645
  }
@@ -1672,6 +1673,7 @@ var GoogleGenerativeAILanguageModel = class {
1672
1673
  let lastUrlContextMetadata = null;
1673
1674
  const generateId2 = this.config.generateId;
1674
1675
  let hasToolCalls = false;
1676
+ let hasEmittedResponseMetadata = false;
1675
1677
  let currentTextBlockId = null;
1676
1678
  let currentReasoningBlockId = null;
1677
1679
  let blockCounter = 0;
@@ -1723,6 +1725,13 @@ var GoogleGenerativeAILanguageModel = class {
1723
1725
  return;
1724
1726
  }
1725
1727
  const value = chunk.value;
1728
+ if (!hasEmittedResponseMetadata && value.responseId != null) {
1729
+ hasEmittedResponseMetadata = true;
1730
+ controller.enqueue({
1731
+ type: "response-metadata",
1732
+ id: value.responseId
1733
+ });
1734
+ }
1726
1735
  const usageMetadata = value.usageMetadata;
1727
1736
  if (usageMetadata != null) {
1728
1737
  usage = usageMetadata;
@@ -2308,6 +2317,7 @@ var getUrlContextMetadataSchema = () => import_v43.z.object({
2308
2317
  var responseSchema = (0, import_provider_utils4.lazySchema)(
2309
2318
  () => (0, import_provider_utils4.zodSchema)(
2310
2319
  import_v43.z.object({
2320
+ responseId: import_v43.z.string().nullish(),
2311
2321
  candidates: import_v43.z.array(
2312
2322
  import_v43.z.object({
2313
2323
  content: getContentSchema().nullish().or(import_v43.z.object({}).strict()),
@@ -2329,6 +2339,7 @@ var responseSchema = (0, import_provider_utils4.lazySchema)(
2329
2339
  var chunkSchema = (0, import_provider_utils4.lazySchema)(
2330
2340
  () => (0, import_provider_utils4.zodSchema)(
2331
2341
  import_v43.z.object({
2342
+ responseId: import_v43.z.string().nullish(),
2332
2343
  candidates: import_v43.z.array(
2333
2344
  import_v43.z.object({
2334
2345
  content: getContentSchema().nullish(),