@ai-sdk/google 3.0.43 → 3.0.44
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 +6 -0
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +16 -4
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +16 -4
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/google-prepare-tools.ts +19 -5
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
30
30
|
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = true ? "3.0.
|
|
33
|
+
var VERSION = true ? "3.0.44" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/google-generative-ai-embedding-model.ts
|
|
36
36
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -795,6 +795,7 @@ function prepareTools({
|
|
|
795
795
|
};
|
|
796
796
|
}
|
|
797
797
|
const functionDeclarations = [];
|
|
798
|
+
let hasStrictTools = false;
|
|
798
799
|
for (const tool of tools) {
|
|
799
800
|
switch (tool.type) {
|
|
800
801
|
case "function":
|
|
@@ -803,6 +804,9 @@ function prepareTools({
|
|
|
803
804
|
description: (_a = tool.description) != null ? _a : "",
|
|
804
805
|
parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
|
|
805
806
|
});
|
|
807
|
+
if (tool.strict === true) {
|
|
808
|
+
hasStrictTools = true;
|
|
809
|
+
}
|
|
806
810
|
break;
|
|
807
811
|
default:
|
|
808
812
|
toolWarnings.push({
|
|
@@ -815,7 +819,7 @@ function prepareTools({
|
|
|
815
819
|
if (toolChoice == null) {
|
|
816
820
|
return {
|
|
817
821
|
tools: [{ functionDeclarations }],
|
|
818
|
-
toolConfig: void 0,
|
|
822
|
+
toolConfig: hasStrictTools ? { functionCallingConfig: { mode: "VALIDATED" } } : void 0,
|
|
819
823
|
toolWarnings
|
|
820
824
|
};
|
|
821
825
|
}
|
|
@@ -824,7 +828,11 @@ function prepareTools({
|
|
|
824
828
|
case "auto":
|
|
825
829
|
return {
|
|
826
830
|
tools: [{ functionDeclarations }],
|
|
827
|
-
toolConfig: {
|
|
831
|
+
toolConfig: {
|
|
832
|
+
functionCallingConfig: {
|
|
833
|
+
mode: hasStrictTools ? "VALIDATED" : "AUTO"
|
|
834
|
+
}
|
|
835
|
+
},
|
|
828
836
|
toolWarnings
|
|
829
837
|
};
|
|
830
838
|
case "none":
|
|
@@ -836,7 +844,11 @@ function prepareTools({
|
|
|
836
844
|
case "required":
|
|
837
845
|
return {
|
|
838
846
|
tools: [{ functionDeclarations }],
|
|
839
|
-
toolConfig: {
|
|
847
|
+
toolConfig: {
|
|
848
|
+
functionCallingConfig: {
|
|
849
|
+
mode: hasStrictTools ? "VALIDATED" : "ANY"
|
|
850
|
+
}
|
|
851
|
+
},
|
|
840
852
|
toolWarnings
|
|
841
853
|
};
|
|
842
854
|
case "tool":
|
|
@@ -844,7 +856,7 @@ function prepareTools({
|
|
|
844
856
|
tools: [{ functionDeclarations }],
|
|
845
857
|
toolConfig: {
|
|
846
858
|
functionCallingConfig: {
|
|
847
|
-
mode: "ANY",
|
|
859
|
+
mode: hasStrictTools ? "VALIDATED" : "ANY",
|
|
848
860
|
allowedFunctionNames: [toolChoice.toolName]
|
|
849
861
|
}
|
|
850
862
|
},
|