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

    ConversationSummaryBufferMemory

    Copy
    ConversationSummaryBufferMemory()

    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

    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

    Inherited fromSerializable(langchain_core)

    Attributes

    Alc_secretsAlc_attributesAmodel_config

    Methods

    Mis_lc_serializableMget_lc_namespaceMlc_idMto_jsonMto_json_not_implemented
    attribute
    max_token_limit: int
    attribute
    moving_summary_buffer: str
    attribute
    memory_key: str
    attribute
    buffer: str | list[BaseMessage]

    String buffer of memory.

    attribute
    memory_variables: list[str]

    Will always return list of memory variables.

    method
    abuffer

    Async memory buffer.

    method
    load_memory_variables

    Return history buffer.

    method
    aload_memory_variables

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

    method
    validate_prompt_input_variables

    Validate that prompt input variables are consistent.

    method
    save_context

    Save context from this conversation to buffer.

    method
    asave_context

    Asynchronously save context from this conversation to buffer.

    method
    prune

    Prune buffer if it exceeds max token limit.

    method
    aprune

    Asynchronously prune buffer if it exceeds max token limit.

    method
    clear

    Clear memory contents.

    method
    aclear

    Asynchronously clear memory contents.

    Buffer with summarizer for storing conversation memory.

    Provides a running summary of the conversation together with the most recent messages in the conversation under the constraint that the total number of tokens in the conversation does not exceed a certain limit.