Home Software Github Colabs Shell Basics Apis Webscraping Nbdev Javascript Packages Cloud Functions Browser Extensions Path Css Css Animations Fonts Unicode Ascii Javascript Llm Paradigms Protocols Webrtc Websites Windows Food Cook Food Fish Food Science History Dad History History Life DateIdeas Life Words

Don't Look! I'm changing!

URL Copied

https://www.intercom.com/

https://github.com/ShumzZzZz/GPT-Rambling/blob/main/LangChain%20Specific/langchain_persist_conversation_memory.ipynb

from langchain.schema import messages_from_dict, messages_to_dict extracted_messages = original_chain.memory.chat_memory.messages

ingest_to_db = messages_to_dict(extracted_messages)

retrieve_from_db = json.loads(json.dumps(ingest_to_db))

retrieved_messages = messages_from_dict(retrieve_from_db)

retrieved_chat_history = ChatMessageHistory(messages=retrieved_messages)

retrieved_memory = ConversationBufferMemory(chat_memory=retrieved_chat_history)

reloaded_chain = ConversationChain( llm=llm, verbose=True, memory=retrieved_memory ) reloaded_chain.run('what about Javascript and Ruby')