[docs]classMemorize(BaseTool):# type: ignore[override]"""Tool that trains a language model."""name:str="memorize"description:str=("Useful whenever you observed novel information ""from previous conversation history, ""i.e., another tool's action outputs or human comments. ""The action input should include observed information in detail, ""then the tool will fine-tune yourself to remember it.")llm:TrainableLLM=Field()def_run(self,information_to_learn:str,run_manager:Optional[CallbackManagerForToolRun]=None,)->str:train_result=self.llm.train_unsupervised((information_to_learn,))returnf"Train complete. Loss: {train_result['loss']}"asyncdef_arun(self,information_to_learn:str,run_manager:Optional[AsyncCallbackManagerForToolRun]=None,)->str:train_result=awaitself.llm.atrain_unsupervised((information_to_learn,))returnf"Train complete. Loss: {train_result['loss']}"