Skip to content

Commit

Permalink
core: dont mutate tool_kwargs during tool run
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis committed Dec 19, 2024
1 parent f1d7837 commit fe84a9a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/core/langchain_core/tools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,9 +684,9 @@ def run(
context.run(_set_config_context, child_config)
tool_args, tool_kwargs = self._to_args_and_kwargs(tool_input, tool_call_id)
if signature(self._run).parameters.get("run_manager"):
tool_kwargs["run_manager"] = run_manager
tool_kwargs = tool_kwargs | {"run_manager": run_manager}
if config_param := _get_runnable_config_param(self._run):
tool_kwargs[config_param] = config
tool_kwargs = tool_kwargs | {config_param: config}
response = context.run(self._run, *tool_args, **tool_kwargs)
if self.response_format == "content_and_artifact":
if not isinstance(response, tuple) or len(response) != 2:
Expand Down

0 comments on commit fe84a9a

Please sign in to comment.