Home / Function/ load_memory_variables() — langchain Function Reference

load_memory_variables() — langchain Function Reference

Architecture documentation for the load_memory_variables() function in summary_buffer.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8a3e60da_3668_865f_fe8a_7478e32887da["load_memory_variables()"]
  f7800961_f1f1_7fa8_1fe5_64c9aba0b253["ConversationSummaryBufferMemory"]
  8a3e60da_3668_865f_fe8a_7478e32887da -->|defined in| f7800961_f1f1_7fa8_1fe5_64c9aba0b253
  a699225e_2c8c_b6a9_b2d6_c50b16352811["buffer()"]
  a699225e_2c8c_b6a9_b2d6_c50b16352811 -->|calls| 8a3e60da_3668_865f_fe8a_7478e32887da
  style 8a3e60da_3668_865f_fe8a_7478e32887da fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/memory/summary_buffer.py lines 48–64

    def load_memory_variables(self, inputs: dict[str, Any]) -> dict[str, Any]:
        """Return history buffer."""
        buffer = self.chat_memory.messages
        if self.moving_summary_buffer != "":
            first_messages: list[BaseMessage] = [
                self.summary_message_cls(content=self.moving_summary_buffer),
            ]
            buffer = first_messages + buffer
        if self.return_messages:
            final_buffer: Any = buffer
        else:
            final_buffer = get_buffer_string(
                buffer,
                human_prefix=self.human_prefix,
                ai_prefix=self.ai_prefix,
            )
        return {self.memory_key: final_buffer}

Domain

Subdomains

Called By

Frequently Asked Questions

What does load_memory_variables() do?
load_memory_variables() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/memory/summary_buffer.py.
Where is load_memory_variables() defined?
load_memory_variables() is defined in libs/langchain/langchain_classic/memory/summary_buffer.py at line 48.
What calls load_memory_variables()?
load_memory_variables() is called by 1 function(s): buffer.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free