LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • MCP Adapters
    • Overview
    • Agents
    • Callbacks
    • Chains
    • Chat models
    • Embeddings
    • Evaluation
    • Globals
    • Hub
    • Memory
    • Output parsers
    • Retrievers
    • Runnables
    • LangSmith
    • Storage
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-classicmemorychat_memoryBaseChatMemory
    Class●Since v1.0Deprecated

    BaseChatMemory

    Copy
    BaseChatMemory()

    Bases

    BaseMemoryABC

    Attributes

    Methods

    Inherited fromBaseMemory

    Attributes

    Amodel_configAmemory_variables: list[str]
    —

    The string keys this memory class will add to chain inputs.

    Methods

    Mload_memory_variables
    —

    Return key-value pairs given the text input to the chain.

    View source on GitHub
    M
    aload_memory_variables
    —

    Async return key-value pairs given the text input to the chain.

    Inherited fromSerializable(langchain_core)

    Attributes

    Alc_secretsAlc_attributesAmodel_config

    Methods

    Mis_lc_serializableMget_lc_namespaceMlc_idMto_jsonMto_json_not_implemented
    attribute
    chat_memory: BaseChatMessageHistory
    attribute
    output_key: str | None
    attribute
    input_key: str | None
    attribute
    return_messages: bool
    method
    save_context

    Save context from this conversation to buffer.

    method
    asave_context

    Save context from this conversation to buffer.

    method
    clear

    Clear memory contents.

    method
    aclear

    Clear memory contents.

    Abstract base class for chat memory.

    ATTENTION This abstraction was created prior to when chat models had native tool calling capabilities. It does NOT support native tool calling capabilities for chat models and will fail SILENTLY if used with a chat model that has native tool calling.

    DO NOT USE THIS ABSTRACTION FOR NEW CODE.