@ai-sdk/google
Advanced tools
+6
-0
| # @ai-sdk/google | ||
| ## 4.0.0-beta.1 | ||
| ### Patch Changes | ||
| - 19b95f9: fix(google): use VALIDATED function calling mode when any tool has strict:true | ||
| ## 4.0.0-beta.0 | ||
@@ -4,0 +10,0 @@ |
@@ -641,2 +641,3 @@ "use strict"; | ||
| const functionDeclarations = []; | ||
| let hasStrictTools = false; | ||
| for (const tool of tools) { | ||
@@ -650,2 +651,5 @@ switch (tool.type) { | ||
| }); | ||
| if (tool.strict === true) { | ||
| hasStrictTools = true; | ||
| } | ||
| break; | ||
@@ -663,3 +667,3 @@ default: | ||
| tools: [{ functionDeclarations }], | ||
| toolConfig: void 0, | ||
| toolConfig: hasStrictTools ? { functionCallingConfig: { mode: "VALIDATED" } } : void 0, | ||
| toolWarnings | ||
@@ -673,3 +677,7 @@ }; | ||
| tools: [{ functionDeclarations }], | ||
| toolConfig: { functionCallingConfig: { mode: "AUTO" } }, | ||
| toolConfig: { | ||
| functionCallingConfig: { | ||
| mode: hasStrictTools ? "VALIDATED" : "AUTO" | ||
| } | ||
| }, | ||
| toolWarnings | ||
@@ -686,3 +694,7 @@ }; | ||
| tools: [{ functionDeclarations }], | ||
| toolConfig: { functionCallingConfig: { mode: "ANY" } }, | ||
| toolConfig: { | ||
| functionCallingConfig: { | ||
| mode: hasStrictTools ? "VALIDATED" : "ANY" | ||
| } | ||
| }, | ||
| toolWarnings | ||
@@ -695,3 +707,3 @@ }; | ||
| functionCallingConfig: { | ||
| mode: "ANY", | ||
| mode: hasStrictTools ? "VALIDATED" : "ANY", | ||
| allowedFunctionNames: [toolChoice.toolName] | ||
@@ -698,0 +710,0 @@ } |
@@ -630,2 +630,3 @@ // src/google-generative-ai-language-model.ts | ||
| const functionDeclarations = []; | ||
| let hasStrictTools = false; | ||
| for (const tool of tools) { | ||
@@ -639,2 +640,5 @@ switch (tool.type) { | ||
| }); | ||
| if (tool.strict === true) { | ||
| hasStrictTools = true; | ||
| } | ||
| break; | ||
@@ -652,3 +656,3 @@ default: | ||
| tools: [{ functionDeclarations }], | ||
| toolConfig: void 0, | ||
| toolConfig: hasStrictTools ? { functionCallingConfig: { mode: "VALIDATED" } } : void 0, | ||
| toolWarnings | ||
@@ -662,3 +666,7 @@ }; | ||
| tools: [{ functionDeclarations }], | ||
| toolConfig: { functionCallingConfig: { mode: "AUTO" } }, | ||
| toolConfig: { | ||
| functionCallingConfig: { | ||
| mode: hasStrictTools ? "VALIDATED" : "AUTO" | ||
| } | ||
| }, | ||
| toolWarnings | ||
@@ -675,3 +683,7 @@ }; | ||
| tools: [{ functionDeclarations }], | ||
| toolConfig: { functionCallingConfig: { mode: "ANY" } }, | ||
| toolConfig: { | ||
| functionCallingConfig: { | ||
| mode: hasStrictTools ? "VALIDATED" : "ANY" | ||
| } | ||
| }, | ||
| toolWarnings | ||
@@ -684,3 +696,3 @@ }; | ||
| functionCallingConfig: { | ||
| mode: "ANY", | ||
| mode: hasStrictTools ? "VALIDATED" : "ANY", | ||
| allowedFunctionNames: [toolChoice.toolName] | ||
@@ -687,0 +699,0 @@ } |
+3
-3
| { | ||
| "name": "@ai-sdk/google", | ||
| "version": "4.0.0-beta.0", | ||
| "version": "4.0.0-beta.1", | ||
| "license": "Apache-2.0", | ||
@@ -39,4 +39,4 @@ "sideEffects": false, | ||
| "dependencies": { | ||
| "@ai-sdk/provider": "4.0.0-beta.0", | ||
| "@ai-sdk/provider-utils": "5.0.0-beta.0" | ||
| "@ai-sdk/provider-utils": "5.0.0-beta.0", | ||
| "@ai-sdk/provider": "4.0.0-beta.0" | ||
| }, | ||
@@ -43,0 +43,0 @@ "devDependencies": { |
@@ -34,3 +34,3 @@ import { | ||
| functionCallingConfig: { | ||
| mode: 'AUTO' | 'NONE' | 'ANY'; | ||
| mode: 'AUTO' | 'NONE' | 'ANY' | 'VALIDATED'; | ||
| allowedFunctionNames?: string[]; | ||
@@ -190,2 +190,3 @@ }; | ||
| const functionDeclarations = []; | ||
| let hasStrictTools = false; | ||
| for (const tool of tools) { | ||
@@ -199,2 +200,5 @@ switch (tool.type) { | ||
| }); | ||
| if (tool.strict === true) { | ||
| hasStrictTools = true; | ||
| } | ||
| break; | ||
@@ -213,3 +217,5 @@ default: | ||
| tools: [{ functionDeclarations }], | ||
| toolConfig: undefined, | ||
| toolConfig: hasStrictTools | ||
| ? { functionCallingConfig: { mode: 'VALIDATED' } } | ||
| : undefined, | ||
| toolWarnings, | ||
@@ -225,3 +231,7 @@ }; | ||
| tools: [{ functionDeclarations }], | ||
| toolConfig: { functionCallingConfig: { mode: 'AUTO' } }, | ||
| toolConfig: { | ||
| functionCallingConfig: { | ||
| mode: hasStrictTools ? 'VALIDATED' : 'AUTO', | ||
| }, | ||
| }, | ||
| toolWarnings, | ||
@@ -238,3 +248,7 @@ }; | ||
| tools: [{ functionDeclarations }], | ||
| toolConfig: { functionCallingConfig: { mode: 'ANY' } }, | ||
| toolConfig: { | ||
| functionCallingConfig: { | ||
| mode: hasStrictTools ? 'VALIDATED' : 'ANY', | ||
| }, | ||
| }, | ||
| toolWarnings, | ||
@@ -247,3 +261,3 @@ }; | ||
| functionCallingConfig: { | ||
| mode: 'ANY', | ||
| mode: hasStrictTools ? 'VALIDATED' : 'ANY', | ||
| allowedFunctionNames: [toolChoice.toolName], | ||
@@ -250,0 +264,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1087481
0.39%12071
0.52%