mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 16:43:35 +00:00
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.
This commit is contained in:
parent
c98994c3c9
commit
3b0226b2c6
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user