Skip to content

Commit

Permalink
fix: remove wrong async and fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
gianfrancodemarco committed Jan 8, 2024
1 parent 4bd9b91 commit 5cd37e5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions libs/langchain/langchain/agents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,13 +1141,13 @@ def _iter_next_step(
name_to_tool_map, color_mapping, agent_action, run_manager
)

async def _perform_agent_action(
def _perform_agent_action(
self,
name_to_tool_map: Dict[str, BaseTool],
color_mapping: Dict[str, str],
agent_action: AgentAction,
run_manager: Optional[AsyncCallbackManagerForChainRun] = None,
):
) -> AgentStep:
if run_manager:
run_manager.on_agent_action(agent_action, color="green")
# Otherwise we lookup the tool
Expand Down Expand Up @@ -1274,7 +1274,12 @@ async def _aiter_next_step(

# Use asyncio.gather to run multiple tool.arun() calls concurrently
result = await asyncio.gather(
*[self._aperform_agent_action(name_to_tool_map, color_mapping, agent_action, run_manager) for agent_action in actions],
*[
self._aperform_agent_action(
name_to_tool_map, color_mapping, agent_action, run_manager
)
for agent_action in actions
],
)

# TODO This could yield each result as it becomes available
Expand Down

0 comments on commit 5cd37e5

Please sign in to comment.