Given input, decided what to do. Args: intermediate_steps: Steps the LLM has taken to date, along with observations callbacks: Callbacks to run. **kwargs: User inputs. Returns: Action specifying what tool to use.
(
self,
intermediate_steps: List[Tuple[AgentAction, str]],
callbacks: Callbacks = None,
**kwargs: Any,
)
| 97 | return thoughts |
| 98 | |
| 99 | def plan( |
| 100 | self, |
| 101 | intermediate_steps: List[Tuple[AgentAction, str]], |
| 102 | callbacks: Callbacks = None, |
| 103 | **kwargs: Any, |
| 104 | ) -> Union[AgentAction, AgentFinish]: |
| 105 | """Given input, decided what to do. |
| 106 | |
| 107 | Args: |
| 108 | intermediate_steps: Steps the LLM has taken to date, |
| 109 | along with observations |
| 110 | callbacks: Callbacks to run. |
| 111 | **kwargs: User inputs. |
| 112 | |
| 113 | Returns: |
| 114 | Action specifying what tool to use. |
| 115 | """ |
| 116 | try: |
| 117 | full_inputs = self.get_full_inputs(intermediate_steps, **kwargs) |
| 118 | full_output = self.llm_chain.predict(callbacks=callbacks, **full_inputs) |
| 119 | return self.output_parser.parse(full_output) |
| 120 | except Exception as e: |
| 121 | full_inputs["agent_scratchpad"] = ( |
| 122 | full_inputs["agent_scratchpad"] + full_output + "\nAction: " |
| 123 | ) |
| 124 | full_output = self.llm_chain.predict(callbacks=callbacks, **full_inputs) |
| 125 | return self.output_parser.parse("Action: " + full_output) |
| 126 | |
| 127 | async def aplan( |
| 128 | self, |
no test coverage detected