cima-free-chat / memory.py
ethanrom's picture
Update memory.py
de4ad29
raw history blame
No virus
393 Bytes
from langchain.memory import ConversationBufferWindowMemory
from langchain.memory.chat_message_histories import StreamlitChatMessageHistory
msgs = StreamlitChatMessageHistory(key="langchain_messages")
memory3 = ConversationBufferWindowMemory(
k=2, memory_key='chat_history', return_messages=True, output_key='answer', human_prefix="<|user|>", ai_prefix="<|assistant|>", chat_memory=msgs)