by @Charly_Wargnier that demos the interplay of Streamlit, Langchain, Trubrics and Langsmith. I am running this app locally and I get cross-talk between sessions regarding the chat history.
In this app, chat history is handled by Langchain ConversationBufferMemory using StreamlitChatMessageHistory. I suspect the problem is the following: The memory is created per session, but it is handed over to the function that sets up the LLM chain (in essential_chain.py). Since this function is cached all subsequent sessions also use the memory object created by the first session.
Of course caching the setup of the llm chain is important. So, is there a way to have this function cached per session instead of globally?
There are similar post with a lot of discussion on the topic of caching session data as opposed to the global cache performed by default via Streamlitâs caching mechanism that caches data globally across all users.
Thank you for your reply. That was helpful indeed. Adding a session-id as parameter to the cached function that provides the llm chain solved the problem. Maybe @Charly_Wargnier could add that to his demo code, too?!
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking âAccept allâ, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.