§
    ™Štjñ  ã                  óª   — d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZ  e	d	d
dd¬¦  «         G d„ dee¦  «        ¦   «         ZdS )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2.0.0zlangchain.agents.create_agentzùFor agents that need to remember prior interactions, use `create_agent` with checkpointing or the `Store` API. See https://docs.langchain.com/oss/python/langchain/short-term-memory and https://docs.langchain.com/oss/python/langchain/long-term-memory)ÚsinceÚremovalÚalternativeÚaddendumc                  ó²   — e Zd ZdZ ed¬¦  «        Zeedd„¦   «         ¦   «         Zedd	„¦   «         Z	dd
„Z
edd„¦   «         Zdd„Zedd„¦   «         Zdd„ZdS )Ú
BaseMemorya9  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_allowedÚreturnú	list[str]c                ó   — dS )z;The string keys this memory class will add to chain inputs.N© ©Úselfs    ú[/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/langchain_classic/base_memory.pyÚmemory_variableszBaseMemory.memory_variablesB   ó   € € € ó    Úinputsúdict[str, Any]c                ó   — dS )z½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.
        Nr   ©r   r   s     r   Úload_memory_variablesz BaseMemory.load_memory_variablesG   r   r   c              ƒ  ó>   K  — t          d| j        |¦  «        ƒ d{V —†S )zÃAsync 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_variablesz!BaseMemory.aload_memory_variablesR   s/   è è € õ % T¨4Ô+EÀvÑNÔNÐNÐNÐNÐNÐNÐNÐNr   Úoutputsúdict[str, str]ÚNonec                ó   — dS )z¡Save the context of this chain run to memory.

        Args:
            inputs: The inputs to the chain.
            outputs: The outputs of the chain.
        Nr   ©r   r   r#   s      r   Úsave_contextzBaseMemory.save_context]   r   r   c              ƒ  óD   K  — t          d| j        ||¦  «        ƒ d{V —† dS )z§Async 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_contextzBaseMemory.asave_contextf   s7   è è € õ ˜d DÔ$5°v¸wÑGÔGÐGÐGÐGÐGÐGÐGÐGÐGÐGr   c                ó   — dS )zClear memory contents.Nr   r   s    r   ÚclearzBaseMemory.clearq   r   r   c              ƒ  ó@   K  — t          d| j        ¦  «        ƒ d{V —† dS )zAsync clear memory contents.N)r	   r,   r   s    r   ÚaclearzBaseMemory.aclearu   s0   è è € å˜d D¤JÑ/Ô/Ð/Ð/Ð/Ð/Ð/Ð/Ð/Ð/Ð/r   N)r   r   )r   r   r   r   )r   r   r#   r$   r   r%   )r   r%   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   Úmodel_configÚpropertyr   r   r    r"   r(   r*   r,   r.   r   r   r   r   r      s  € € € € € ðð ð> �:Ø $ðñ ô €Lð ØðJð Jð Jñ „^ñ „XðJð ðð ð ñ „^ðð	Oð 	Oð 	Oð 	Oð ðð ð ñ „^ðð	Hð 	Hð 	Hð 	Hð ð%ð %ð %ñ „^ð%ð0ð 0ð 0ð 0ð 0ð 0r   r   N)r2   Ú
__future__r   Úabcr   r   Útypingr   Úlangchain_core._apir   Ú langchain_core.load.serializabler   Úlangchain_core.runnablesr	   Úpydanticr
   r   r   r   r   ú<module>r<      s  ððð ð #Ð "Ð "Ð "Ð "Ð "à #Ð #Ð #Ð #Ð #Ð #Ð #Ð #Ø Ð Ð Ð Ð Ð à *Ð *Ð *Ð *Ð *Ð *Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø Ð Ð Ð Ð Ð ð €Ø
ØØ/ð	Kð
ñ 
ô 
ðY0ð Y0ð Y0ð Y0ð Y0�˜sñ Y0ô Y0ñ
ô 
ðY0ð Y0ð Y0r   