Skip to content

The agent engineering platform.

stop making copies of inputs (#15926)

Harrison Chase1afac774393a
diff --git a/libs/core/langchain_core/tools.py b/libs/core/langchain_core/tools.py
index e13e641d7c..50cf500b93 100644
--- a/libs/core/langchain_core/tools.py
+++ b/libs/core/langchain_core/tools.py
@@ -248,7 +248,11 @@ class ChildTool(BaseTool):
else:
if input_args is not None:
result = input_args.parse_obj(tool_input)
- return {k: v for k, v in result.dict().items() if k in tool_input}
+ return {
+ k: getattr(result, k)
+ for k, v in result.dict().items()
+ if k in tool_input
+ }
return tool_input
@root_validator()