Spaces:
Sleeping
Sleeping
Update memory.py
Browse files
memory.py
CHANGED
@@ -1,4 +1,7 @@
|
|
1 |
from langchain.memory import ConversationBufferWindowMemory
|
|
|
|
|
|
|
2 |
|
3 |
memory3 = ConversationBufferWindowMemory(
|
4 |
-
k=2, memory_key='chat_history', return_messages=True, output_key='answer', human_prefix="<|user|>", ai_prefix="<|assistant|>")
|
|
|
1 |
from langchain.memory import ConversationBufferWindowMemory
|
2 |
+
from langchain.memory.chat_message_histories import StreamlitChatMessageHistory
|
3 |
+
|
4 |
+
msgs = StreamlitChatMessageHistory(key="langchain_messages")
|
5 |
|
6 |
memory3 = ConversationBufferWindowMemory(
|
7 |
+
k=2, memory_key='chat_history', return_messages=True, output_key='answer', human_prefix="<|user|>", ai_prefix="<|assistant|>", chat_memory=msgs)
|