@ai-sdk/google 3.0.42 → 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 +12 -0
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -7
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +18 -6
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +18 -6
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/convert-to-google-generative-ai-messages.ts +1 -1
- package/src/google-prepare-tools.ts +19 -5
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.
|
|
10
|
+
var VERSION = true ? "3.0.44" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -425,8 +425,8 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
425
425
|
contents.push({
|
|
426
426
|
role: "model",
|
|
427
427
|
parts: content.map((part) => {
|
|
428
|
-
var _a2, _b2, _c2;
|
|
429
|
-
const providerOpts = (
|
|
428
|
+
var _a2, _b2, _c2, _d;
|
|
429
|
+
const providerOpts = (_d = (_a2 = part.providerOptions) == null ? void 0 : _a2[providerOptionsName]) != null ? _d : providerOptionsName !== "google" ? (_b2 = part.providerOptions) == null ? void 0 : _b2.google : (_c2 = part.providerOptions) == null ? void 0 : _c2.vertex;
|
|
430
430
|
const thoughtSignature = (providerOpts == null ? void 0 : providerOpts.thoughtSignature) != null ? String(providerOpts.thoughtSignature) : void 0;
|
|
431
431
|
switch (part.type) {
|
|
432
432
|
case "text": {
|
|
@@ -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: {
|
|
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: {
|
|
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
|
},
|