@ai-sdk/google 3.0.23 → 3.0.24

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.23" : "0.0.0-test";
10
+ var VERSION = true ? "3.0.24" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -1059,16 +1059,24 @@ var GoogleGenerativeAILanguageModel = class {
1059
1059
  }
1060
1060
  });
1061
1061
  lastCodeExecutionToolCallId = void 0;
1062
- } else if ("text" in part && part.text != null && part.text.length > 0) {
1063
- content.push({
1064
- type: part.thought === true ? "reasoning" : "text",
1065
- text: part.text,
1066
- providerMetadata: part.thoughtSignature ? {
1067
- [providerOptionsName]: {
1068
- thoughtSignature: part.thoughtSignature
1069
- }
1070
- } : void 0
1071
- });
1062
+ } else if ("text" in part && part.text != null) {
1063
+ const thoughtSignatureMetadata = part.thoughtSignature ? {
1064
+ [providerOptionsName]: {
1065
+ thoughtSignature: part.thoughtSignature
1066
+ }
1067
+ } : void 0;
1068
+ if (part.text.length === 0) {
1069
+ if (thoughtSignatureMetadata != null && content.length > 0) {
1070
+ const lastContent = content[content.length - 1];
1071
+ lastContent.providerMetadata = thoughtSignatureMetadata;
1072
+ }
1073
+ } else {
1074
+ content.push({
1075
+ type: part.thought === true ? "reasoning" : "text",
1076
+ text: part.text,
1077
+ providerMetadata: thoughtSignatureMetadata
1078
+ });
1079
+ }
1072
1080
  } else if ("functionCall" in part) {
1073
1081
  content.push({
1074
1082
  type: "tool-call",
@@ -1226,8 +1234,22 @@ var GoogleGenerativeAILanguageModel = class {
1226
1234
  });
1227
1235
  lastCodeExecutionToolCallId = void 0;
1228
1236
  }
1229
- } else if ("text" in part && part.text != null && part.text.length > 0) {
1230
- if (part.thought === true) {
1237
+ } else if ("text" in part && part.text != null) {
1238
+ const thoughtSignatureMetadata = part.thoughtSignature ? {
1239
+ [providerOptionsName]: {
1240
+ thoughtSignature: part.thoughtSignature
1241
+ }
1242
+ } : void 0;
1243
+ if (part.text.length === 0) {
1244
+ if (thoughtSignatureMetadata != null && currentTextBlockId !== null) {
1245
+ controller.enqueue({
1246
+ type: "text-delta",
1247
+ id: currentTextBlockId,
1248
+ delta: "",
1249
+ providerMetadata: thoughtSignatureMetadata
1250
+ });
1251
+ }
1252
+ } else if (part.thought === true) {
1231
1253
  if (currentTextBlockId !== null) {
1232
1254
  controller.enqueue({
1233
1255
  type: "text-end",
@@ -1240,22 +1262,14 @@ var GoogleGenerativeAILanguageModel = class {
1240
1262
  controller.enqueue({
1241
1263
  type: "reasoning-start",
1242
1264
  id: currentReasoningBlockId,
1243
- providerMetadata: part.thoughtSignature ? {
1244
- [providerOptionsName]: {
1245
- thoughtSignature: part.thoughtSignature
1246
- }
1247
- } : void 0
1265
+ providerMetadata: thoughtSignatureMetadata
1248
1266
  });
1249
1267
  }
1250
1268
  controller.enqueue({
1251
1269
  type: "reasoning-delta",
1252
1270
  id: currentReasoningBlockId,
1253
1271
  delta: part.text,
1254
- providerMetadata: part.thoughtSignature ? {
1255
- [providerOptionsName]: {
1256
- thoughtSignature: part.thoughtSignature
1257
- }
1258
- } : void 0
1272
+ providerMetadata: thoughtSignatureMetadata
1259
1273
  });
1260
1274
  } else {
1261
1275
  if (currentReasoningBlockId !== null) {
@@ -1270,22 +1284,14 @@ var GoogleGenerativeAILanguageModel = class {
1270
1284
  controller.enqueue({
1271
1285
  type: "text-start",
1272
1286
  id: currentTextBlockId,
1273
- providerMetadata: part.thoughtSignature ? {
1274
- [providerOptionsName]: {
1275
- thoughtSignature: part.thoughtSignature
1276
- }
1277
- } : void 0
1287
+ providerMetadata: thoughtSignatureMetadata
1278
1288
  });
1279
1289
  }
1280
1290
  controller.enqueue({
1281
1291
  type: "text-delta",
1282
1292
  id: currentTextBlockId,
1283
1293
  delta: part.text,
1284
- providerMetadata: part.thoughtSignature ? {
1285
- [providerOptionsName]: {
1286
- thoughtSignature: part.thoughtSignature
1287
- }
1288
- } : void 0
1294
+ providerMetadata: thoughtSignatureMetadata
1289
1295
  });
1290
1296
  }
1291
1297
  } else if ("inlineData" in part) {