mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-20 03:21:33 +00:00
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:
parent
ee8aa54f53
commit
0990ab146c
@ -270,8 +270,10 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from langchain_community.chat_message_histories import ChatMessageHistory\n",
|
"from langchain_core.chat_history import (\n",
|
||||||
"from langchain_core.chat_history import BaseChatMessageHistory\n",
|
" BaseChatMessageHistory,\n",
|
||||||
|
" InMemoryChatMessageHistory,\n",
|
||||||
|
")\n",
|
||||||
"from langchain_core.runnables.history import RunnableWithMessageHistory\n",
|
"from langchain_core.runnables.history import RunnableWithMessageHistory\n",
|
||||||
"\n",
|
"\n",
|
||||||
"store = {}\n",
|
"store = {}\n",
|
||||||
@ -279,7 +281,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"def get_session_history(session_id: str) -> BaseChatMessageHistory:\n",
|
"def get_session_history(session_id: str) -> BaseChatMessageHistory:\n",
|
||||||
" if session_id not in store:\n",
|
" if session_id not in store:\n",
|
||||||
" store[session_id] = ChatMessageHistory()\n",
|
" store[session_id] = InMemoryChatMessageHistory()\n",
|
||||||
" return store[session_id]\n",
|
" return store[session_id]\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user