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 <baskaryan@gmail.com>
pull/6649/head^2
Fielding Johnston 1 year ago committed by GitHub
parent cc0585af42
commit 00c466627a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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:

Loading…
Cancel
Save