[docs]classAgentScratchPadChatPromptTemplate(ChatPromptTemplate):"""Chat prompt template for the agent scratchpad."""@classmethoddefis_lc_serializable(cls)->bool:returnFalsedef_construct_agent_scratchpad(self,intermediate_steps:List[Tuple[AgentAction,str]])->str:iflen(intermediate_steps)==0:return""thoughts=""foraction,observationinintermediate_steps:thoughts+=action.logthoughts+=f"\nObservation: {observation}\nThought: "return(f"This was your previous work "f"(but I haven't seen any of it! I only see what "f"you return as final answer):\n{thoughts}")def_merge_partial_and_user_variables(self,**kwargs:Any)->Dict[str,Any]:intermediate_steps=kwargs.pop("intermediate_steps")kwargs["agent_scratchpad"]=self._construct_agent_scratchpad(intermediate_steps)returnkwargs