mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-04 12:18:24 +00:00
fix async in agent (#1723)
This commit is contained in:
parent
55efbb8a7e
commit
40e9488055
@ -453,9 +453,15 @@ class AgentExecutor(Chain, BaseModel):
|
|||||||
# If the tool chosen is the finishing tool, then we end and return.
|
# If the tool chosen is the finishing tool, then we end and return.
|
||||||
if isinstance(output, AgentFinish):
|
if isinstance(output, AgentFinish):
|
||||||
return output
|
return output
|
||||||
|
if self.callback_manager.is_async:
|
||||||
|
await self.callback_manager.on_agent_action(
|
||||||
|
output, verbose=self.verbose, color="green"
|
||||||
|
)
|
||||||
|
else:
|
||||||
self.callback_manager.on_agent_action(
|
self.callback_manager.on_agent_action(
|
||||||
output, verbose=self.verbose, color="green"
|
output, verbose=self.verbose, color="green"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Otherwise we lookup the tool
|
# Otherwise we lookup the tool
|
||||||
if output.tool in name_to_tool_map:
|
if output.tool in name_to_tool_map:
|
||||||
tool = name_to_tool_map[output.tool]
|
tool = name_to_tool_map[output.tool]
|
||||||
|
Loading…
Reference in New Issue
Block a user