@ai-sdk/google 3.0.43 → 4.0.0-beta.1

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.43" : "0.0.0-test";
10
+ var VERSION = true ? "4.0.0-beta.1" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -803,6 +803,7 @@ function prepareTools({
803
803
  };
804
804
  }
805
805
  const functionDeclarations = [];
806
+ let hasStrictTools = false;
806
807
  for (const tool of tools) {
807
808
  switch (tool.type) {
808
809
  case "function":
@@ -811,6 +812,9 @@ function prepareTools({
811
812
  description: (_a = tool.description) != null ? _a : "",
812
813
  parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
813
814
  });
815
+ if (tool.strict === true) {
816
+ hasStrictTools = true;
817
+ }
814
818
  break;
815
819
  default:
816
820
  toolWarnings.push({
@@ -823,7 +827,7 @@ function prepareTools({
823
827
  if (toolChoice == null) {
824
828
  return {
825
829
  tools: [{ functionDeclarations }],
826
- toolConfig: void 0,
830
+ toolConfig: hasStrictTools ? { functionCallingConfig: { mode: "VALIDATED" } } : void 0,
827
831
  toolWarnings
828
832
  };
829
833
  }
@@ -832,7 +836,11 @@ function prepareTools({
832
836
  case "auto":
833
837
  return {
834
838
  tools: [{ functionDeclarations }],
835
- toolConfig: { functionCallingConfig: { mode: "AUTO" } },
839
+ toolConfig: {
840
+ functionCallingConfig: {
841
+ mode: hasStrictTools ? "VALIDATED" : "AUTO"
842
+ }
843
+ },
836
844
  toolWarnings
837
845
  };
838
846
  case "none":
@@ -844,7 +852,11 @@ function prepareTools({
844
852
  case "required":
845
853
  return {
846
854
  tools: [{ functionDeclarations }],
847
- toolConfig: { functionCallingConfig: { mode: "ANY" } },
855
+ toolConfig: {
856
+ functionCallingConfig: {
857
+ mode: hasStrictTools ? "VALIDATED" : "ANY"
858
+ }
859
+ },
848
860
  toolWarnings
849
861
  };
850
862
  case "tool":
@@ -852,7 +864,7 @@ function prepareTools({
852
864
  tools: [{ functionDeclarations }],
853
865
  toolConfig: {
854
866
  functionCallingConfig: {
855
- mode: "ANY",
867
+ mode: hasStrictTools ? "VALIDATED" : "ANY",
856
868
  allowedFunctionNames: [toolChoice.toolName]
857
869
  }
858
870
  },