Spaces:
Sleeping
Sleeping
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) |