From 0990ab146c1d64b2969d8b43e412d9c7db5cbe02 Mon Sep 17 00:00:00 2001 From: Robbie Cronin Date: Sat, 6 Jul 2024 05:48:11 +1000 Subject: [PATCH] community: update import in chatbot tutorial to use InMemoryChatMessageHistory (#23903) Summary of change: - Replace ChatMessageHistory with InMemoryChatMessageHistory Fixes #23892 --------- Co-authored-by: Eugene Yurtsev Co-authored-by: Eugene Yurtsev --- docs/docs/tutorials/chatbot.ipynb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/docs/tutorials/chatbot.ipynb b/docs/docs/tutorials/chatbot.ipynb index 5072d2c471..05f73ef952 100644 --- a/docs/docs/tutorials/chatbot.ipynb +++ b/docs/docs/tutorials/chatbot.ipynb @@ -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",