@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.
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.96" : "0.0.0-test";
10
+ var VERSION = true ? "3.0.97" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -1672,7 +1672,7 @@ var GoogleGenerativeAILanguageModel = class {
1672
1672
  };
1673
1673
  }
1674
1674
  async doGenerate(options) {
1675
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
1675
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
1676
1676
  const { args, warnings, providerOptionsName, extraHeaders } = await this.getArgs(options);
1677
1677
  const mergedHeaders = combineHeaders2(
1678
1678
  await resolve2(this.config.headers),
@@ -1846,7 +1846,8 @@ var GoogleGenerativeAILanguageModel = class {
1846
1846
  },
1847
1847
  request: { body: args },
1848
1848
  response: {
1849
- // TODO timestamp, model id, id
1849
+ // TODO timestamp, model id
1850
+ id: (_s = response.responseId) != null ? _s : void 0,
1850
1851
  headers: responseHeaders,
1851
1852
  body: rawResponse
1852
1853
  }
@@ -1880,6 +1881,7 @@ var GoogleGenerativeAILanguageModel = class {
1880
1881
  let lastUrlContextMetadata = null;
1881
1882
  const generateId3 = this.config.generateId;
1882
1883
  let hasToolCalls = false;
1884
+ let hasEmittedResponseMetadata = false;
1883
1885
  let currentTextBlockId = null;
1884
1886
  let currentReasoningBlockId = null;
1885
1887
  let blockCounter = 0;
@@ -1931,6 +1933,13 @@ var GoogleGenerativeAILanguageModel = class {
1931
1933
  return;
1932
1934
  }
1933
1935
  const value = chunk.value;
1936
+ if (!hasEmittedResponseMetadata && value.responseId != null) {
1937
+ hasEmittedResponseMetadata = true;
1938
+ controller.enqueue({
1939
+ type: "response-metadata",
1940
+ id: value.responseId
1941
+ });
1942
+ }
1934
1943
  const usageMetadata = value.usageMetadata;
1935
1944
  if (usageMetadata != null) {
1936
1945
  usage = usageMetadata;
@@ -2516,6 +2525,7 @@ var getUrlContextMetadataSchema = () => z5.object({
2516
2525
  var responseSchema = lazySchema5(
2517
2526
  () => zodSchema5(
2518
2527
  z5.object({
2528
+ responseId: z5.string().nullish(),
2519
2529
  candidates: z5.array(
2520
2530
  z5.object({
2521
2531
  content: getContentSchema().nullish().or(z5.object({}).strict()),
@@ -2537,6 +2547,7 @@ var responseSchema = lazySchema5(
2537
2547
  var chunkSchema = lazySchema5(
2538
2548
  () => zodSchema5(
2539
2549
  z5.object({
2550
+ responseId: z5.string().nullish(),
2540
2551
  candidates: z5.array(
2541
2552
  z5.object({
2542
2553
  content: getContentSchema().nullish(),