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-classicmemorysummaryConversationSummaryMemory
    Class●Since v1.0Deprecated

    ConversationSummaryMemory

    Copy
    ConversationSummaryMemory()

    Bases

    BaseChatMemorySummarizerMixin

    Attributes

    Methods

    Inherited fromBaseChatMemory

    Attributes

    Achat_memory: BaseChatMessageHistoryAoutput_key: strAinput_key: str | None
    —

    The key from the model Run's inputs to use as the eval input.

    View source on GitHub
    A
    return_messages
    : bool

    Methods

    Masave_context
    —

    Async save the context of this chain run to memory.

    Maclear
    —

    Async clear memory contents.

    Inherited fromSummarizerMixin

    Attributes

    Ahuman_prefix: strAai_prefix: strAllm: BaseLanguageModel | NoneAprompt: strAsummary_message_cls: type[BaseMessage]

    Methods

    Mpredict_new_summary
    —

    Predict a new summary based on the messages and existing summary.

    Mapredict_new_summary
    —

    Predict a new summary based on the messages and existing summary.

    Inherited fromBaseMemory

    Attributes

    Amodel_config

    Methods

    Maload_memory_variables
    —

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

    Masave_context
    —

    Async save the context of this chain run to memory.

    Maclear
    —

    Async clear memory contents.

    Inherited fromSerializable(langchain_core)

    Attributes

    Alc_secretsAlc_attributesAmodel_config

    Methods

    Mis_lc_serializableMget_lc_namespaceMlc_idMto_jsonMto_json_not_implemented
    attribute
    buffer: str
    attribute
    memory_key: str
    attribute
    memory_variables: list[str]

    Will always return list of memory variables.

    method
    from_messages

    Create a ConversationSummaryMemory from a list of messages.

    method
    load_memory_variables

    Return history buffer.

    method
    validate_prompt_input_variables

    Validate that prompt input variables are consistent.

    method
    save_context

    Save context from this conversation to buffer.

    method
    clear

    Clear memory contents.

    Continually summarizes the conversation history.

    The summary is updated after each conversation turn. The implementations returns a summary of the conversation history which can be used to provide context to the model.