@ai-sdk/google 3.0.0-beta.86 → 3.0.0-beta.88

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,23 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.0-beta.88
4
+
5
+ ### Patch Changes
6
+
7
+ - 2625a04: feat(openai); update spec for mcp approval
8
+ - Updated dependencies [2625a04]
9
+ - @ai-sdk/provider@3.0.0-beta.31
10
+ - @ai-sdk/provider-utils@4.0.0-beta.58
11
+
12
+ ## 3.0.0-beta.87
13
+
14
+ ### Patch Changes
15
+
16
+ - cbf52cd: feat: expose raw finish reason
17
+ - Updated dependencies [cbf52cd]
18
+ - @ai-sdk/provider@3.0.0-beta.30
19
+ - @ai-sdk/provider-utils@4.0.0-beta.57
20
+
3
21
  ## 3.0.0-beta.86
4
22
 
5
23
  ### 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 ? "3.0.0-beta.86" : "0.0.0-test";
33
+ var VERSION = true ? "3.0.0-beta.88" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -466,6 +466,9 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
466
466
  systemMessagesAllowed = false;
467
467
  const parts = [];
468
468
  for (const part of content) {
469
+ if (part.type === "tool-approval-response") {
470
+ continue;
471
+ }
469
472
  const output = part.output;
470
473
  if (output.type === "content") {
471
474
  for (const contentPart of output.value) {
@@ -873,13 +876,12 @@ function mapGoogleGenerativeAIFinishReason({
873
876
  case "PROHIBITED_CONTENT":
874
877
  case "SPII":
875
878
  return "content-filter";
876
- case "FINISH_REASON_UNSPECIFIED":
877
- case "OTHER":
878
- return "other";
879
879
  case "MALFORMED_FUNCTION_CALL":
880
880
  return "error";
881
+ case "FINISH_REASON_UNSPECIFIED":
882
+ case "OTHER":
881
883
  default:
882
- return "unknown";
884
+ return "other";
883
885
  }
884
886
  }
885
887
 
@@ -998,7 +1000,7 @@ var GoogleGenerativeAILanguageModel = class {
998
1000
  };
999
1001
  }
1000
1002
  async doGenerate(options) {
1001
- var _a, _b, _c, _d, _e, _f, _g, _h;
1003
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1002
1004
  const { args, warnings, providerOptionsName } = await this.getArgs(options);
1003
1005
  const mergedHeaders = (0, import_provider_utils6.combineHeaders)(
1004
1006
  await (0, import_provider_utils6.resolve)(this.config.headers),
@@ -1091,18 +1093,21 @@ var GoogleGenerativeAILanguageModel = class {
1091
1093
  }
1092
1094
  return {
1093
1095
  content,
1094
- finishReason: mapGoogleGenerativeAIFinishReason({
1095
- finishReason: candidate.finishReason,
1096
- hasToolCalls: content.some((part) => part.type === "tool-call")
1097
- }),
1096
+ finishReason: {
1097
+ unified: mapGoogleGenerativeAIFinishReason({
1098
+ finishReason: candidate.finishReason,
1099
+ hasToolCalls: content.some((part) => part.type === "tool-call")
1100
+ }),
1101
+ raw: (_e = candidate.finishReason) != null ? _e : void 0
1102
+ },
1098
1103
  usage: convertGoogleGenerativeAIUsage(usageMetadata),
1099
1104
  warnings,
1100
1105
  providerMetadata: {
1101
1106
  [providerOptionsName]: {
1102
- promptFeedback: (_e = response.promptFeedback) != null ? _e : null,
1103
- groundingMetadata: (_f = candidate.groundingMetadata) != null ? _f : null,
1104
- urlContextMetadata: (_g = candidate.urlContextMetadata) != null ? _g : null,
1105
- safetyRatings: (_h = candidate.safetyRatings) != null ? _h : null,
1107
+ promptFeedback: (_f = response.promptFeedback) != null ? _f : null,
1108
+ groundingMetadata: (_g = candidate.groundingMetadata) != null ? _g : null,
1109
+ urlContextMetadata: (_h = candidate.urlContextMetadata) != null ? _h : null,
1110
+ safetyRatings: (_i = candidate.safetyRatings) != null ? _i : null,
1106
1111
  usageMetadata: usageMetadata != null ? usageMetadata : null
1107
1112
  }
1108
1113
  },
@@ -1131,7 +1136,10 @@ var GoogleGenerativeAILanguageModel = class {
1131
1136
  abortSignal: options.abortSignal,
1132
1137
  fetch: this.config.fetch
1133
1138
  });
1134
- let finishReason = "unknown";
1139
+ let finishReason = {
1140
+ unified: "other",
1141
+ raw: void 0
1142
+ };
1135
1143
  let usage = void 0;
1136
1144
  let providerMetadata = void 0;
1137
1145
  const generateId3 = this.config.generateId;
@@ -1312,10 +1320,13 @@ var GoogleGenerativeAILanguageModel = class {
1312
1320
  }
1313
1321
  }
1314
1322
  if (candidate.finishReason != null) {
1315
- finishReason = mapGoogleGenerativeAIFinishReason({
1316
- finishReason: candidate.finishReason,
1317
- hasToolCalls
1318
- });
1323
+ finishReason = {
1324
+ unified: mapGoogleGenerativeAIFinishReason({
1325
+ finishReason: candidate.finishReason,
1326
+ hasToolCalls
1327
+ }),
1328
+ raw: candidate.finishReason
1329
+ };
1319
1330
  providerMetadata = {
1320
1331
  [providerOptionsName]: {
1321
1332
  promptFeedback: (_d = value.promptFeedback) != null ? _d : null,