community: update import in chatbot tutorial to use InMemoryChatMessageHistory (#23903)

Summary of change:

- Replace ChatMessageHistory with InMemoryChatMessageHistory

Fixes #23892

---------

Co-authored-by: Eugene Yurtsev <eugene@langchain.dev>
Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This commit is contained in:
Robbie Cronin 2024-07-06 05:48:11 +10:00 committed by GitHub
parent ee8aa54f53
commit 0990ab146c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -270,8 +270,10 @@
"metadata": {},
"outputs": [],
"source": [
"from langchain_community.chat_message_histories import ChatMessageHistory\n",
"from langchain_core.chat_history import BaseChatMessageHistory\n",
"from langchain_core.chat_history import (\n",
" BaseChatMessageHistory,\n",
" InMemoryChatMessageHistory,\n",
")\n",
"from langchain_core.runnables.history import RunnableWithMessageHistory\n",
"\n",
"store = {}\n",
@ -279,7 +281,7 @@
"\n",
"def get_session_history(session_id: str) -> BaseChatMessageHistory:\n",
" if session_id not in store:\n",
" store[session_id] = ChatMessageHistory()\n",
" store[session_id] = InMemoryChatMessageHistory()\n",
" return store[session_id]\n",
"\n",
"\n",