@ai-sdk/google 2.0.51 → 2.0.53

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.51" : "0.0.0-test";
10
+ var VERSION = true ? "2.0.53" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -1014,12 +1014,22 @@ var GoogleGenerativeAILanguageModel = class {
1014
1014
  providerExecuted: true
1015
1015
  });
1016
1016
  lastCodeExecutionToolCallId = void 0;
1017
- } else if ("text" in part && part.text != null && part.text.length > 0) {
1018
- content.push({
1019
- type: part.thought === true ? "reasoning" : "text",
1020
- text: part.text,
1021
- providerMetadata: part.thoughtSignature ? { google: { thoughtSignature: part.thoughtSignature } } : void 0
1022
- });
1017
+ } else if ("text" in part && part.text != null) {
1018
+ const thoughtSignatureMetadata = part.thoughtSignature ? { google: { thoughtSignature: part.thoughtSignature } } : void 0;
1019
+ if (part.text.length === 0) {
1020
+ if (thoughtSignatureMetadata != null && content.length > 0) {
1021
+ const lastContent = content[content.length - 1];
1022
+ if (lastContent.type !== "file") {
1023
+ lastContent.providerMetadata = thoughtSignatureMetadata;
1024
+ }
1025
+ }
1026
+ } else {
1027
+ content.push({
1028
+ type: part.thought === true ? "reasoning" : "text",
1029
+ text: part.text,
1030
+ providerMetadata: thoughtSignatureMetadata
1031
+ });
1032
+ }
1023
1033
  } else if ("functionCall" in part) {
1024
1034
  content.push({
1025
1035
  type: "tool-call",
@@ -1176,8 +1186,22 @@ var GoogleGenerativeAILanguageModel = class {
1176
1186
  });
1177
1187
  lastCodeExecutionToolCallId = void 0;
1178
1188
  }
1179
- } else if ("text" in part && part.text != null && part.text.length > 0) {
1180
- if (part.thought === true) {
1189
+ } else if ("text" in part && part.text != null) {
1190
+ const thoughtSignatureMetadata = part.thoughtSignature ? {
1191
+ google: {
1192
+ thoughtSignature: part.thoughtSignature
1193
+ }
1194
+ } : void 0;
1195
+ if (part.text.length === 0) {
1196
+ if (thoughtSignatureMetadata != null && currentTextBlockId !== null) {
1197
+ controller.enqueue({
1198
+ type: "text-delta",
1199
+ id: currentTextBlockId,
1200
+ delta: "",
1201
+ providerMetadata: thoughtSignatureMetadata
1202
+ });
1203
+ }
1204
+ } else if (part.thought === true) {
1181
1205
  if (currentTextBlockId !== null) {
1182
1206
  controller.enqueue({
1183
1207
  type: "text-end",
@@ -1190,20 +1214,14 @@ var GoogleGenerativeAILanguageModel = class {
1190
1214
  controller.enqueue({
1191
1215
  type: "reasoning-start",
1192
1216
  id: currentReasoningBlockId,
1193
- providerMetadata: part.thoughtSignature ? {
1194
- google: {
1195
- thoughtSignature: part.thoughtSignature
1196
- }
1197
- } : void 0
1217
+ providerMetadata: thoughtSignatureMetadata
1198
1218
  });
1199
1219
  }
1200
1220
  controller.enqueue({
1201
1221
  type: "reasoning-delta",
1202
1222
  id: currentReasoningBlockId,
1203
1223
  delta: part.text,
1204
- providerMetadata: part.thoughtSignature ? {
1205
- google: { thoughtSignature: part.thoughtSignature }
1206
- } : void 0
1224
+ providerMetadata: thoughtSignatureMetadata
1207
1225
  });
1208
1226
  } else {
1209
1227
  if (currentReasoningBlockId !== null) {
@@ -1218,20 +1236,14 @@ var GoogleGenerativeAILanguageModel = class {
1218
1236
  controller.enqueue({
1219
1237
  type: "text-start",
1220
1238
  id: currentTextBlockId,
1221
- providerMetadata: part.thoughtSignature ? {
1222
- google: {
1223
- thoughtSignature: part.thoughtSignature
1224
- }
1225
- } : void 0
1239
+ providerMetadata: thoughtSignatureMetadata
1226
1240
  });
1227
1241
  }
1228
1242
  controller.enqueue({
1229
1243
  type: "text-delta",
1230
1244
  id: currentTextBlockId,
1231
1245
  delta: part.text,
1232
- providerMetadata: part.thoughtSignature ? {
1233
- google: { thoughtSignature: part.thoughtSignature }
1234
- } : void 0
1246
+ providerMetadata: thoughtSignatureMetadata
1235
1247
  });
1236
1248
  }
1237
1249
  } else if ("inlineData" in part) {