From 0c436b2e5038f25fd5edb1bb5dee7a30b4e342c9 Mon Sep 17 00:00:00 2001 From: JetDrag Date: Tue, 3 Sep 2024 11:34:01 +0800 Subject: [PATCH] core: make sure tool input keys won't be modified during following process, to prevent problems when there's no args schema. --- libs/core/langchain_core/tools/base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/core/langchain_core/tools/base.py b/libs/core/langchain_core/tools/base.py index 9782234dfb1a05..df8629ccdaba34 100644 --- a/libs/core/langchain_core/tools/base.py +++ b/libs/core/langchain_core/tools/base.py @@ -528,6 +528,8 @@ def _parse_input(self, tool_input: Union[str, dict]) -> Union[str, dict[str, Any for k, v in result_dict.items() if k in tool_input } + # make sure tool input keys won't be modified during following process + tool_input.copy() return tool_input @model_validator(mode="before")