From 0a44bfdca3b1ea3173f38e68bfd0d189f22633f8 Mon Sep 17 00:00:00 2001 From: Mark Pors Date: Wed, 31 May 2023 02:02:39 +0200 Subject: [PATCH] Allow for async use of SelfAskWithSearchChain (#5394) # Allow for async use of SelfAskWithSearchChain Co-authored-by: Dev 2049 --- langchain/agents/self_ask_with_search/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/langchain/agents/self_ask_with_search/base.py b/langchain/agents/self_ask_with_search/base.py index a4065f04..e1662273 100644 --- a/langchain/agents/self_ask_with_search/base.py +++ b/langchain/agents/self_ask_with_search/base.py @@ -77,7 +77,10 @@ class SelfAskWithSearchChain(AgentExecutor): ): """Initialize with just an LLM and a search chain.""" search_tool = Tool( - name="Intermediate Answer", func=search_chain.run, description="Search" + name="Intermediate Answer", + func=search_chain.run, + coroutine=search_chain.arun, + description="Search", ) agent = SelfAskWithSearchAgent.from_llm_and_tools(llm, [search_tool]) super().__init__(agent=agent, tools=[search_tool], **kwargs)