@langchain/google-genai 0.2.0 → 0.2.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/chat_models.cjs
CHANGED
|
@@ -780,13 +780,14 @@ class ChatGoogleGenerativeAI extends chat_models_1.BaseChatModel {
|
|
|
780
780
|
typeof schema.parameters === "object" &&
|
|
781
781
|
schema.parameters != null) {
|
|
782
782
|
geminiFunctionDefinition = schema;
|
|
783
|
+
geminiFunctionDefinition.parameters = (0, zod_to_genai_parameters_js_1.removeAdditionalProperties)(schema.parameters);
|
|
783
784
|
functionName = schema.name;
|
|
784
785
|
}
|
|
785
786
|
else {
|
|
786
787
|
geminiFunctionDefinition = {
|
|
787
788
|
name: functionName,
|
|
788
789
|
description: schema.description ?? "",
|
|
789
|
-
parameters: schema,
|
|
790
|
+
parameters: (0, zod_to_genai_parameters_js_1.removeAdditionalProperties)(schema),
|
|
790
791
|
};
|
|
791
792
|
}
|
|
792
793
|
tools = [
|
|
@@ -807,7 +808,7 @@ class ChatGoogleGenerativeAI extends chat_models_1.BaseChatModel {
|
|
|
807
808
|
else {
|
|
808
809
|
const jsonSchema = (0, types_1.isZodSchema)(schema)
|
|
809
810
|
? (0, zod_to_genai_parameters_js_1.zodToGenerativeAIParameters)(schema)
|
|
810
|
-
: schema;
|
|
811
|
+
: (0, zod_to_genai_parameters_js_1.removeAdditionalProperties)(schema);
|
|
811
812
|
llm = this.bind({
|
|
812
813
|
responseSchema: jsonSchema,
|
|
813
814
|
});
|
package/dist/chat_models.js
CHANGED
|
@@ -4,7 +4,7 @@ import { BaseChatModel, } from "@langchain/core/language_models/chat_models";
|
|
|
4
4
|
import { RunnablePassthrough, RunnableSequence, } from "@langchain/core/runnables";
|
|
5
5
|
import { isZodSchema } from "@langchain/core/utils/types";
|
|
6
6
|
import { JsonOutputParser, } from "@langchain/core/output_parsers";
|
|
7
|
-
import { zodToGenerativeAIParameters } from "./utils/zod_to_genai_parameters.js";
|
|
7
|
+
import { zodToGenerativeAIParameters, removeAdditionalProperties, } from "./utils/zod_to_genai_parameters.js";
|
|
8
8
|
import { convertBaseMessagesToContent, convertResponseContentToChatGenerationChunk, mapGenerateContentResultToChatResult, } from "./utils/common.js";
|
|
9
9
|
import { GoogleGenerativeAIToolsOutputParser } from "./output_parsers.js";
|
|
10
10
|
import { convertToolsToGenAI } from "./utils/tools.js";
|
|
@@ -777,13 +777,14 @@ export class ChatGoogleGenerativeAI extends BaseChatModel {
|
|
|
777
777
|
typeof schema.parameters === "object" &&
|
|
778
778
|
schema.parameters != null) {
|
|
779
779
|
geminiFunctionDefinition = schema;
|
|
780
|
+
geminiFunctionDefinition.parameters = removeAdditionalProperties(schema.parameters);
|
|
780
781
|
functionName = schema.name;
|
|
781
782
|
}
|
|
782
783
|
else {
|
|
783
784
|
geminiFunctionDefinition = {
|
|
784
785
|
name: functionName,
|
|
785
786
|
description: schema.description ?? "",
|
|
786
|
-
parameters: schema,
|
|
787
|
+
parameters: removeAdditionalProperties(schema),
|
|
787
788
|
};
|
|
788
789
|
}
|
|
789
790
|
tools = [
|
|
@@ -804,7 +805,7 @@ export class ChatGoogleGenerativeAI extends BaseChatModel {
|
|
|
804
805
|
else {
|
|
805
806
|
const jsonSchema = isZodSchema(schema)
|
|
806
807
|
? zodToGenerativeAIParameters(schema)
|
|
807
|
-
: schema;
|
|
808
|
+
: removeAdditionalProperties(schema);
|
|
808
809
|
llm = this.bind({
|
|
809
810
|
responseSchema: jsonSchema,
|
|
810
811
|
});
|