@ai-sdk/google 2.0.67 → 2.0.68

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,11 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 2.0.68
4
+
5
+ ### Patch Changes
6
+
7
+ - 4c10694: fix(google): fix `serviceTier` to be correctly formatted for Vertex API
8
+
3
9
  ## 2.0.67
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_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.67" : "0.0.0-test";
33
+ var VERSION = true ? "2.0.68" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -703,6 +703,11 @@ var googleGenerativeAIProviderOptions = (0, import_provider_utils5.lazySchema)(
703
703
  })
704
704
  )
705
705
  );
706
+ var VertexServiceTierMap = {
707
+ standard: "SERVICE_TIER_STANDARD",
708
+ flex: "SERVICE_TIER_FLEX",
709
+ priority: "SERVICE_TIER_PRIORITY"
710
+ };
706
711
 
707
712
  // src/google-prepare-tools.ts
708
713
  var import_provider3 = require("@ai-sdk/provider");
@@ -967,14 +972,19 @@ var GoogleGenerativeAILanguageModel = class {
967
972
  providerOptions,
968
973
  schema: googleGenerativeAIProviderOptions
969
974
  });
975
+ const isVertexProvider = this.config.provider.startsWith("google.vertex.");
970
976
  if ((tools == null ? void 0 : tools.some(
971
977
  (tool) => tool.type === "provider-defined" && tool.id === "google.vertex_rag_store"
972
- )) && !this.config.provider.startsWith("google.vertex.")) {
978
+ )) && !isVertexProvider) {
973
979
  warnings.push({
974
980
  type: "other",
975
981
  message: `The 'vertex_rag_store' tool is only supported with the Google Vertex provider and might not be supported or could behave unexpectedly with the current Google provider (${this.config.provider}).`
976
982
  });
977
983
  }
984
+ let sanitizedServiceTier = googleOptions == null ? void 0 : googleOptions.serviceTier;
985
+ if ((googleOptions == null ? void 0 : googleOptions.serviceTier) && isVertexProvider) {
986
+ sanitizedServiceTier = VertexServiceTierMap[googleOptions.serviceTier];
987
+ }
978
988
  const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
979
989
  const supportsFunctionResponseParts = this.modelId.startsWith("gemini-3");
980
990
  const { contents, systemInstruction } = convertToGoogleGenerativeAIMessages(
@@ -1031,7 +1041,7 @@ var GoogleGenerativeAILanguageModel = class {
1031
1041
  } : googleToolConfig,
1032
1042
  cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
1033
1043
  labels: googleOptions == null ? void 0 : googleOptions.labels,
1034
- serviceTier: googleOptions == null ? void 0 : googleOptions.serviceTier
1044
+ serviceTier: sanitizedServiceTier
1035
1045
  },
1036
1046
  warnings: [...warnings, ...toolWarnings]
1037
1047
  };