
    KKi                        S r SSKJr  SSKJrJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  SSKJr  \	" S	S
SS9 " S S\\5      5       rg)z**Memory** maintains Chain state, incorporating context from past runs.

This module contains memory abstractions from LangChain v0.0.x.

These abstractions are now deprecated and will be removed in LangChain v1.0.0.
    )annotations)ABCabstractmethod)Any)
deprecated)Serializable)run_in_executor)
ConfigDictz0.3.3z1.0.0z_Please see the migration guide at: https://python.langchain.com/docs/versions/migrating_memory/)sinceremovalmessagec                      \ rS rSrSr\" SS9r\\SS j5       5       r	\SS j5       r
SS jr\SS j5       r      SS	 jr\SS
 j5       rSS jrSrg)
BaseMemory   a  Abstract base class for memory in Chains.

Memory refers to state in Chains. Memory can be used to store information about
    past executions of a Chain and inject that information into the inputs of
    future executions of the Chain. For example, for conversational Chains Memory
    can be used to store conversations and automatically add them to future model
    prompts so that the model has the necessary context to respond coherently to
    the latest input.

Example:
    ```python
    class SimpleMemory(BaseMemory):
        memories: dict[str, Any] = dict()

        @property
        def memory_variables(self) -> list[str]:
            return list(self.memories.keys())

        def load_memory_variables(self, inputs: dict[str, Any]) -> dict[str, str]:
            return self.memories

        def save_context(
            self, inputs: dict[str, Any], outputs: dict[str, str]
        ) -> None:
            pass

        def clear(self) -> None:
            pass
    ```
T)arbitrary_types_allowedc                    g)z;The string keys this memory class will add to chain inputs.N selfs    _/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/langchain_classic/base_memory.pymemory_variablesBaseMemory.memory_variables?           c                    g)zReturn key-value pairs given the text input to the chain.

Args:
    inputs: The inputs to the chain.

Returns:
    A dictionary of key-value pairs.
Nr   r   inputss     r   load_memory_variables BaseMemory.load_memory_variablesD   r   r   c                L   #    [        SU R                  U5      I Sh  vN $  N7f)zAsync return key-value pairs given the text input to the chain.

Args:
    inputs: The inputs to the chain.

Returns:
    A dictionary of key-value pairs.
N)r	   r   r   s     r   aload_memory_variables!BaseMemory.aload_memory_variablesO   s"      %T4+E+EvNNNNs   $"$c                    g)zSave the context of this chain run to memory.

Args:
    inputs: The inputs to the chain.
    outputs: The outputs of the chain.
Nr   r   r   outputss      r   save_contextBaseMemory.save_contextZ   r   r   c                N   #    [        SU R                  X5      I Sh  vN   g N7f)zAsync save the context of this chain run to memory.

Args:
    inputs: The inputs to the chain.
    outputs: The outputs of the chain.
N)r	   r&   r$   s      r   asave_contextBaseMemory.asave_contextc   s      dD$5$5vGGGs   %#%c                    g)zClear memory contents.Nr   r   s    r   clearBaseMemory.clearn   r   r   c                L   #    [        SU R                  5      I Sh  vN   g N7f)zAsync clear memory contents.N)r	   r,   r   s    r   aclearBaseMemory.aclearr   s     dDJJ///s   $"$r   N)returnz	list[str])r   dict[str, Any]r1   r2   )r   r2   r%   zdict[str, str]r1   None)r1   r3   )__name__
__module____qualname____firstlineno____doc__r
   model_configpropertyr   r   r   r!   r&   r)   r,   r/   __static_attributes__r   r   r   r   r      s    >  $L J  J  	O  	H$	H/=	H		H % %0r   r   N)r8   
__future__r   abcr   r   typingr   langchain_core._apir    langchain_core.load.serializabler   langchain_core.runnablesr	   pydanticr
   r   r   r   r   <module>rC      sR    # #  * 9 4  
	G	Y0s Y0Y0r   