@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/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.0-beta.86" : "0.0.0-test";
10
+ var VERSION = true ? "3.0.0-beta.88" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -472,6 +472,9 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
472
472
  systemMessagesAllowed = false;
473
473
  const parts = [];
474
474
  for (const part of content) {
475
+ if (part.type === "tool-approval-response") {
476
+ continue;
477
+ }
475
478
  const output = part.output;
476
479
  if (output.type === "content") {
477
480
  for (const contentPart of output.value) {
@@ -881,13 +884,12 @@ function mapGoogleGenerativeAIFinishReason({
881
884
  case "PROHIBITED_CONTENT":
882
885
  case "SPII":
883
886
  return "content-filter";
884
- case "FINISH_REASON_UNSPECIFIED":
885
- case "OTHER":
886
- return "other";
887
887
  case "MALFORMED_FUNCTION_CALL":
888
888
  return "error";
889
+ case "FINISH_REASON_UNSPECIFIED":
890
+ case "OTHER":
889
891
  default:
890
- return "unknown";
892
+ return "other";
891
893
  }
892
894
  }
893
895
 
@@ -1006,7 +1008,7 @@ var GoogleGenerativeAILanguageModel = class {
1006
1008
  };
1007
1009
  }
1008
1010
  async doGenerate(options) {
1009
- var _a, _b, _c, _d, _e, _f, _g, _h;
1011
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1010
1012
  const { args, warnings, providerOptionsName } = await this.getArgs(options);
1011
1013
  const mergedHeaders = combineHeaders2(
1012
1014
  await resolve2(this.config.headers),
@@ -1099,18 +1101,21 @@ var GoogleGenerativeAILanguageModel = class {
1099
1101
  }
1100
1102
  return {
1101
1103
  content,
1102
- finishReason: mapGoogleGenerativeAIFinishReason({
1103
- finishReason: candidate.finishReason,
1104
- hasToolCalls: content.some((part) => part.type === "tool-call")
1105
- }),
1104
+ finishReason: {
1105
+ unified: mapGoogleGenerativeAIFinishReason({
1106
+ finishReason: candidate.finishReason,
1107
+ hasToolCalls: content.some((part) => part.type === "tool-call")
1108
+ }),
1109
+ raw: (_e = candidate.finishReason) != null ? _e : void 0
1110
+ },
1106
1111
  usage: convertGoogleGenerativeAIUsage(usageMetadata),
1107
1112
  warnings,
1108
1113
  providerMetadata: {
1109
1114
  [providerOptionsName]: {
1110
- promptFeedback: (_e = response.promptFeedback) != null ? _e : null,
1111
- groundingMetadata: (_f = candidate.groundingMetadata) != null ? _f : null,
1112
- urlContextMetadata: (_g = candidate.urlContextMetadata) != null ? _g : null,
1113
- safetyRatings: (_h = candidate.safetyRatings) != null ? _h : null,
1115
+ promptFeedback: (_f = response.promptFeedback) != null ? _f : null,
1116
+ groundingMetadata: (_g = candidate.groundingMetadata) != null ? _g : null,
1117
+ urlContextMetadata: (_h = candidate.urlContextMetadata) != null ? _h : null,
1118
+ safetyRatings: (_i = candidate.safetyRatings) != null ? _i : null,
1114
1119
  usageMetadata: usageMetadata != null ? usageMetadata : null
1115
1120
  }
1116
1121
  },
@@ -1139,7 +1144,10 @@ var GoogleGenerativeAILanguageModel = class {
1139
1144
  abortSignal: options.abortSignal,
1140
1145
  fetch: this.config.fetch
1141
1146
  });
1142
- let finishReason = "unknown";
1147
+ let finishReason = {
1148
+ unified: "other",
1149
+ raw: void 0
1150
+ };
1143
1151
  let usage = void 0;
1144
1152
  let providerMetadata = void 0;
1145
1153
  const generateId3 = this.config.generateId;
@@ -1320,10 +1328,13 @@ var GoogleGenerativeAILanguageModel = class {
1320
1328
  }
1321
1329
  }
1322
1330
  if (candidate.finishReason != null) {
1323
- finishReason = mapGoogleGenerativeAIFinishReason({
1324
- finishReason: candidate.finishReason,
1325
- hasToolCalls
1326
- });
1331
+ finishReason = {
1332
+ unified: mapGoogleGenerativeAIFinishReason({
1333
+ finishReason: candidate.finishReason,
1334
+ hasToolCalls
1335
+ }),
1336
+ raw: candidate.finishReason
1337
+ };
1327
1338
  providerMetadata = {
1328
1339
  [providerOptionsName]: {
1329
1340
  promptFeedback: (_d = value.promptFeedback) != null ? _d : null,