ethanrom commited on
Commit
de4ad29
1 Parent(s): 9c95d2e

Update memory.py

Browse files
Files changed (1) hide show
  1. memory.py +4 -1
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)