Prevent kwargs from being overwritten (#3158)

Fixes #3157. Prevents `kwargs` from being overwritten by
`_to_args_and_kwargs()` and sending the wrong `kwargs` in line 109.
This commit is contained in:
Dariel Dato-on 2023-04-19 11:00:10 -05:00 committed by GitHub
parent 126d7f11dd
commit 0b542661b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,8 +100,8 @@ class BaseTool(ABC, BaseModel):
**kwargs,
)
try:
args, kwargs = _to_args_and_kwargs(tool_input)
observation = self._run(*args, **kwargs)
tool_args, tool_kwargs = _to_args_and_kwargs(tool_input)
observation = self._run(*tool_args, **tool_kwargs)
except (Exception, KeyboardInterrupt) as e:
self.callback_manager.on_tool_error(e, verbose=verbose_)
raise e