@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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 2.0.53
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [20565b8]
8
+ - @ai-sdk/provider-utils@3.0.21
9
+
10
+ ## 2.0.52
11
+
12
+ ### Patch Changes
13
+
14
+ - 526fe8d: fix: trigger new release for `@ai-v5` dist-tag
15
+ - Updated dependencies [526fe8d]
16
+ - @ai-sdk/provider@2.0.1
17
+ - @ai-sdk/provider-utils@3.0.20
18
+
3
19
  ## 2.0.51
4
20
 
5
21
  ### Patch Changes
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(src_exports);
30
30
  var import_provider_utils15 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/version.ts
33
- var VERSION = true ? "2.0.51" : "0.0.0-test";
33
+ var VERSION = true ? "2.0.53" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -1003,12 +1003,22 @@ var GoogleGenerativeAILanguageModel = class {
1003
1003
  providerExecuted: true
1004
1004
  });
1005
1005
  lastCodeExecutionToolCallId = void 0;
1006
- } else if ("text" in part && part.text != null && part.text.length > 0) {
1007
- content.push({
1008
- type: part.thought === true ? "reasoning" : "text",
1009
- text: part.text,
1010
- providerMetadata: part.thoughtSignature ? { google: { thoughtSignature: part.thoughtSignature } } : void 0
1011
- });
1006
+ } else if ("text" in part && part.text != null) {
1007
+ const thoughtSignatureMetadata = part.thoughtSignature ? { google: { thoughtSignature: part.thoughtSignature } } : void 0;
1008
+ if (part.text.length === 0) {
1009
+ if (thoughtSignatureMetadata != null && content.length > 0) {
1010
+ const lastContent = content[content.length - 1];
1011
+ if (lastContent.type !== "file") {
1012
+ lastContent.providerMetadata = thoughtSignatureMetadata;
1013
+ }
1014
+ }
1015
+ } else {
1016
+ content.push({
1017
+ type: part.thought === true ? "reasoning" : "text",
1018
+ text: part.text,
1019
+ providerMetadata: thoughtSignatureMetadata
1020
+ });
1021
+ }
1012
1022
  } else if ("functionCall" in part) {
1013
1023
  content.push({
1014
1024
  type: "tool-call",
@@ -1165,8 +1175,22 @@ var GoogleGenerativeAILanguageModel = class {
1165
1175
  });
1166
1176
  lastCodeExecutionToolCallId = void 0;
1167
1177
  }
1168
- } else if ("text" in part && part.text != null && part.text.length > 0) {
1169
- if (part.thought === true) {
1178
+ } else if ("text" in part && part.text != null) {
1179
+ const thoughtSignatureMetadata = part.thoughtSignature ? {
1180
+ google: {
1181
+ thoughtSignature: part.thoughtSignature
1182
+ }
1183
+ } : void 0;
1184
+ if (part.text.length === 0) {
1185
+ if (thoughtSignatureMetadata != null && currentTextBlockId !== null) {
1186
+ controller.enqueue({
1187
+ type: "text-delta",
1188
+ id: currentTextBlockId,
1189
+ delta: "",
1190
+ providerMetadata: thoughtSignatureMetadata
1191
+ });
1192
+ }
1193
+ } else if (part.thought === true) {
1170
1194
  if (currentTextBlockId !== null) {
1171
1195
  controller.enqueue({
1172
1196
  type: "text-end",
@@ -1179,20 +1203,14 @@ var GoogleGenerativeAILanguageModel = class {
1179
1203
  controller.enqueue({
1180
1204
  type: "reasoning-start",
1181
1205
  id: currentReasoningBlockId,
1182
- providerMetadata: part.thoughtSignature ? {
1183
- google: {
1184
- thoughtSignature: part.thoughtSignature
1185
- }
1186
- } : void 0
1206
+ providerMetadata: thoughtSignatureMetadata
1187
1207
  });
1188
1208
  }
1189
1209
  controller.enqueue({
1190
1210
  type: "reasoning-delta",
1191
1211
  id: currentReasoningBlockId,
1192
1212
  delta: part.text,
1193
- providerMetadata: part.thoughtSignature ? {
1194
- google: { thoughtSignature: part.thoughtSignature }
1195
- } : void 0
1213
+ providerMetadata: thoughtSignatureMetadata
1196
1214
  });
1197
1215
  } else {
1198
1216
  if (currentReasoningBlockId !== null) {
@@ -1207,20 +1225,14 @@ var GoogleGenerativeAILanguageModel = class {
1207
1225
  controller.enqueue({
1208
1226
  type: "text-start",
1209
1227
  id: currentTextBlockId,
1210
- providerMetadata: part.thoughtSignature ? {
1211
- google: {
1212
- thoughtSignature: part.thoughtSignature
1213
- }
1214
- } : void 0
1228
+ providerMetadata: thoughtSignatureMetadata
1215
1229
  });
1216
1230
  }
1217
1231
  controller.enqueue({
1218
1232
  type: "text-delta",
1219
1233
  id: currentTextBlockId,
1220
1234
  delta: part.text,
1221
- providerMetadata: part.thoughtSignature ? {
1222
- google: { thoughtSignature: part.thoughtSignature }
1223
- } : void 0
1235
+ providerMetadata: thoughtSignatureMetadata
1224
1236
  });
1225
1237
  }
1226
1238
  } else if ("inlineData" in part) {