From 3b0226b2c64d144f8e6cdea52bd3f80b87ffbd86 Mon Sep 17 00:00:00 2001 From: Michael Gorham Date: Mon, 22 Jan 2024 22:59:59 -0700 Subject: [PATCH] docs: Update redis_chat_message_history.ipynb (#16344) ## Problem Spent several hours trying to figure out how to pass `RedisChatMessageHistory` as a `GetSessionHistoryCallable` with a different REDIS hostname. This example kept connecting to `redis://localhost:6379`, but I wanted to connect to a server not hosted locally. ## Cause Assumption the user knows how to implement `BaseChatMessageHistory` and `GetSessionHistoryCallable` ## Solution Update documentation to show how to explicitly set the REDIS hostname using a lambda function much like the MongoDB and SQLite examples. --- .../docs/integrations/memory/redis_chat_message_history.ipynb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/docs/integrations/memory/redis_chat_message_history.ipynb b/docs/docs/integrations/memory/redis_chat_message_history.ipynb index 0b68c886414..3e79998e729 100644 --- a/docs/docs/integrations/memory/redis_chat_message_history.ipynb +++ b/docs/docs/integrations/memory/redis_chat_message_history.ipynb @@ -139,7 +139,9 @@ "\n", "chain_with_history = RunnableWithMessageHistory(\n", " chain,\n", - " RedisChatMessageHistory,\n", + " lambda session_id: RedisChatMessageHistory(\n", + " session_id, url=\"redis://localhost:6379\"\n", + " ),\n", " input_messages_key=\"question\",\n", " history_messages_key=\"history\",\n", ")\n",