Skip to content

Commit

Permalink
Remove "predict_and_parse" from LLMRouterChain
Browse files Browse the repository at this point in the history
  • Loading branch information
RoderickVM committed Sep 15, 2023
1 parent f91b9b6 commit 1ececb2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libs/langchain/langchain/chains/router/llm_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ def _call(
callbacks = _run_manager.get_child()
output = cast(
Dict[str, Any],
self.llm_chain.predict_and_parse(callbacks=callbacks, **inputs),
self.llm_chain.predict(callbacks=callbacks, **inputs),
)
if self.llm_chain.prompt.output_parser is not None:
output = self.llm_chain.prompt.output_parser.parse(output)
return output

async def _acall(
Expand All @@ -68,8 +70,10 @@ async def _acall(
callbacks = _run_manager.get_child()
output = cast(
Dict[str, Any],
await self.llm_chain.apredict_and_parse(callbacks=callbacks, **inputs),
await self.llm_chain.apredict(callbacks=callbacks, **inputs),
)
if self.llm_chain.prompt.output_parser is not None:
output = self.llm_chain.prompt.output_parser.parse(output)
return output

@classmethod
Expand Down

0 comments on commit 1ececb2

Please sign in to comment.