Construct the scratchpad that lets the agent continue its thought process.
(self, intermediate_steps)
| 26 | return full_inputs |
| 27 | |
| 28 | def _construct_scratchpad(self, intermediate_steps): |
| 29 | """Construct the scratchpad that lets the agent continue its thought process.""" |
| 30 | thoughts = "" |
| 31 | # only modify the following line, [-2: ] |
| 32 | for action, observation in intermediate_steps[-2: ]: |
| 33 | thoughts += action.log |
| 34 | thoughts += f"\n{self.observation_prefix}{observation}\n{self.llm_prefix}" |
| 35 | if "is not a valid tool, try another one" in observation: |
| 36 | thoughts += "You should select another tool rather than the invalid one.\n" |
| 37 | return thoughts |
| 38 | |
| 39 | class TaskCreationChain(LLMChain): |
| 40 | """Chain to generates tasks.""" |