@ai-sdk/google 2.0.68 → 2.0.70

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 ? "2.0.68" : "0.0.0-test";
10
+ var VERSION = true ? "2.0.70" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -857,6 +857,7 @@ function prepareTools({
857
857
  };
858
858
  }
859
859
  const functionDeclarations = [];
860
+ let hasStrictTools = false;
860
861
  for (const tool of tools) {
861
862
  switch (tool.type) {
862
863
  case "function":
@@ -865,6 +866,9 @@ function prepareTools({
865
866
  description: (_a = tool.description) != null ? _a : "",
866
867
  parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
867
868
  });
869
+ if (tool.strict === true) {
870
+ hasStrictTools = true;
871
+ }
868
872
  break;
869
873
  default:
870
874
  toolWarnings.push({ type: "unsupported-tool", tool });
@@ -874,7 +878,7 @@ function prepareTools({
874
878
  if (toolChoice == null) {
875
879
  return {
876
880
  tools: [{ functionDeclarations }],
877
- toolConfig: void 0,
881
+ toolConfig: hasStrictTools ? { functionCallingConfig: { mode: "VALIDATED" } } : void 0,
878
882
  toolWarnings
879
883
  };
880
884
  }
@@ -883,7 +887,11 @@ function prepareTools({
883
887
  case "auto":
884
888
  return {
885
889
  tools: [{ functionDeclarations }],
886
- toolConfig: { functionCallingConfig: { mode: "AUTO" } },
890
+ toolConfig: {
891
+ functionCallingConfig: {
892
+ mode: hasStrictTools ? "VALIDATED" : "AUTO"
893
+ }
894
+ },
887
895
  toolWarnings
888
896
  };
889
897
  case "none":
@@ -895,7 +903,11 @@ function prepareTools({
895
903
  case "required":
896
904
  return {
897
905
  tools: [{ functionDeclarations }],
898
- toolConfig: { functionCallingConfig: { mode: "ANY" } },
906
+ toolConfig: {
907
+ functionCallingConfig: {
908
+ mode: hasStrictTools ? "VALIDATED" : "ANY"
909
+ }
910
+ },
899
911
  toolWarnings
900
912
  };
901
913
  case "tool":
@@ -903,7 +915,7 @@ function prepareTools({
903
915
  tools: [{ functionDeclarations }],
904
916
  toolConfig: {
905
917
  functionCallingConfig: {
906
- mode: "ANY",
918
+ mode: hasStrictTools ? "VALIDATED" : "ANY",
907
919
  allowedFunctionNames: [toolChoice.toolName]
908
920
  }
909
921
  },