Langchain - Memory

Hi all,

If you are looking into implementing the langchain memory to mimic a chatbot in streamlit using openAI API, here is the code snippet that might help you.

you need to put st.cache_resource and put all the functions in a function call.


To anyone in the same boat, the decorator below also works:


1 Like

By adding memory to cache, it saves same history for all session.
How to save langchain’s chat history per session?