mirror of
https://github.com/hwchase17/langchain
synced 2024-11-04 06:00:26 +00:00
Core[Patch] Parse tool input after on_start (#16430)
For tracing, if a validation error occurs, currently it is attributed to the previous step of the chain. It would be nice to have the on_start and on_error callbacks called for tools when there is a validation error that occurs to more easily attribute the root-cause
This commit is contained in:
parent
226fe645f1
commit
5de59f9236
@ -312,7 +312,6 @@ class ChildTool(BaseTool):
|
||||
**kwargs: Any,
|
||||
) -> Any:
|
||||
"""Run the tool."""
|
||||
parsed_input = self._parse_input(tool_input)
|
||||
if not self.verbose and verbose is not None:
|
||||
verbose_ = verbose
|
||||
else:
|
||||
@ -341,6 +340,7 @@ class ChildTool(BaseTool):
|
||||
**kwargs,
|
||||
)
|
||||
try:
|
||||
parsed_input = self._parse_input(tool_input)
|
||||
tool_args, tool_kwargs = self._to_args_and_kwargs(parsed_input)
|
||||
observation = (
|
||||
self._run(*tool_args, run_manager=run_manager, **tool_kwargs)
|
||||
@ -392,7 +392,6 @@ class ChildTool(BaseTool):
|
||||
**kwargs: Any,
|
||||
) -> Any:
|
||||
"""Run the tool asynchronously."""
|
||||
parsed_input = self._parse_input(tool_input)
|
||||
if not self.verbose and verbose is not None:
|
||||
verbose_ = verbose
|
||||
else:
|
||||
@ -416,6 +415,7 @@ class ChildTool(BaseTool):
|
||||
**kwargs,
|
||||
)
|
||||
try:
|
||||
parsed_input = self._parse_input(tool_input)
|
||||
# We then call the tool on the tool input to get an observation
|
||||
tool_args, tool_kwargs = self._to_args_and_kwargs(parsed_input)
|
||||
observation = (
|
||||
|
Loading…
Reference in New Issue
Block a user