Dama03's picture
first push of the AI
411a994
raw
history blame contribute delete
512 Bytes
from langchain.memory import ChatMessageHistory, ConversationBufferMemory
def get_memory():
"""
Create a conversation memory with the latest LangChain syntax.
"""
# Create a message history object
message_history = ChatMessageHistory()
# Create a memory that uses the message history
memory = ConversationBufferMemory(
memory_key="chat_history",
chat_memory=message_history,
return_messages=True,
output_key="output"
)
return memory