From 00c466627a1d80c92376e9748f9557111c2030af Mon Sep 17 00:00:00 2001 From: Fielding Johnston Date: Tue, 11 Jul 2023 17:18:47 -0500 Subject: [PATCH] minor bug fix: properly await AsyncRunManager's method call in MulitRouteChain (#7487) This simply awaits `AsyncRunManager`'s method call in `MulitRouteChain`. Noticed this while playing around with Langchain's implementation of `MultiPromptChain`. @baskaryan cheers --------- Co-authored-by: Bagatur --- langchain/chains/router/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/langchain/chains/router/base.py b/langchain/chains/router/base.py index fe948a5646..8dbe6ddca7 100644 --- a/langchain/chains/router/base.py +++ b/langchain/chains/router/base.py @@ -102,11 +102,11 @@ class MultiRouteChain(Chain): inputs: Dict[str, Any], run_manager: Optional[AsyncCallbackManagerForChainRun] = None, ) -> Dict[str, Any]: - _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager() + _run_manager = run_manager or AsyncCallbackManagerForChainRun.get_noop_manager() callbacks = _run_manager.get_child() route = await self.router_chain.aroute(inputs, callbacks=callbacks) - _run_manager.on_text( + await _run_manager.on_text( str(route.destination) + ": " + str(route.next_inputs), verbose=self.verbose ) if not route.destination: