Skip to content

Commit

Permalink
langchain[patch]: update llm_router.py (#18865)
Browse files Browse the repository at this point in the history
Issue : _call method of LLMRouterChain uses predict_and_parse, which is
slated for deprecation.

Description : Instead of using predict_and_parse, this replaces it with
individual predict and parse functions.
  • Loading branch information
rsk2327 authored Mar 12, 2024
1 parent 18de77c commit acf1ecc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libs/langchain/langchain/chains/router/llm_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ def _call(
) -> Dict[str, Any]:
_run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager()
callbacks = _run_manager.get_child()

prediction = self.llm_chain.predict(callbacks=callbacks, **inputs)
output = cast(
Dict[str, Any],
self.llm_chain.predict_and_parse(callbacks=callbacks, **inputs),
self.llm_chain.prompt.output_parser.parse(prediction),
)
return output

Expand Down

0 comments on commit acf1ecc

Please sign in to comment.