[docs]@abstractmethoddefplan(self,inputs:dict,callbacks:Callbacks=None,**kwargs:Any)->Plan:"""Given input, decide what to do."""
[docs]@abstractmethodasyncdefaplan(self,inputs:dict,callbacks:Callbacks=None,**kwargs:Any)->Plan:"""Given input, asynchronously decide what to do."""
[docs]classLLMPlanner(BasePlanner):"""LLM planner."""llm_chain:LLMChain"""The LLM chain to use."""output_parser:PlanOutputParser"""The output parser to use."""stop:Optional[List]=None"""The stop list to use."""
[docs]defplan(self,inputs:dict,callbacks:Callbacks=None,**kwargs:Any)->Plan:"""Given input, decide what to do."""llm_response=self.llm_chain.run(**inputs,stop=self.stop,callbacks=callbacks)returnself.output_parser.parse(llm_response)
[docs]asyncdefaplan(self,inputs:dict,callbacks:Callbacks=None,**kwargs:Any)->Plan:"""Given input, asynchronously decide what to do."""llm_response=awaitself.llm_chain.arun(**inputs,stop=self.stop,callbacks=callbacks)returnself.output_parser.parse(llm_response)