
    Ng                         d dl mZ d dlmZmZmZmZmZ d dlm	Z	m
Z
 d dlmZ d dlmZ d dlmZ e G d de                      Z G d	 d
e          ZdS )    )abstractmethod)AnyOptionalProtocolSequenceruntime_checkable)AsyncCallbackManagerForToolRunCallbackManagerForToolRun)BaseTool)Field)TrainResultc                   r    e Zd ZdZedee         dedefd            Z	edee         dedefd            Z
dS )TrainableLLMz'Protocol for trainable language models.inputskwargsreturnc                     d S N selfr   r   s      c/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/tools/memorize/tool.pytrain_unsupervisedzTrainableLLM.train_unsupervised   s	    
 c    c                 
   K   d S r   r   r   s      r   atrain_unsupervisedz TrainableLLM.atrain_unsupervised   s      
 cr   N)__name__
__module____qualname____doc__r   r   strr   r   r   r   r   r   r   r   r      s        11  
	   ^   
	   ^  r   r   c                       e Zd ZU dZdZeed<   dZeed<    e            Z	e
ed<   	 dded	ee         d
efdZ	 dded	ee         d
efdZdS )Memorizez"Tool that trains a language model.memorizenamezUseful 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.descriptionllmNinformation_to_learnrun_managerr   c                 N    | j                             |f          }d|d          S NzTrain complete. Loss: loss)r'   r   r   r(   r)   train_results       r   _runzMemorize._run.   s0    
 x224H3JKK>V(<>>>r   c                 ^   K   | j                             |f           d {V }d|d          S r+   )r'   r   r-   s       r   _arunzMemorize._arun6   sF      
 "X99;O:QRRRRRRRR>V(<>>>r   r   )r   r   r   r    r%   r!   __annotations__r&   r   r'   r   r   r
   r/   r	   r1   r   r   r   r#   r#   !   s         ,,D#	@     C
 <@? ?!? 78? 
	? ? ? ? AE? ?!? <=? 
	? ? ? ? ? ?r   r#   N)abcr   typingr   r   r   r   r   langchain_core.callbacksr	   r
   langchain_core.toolsr   pydanticr   $langchain_community.llms.gradient_air   r   r#   r   r   r   <module>r9      s         G G G G G G G G G G G G G G        * ) ) ) ) )       < < < < < <     8   $? ? ? ? ?x ? ? ? ? ?r   