mirror of
https://github.com/Mintplex-Labs/langchain-python.git
synced 2026-07-19 13:26:32 -04:00
acd86d33bc
Provide shared memory capability for the Agent. Inspired by #1293 . ## Problem If both Agent and Tools (i.e., LLMChain) use the same memory, both of them will save the context. It can be annoying in some cases. ## Solution Create a memory wrapper that ignores the save and clear, thereby preventing updates from Agent or Tools.
28 lines
1005 B
Python
28 lines
1005 B
Python
from langchain.memory.buffer import (
|
|
ConversationBufferMemory,
|
|
ConversationStringBufferMemory,
|
|
)
|
|
from langchain.memory.buffer_window import ConversationBufferWindowMemory
|
|
from langchain.memory.chat_memory import ChatMessageHistory
|
|
from langchain.memory.combined import CombinedMemory
|
|
from langchain.memory.entity import ConversationEntityMemory
|
|
from langchain.memory.kg import ConversationKGMemory
|
|
from langchain.memory.readonly import ReadOnlySharedMemory
|
|
from langchain.memory.simple import SimpleMemory
|
|
from langchain.memory.summary import ConversationSummaryMemory
|
|
from langchain.memory.summary_buffer import ConversationSummaryBufferMemory
|
|
|
|
__all__ = [
|
|
"CombinedMemory",
|
|
"ConversationBufferWindowMemory",
|
|
"ConversationBufferMemory",
|
|
"SimpleMemory",
|
|
"ConversationSummaryBufferMemory",
|
|
"ConversationKGMemory",
|
|
"ConversationEntityMemory",
|
|
"ConversationSummaryMemory",
|
|
"ChatMessageHistory",
|
|
"ConversationStringBufferMemory",
|
|
"ReadOnlySharedMemory",
|
|
]
|