Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No value was obtained for history.messages in RedisChatMessageHistory #30535

Open
5 tasks done
1098842836 opened this issue Mar 28, 2025 · 5 comments
Open
5 tasks done
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@1098842836
Copy link

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

`from langchain_redis import RedisChatMessageHistory
from langchain_core.messages import AIMessage, HumanMessage

history = RedisChatMessageHistory(session_id="test002",
redis_url="redis://localhost:6379",
key_prefix="chat_test:",
)

Add messages to the history

history.add_user_message("Hello, AI assistant!")
history.add_ai_message("Hello! How can I assist you today?")

Retrieve messages

print("Chat History:")
for message in history.messages:
print(f"{type(message).name}: {message.content}")

(myenv) PS D:\java-project\RuoYi\Russ-AI-Python> d:; cd 'd:\java-project\RuoYi\Russ-AI-Python'; & 'd:\software\system-software\Anaconda\envs\myenv\python.exe' 'c:\Users\yl.cursor\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher' '60479' '--' 'd:\java-project\RuoYi\Russ-AI-Python\src\test555.py'
Chat History:

As long as key_prefix is added for the first initialization, history.messages will not get any value`

Error Message and Stack Trace (if applicable)

No response

Description

As long as key_prefix is added for the first initialization, history.messages will not get any value

System Info

(myenv) PS D:\java-project\RuoYi\Russ-AI-Python> d:; cd 'd:\java-project\RuoYi\Russ-AI-Python'; & 'd:\software\system-software\Anaconda\envs\myenv\python.exe' 'c:\Users\yl.cursor\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher' '60479' '--' 'd:\java-project\RuoYi\Russ-AI-Python\src\test555.py'
Chat History:

@dosubot dosubot bot added the 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature label Mar 28, 2025
@1098842836
Copy link
Author

session_id="RAG_admin_ceshi-999" also does not work, you must remove the superfluous symbol RAGadminceshi999

@eyurtsev
Copy link
Collaborator

Would appreciate a bug fix if you're able to do it!


We also recommend that users transition to langgraph for memory use cases. We have a much more limited offering there of integrations, but the implementations generalize to things beyond just a message history.

https://langchain-ai.github.io/langgraph/tutorials/introduction/

It's also much simpler to set up

@keenborder786
Copy link
Contributor

@1098842836 what is the version of langchain_redis you are using. Since it works fine for me on the latest version.

@1098842836
Copy link
Author

@1098842836 what is the version of langchain_redis you are using. Since it works fine for me on the latest version.

Name: langchain-redis
Version: 0.2.0
Summary: An integration package connecting Redis and LangChain
Home-page: https://github.com/langchain-ai/langchain-redis
Author: Brian Sam-Bodden
Author-email: [email protected]
License: MIT
Location: D:\software\system-software\Anaconda\envs\myenv\Lib\site-packages
Requires: jinja2, langchain-core, numpy, python-ulid, redisvl
Required-by:

@1098842836
Copy link
Author

@1098842836 what is the version of langchain_redis you are using. Since it works fine for me on the latest version.

@1098842836 what is the version of langchain_redis you are using. Since it works fine for me on the latest version.

Would appreciate a bug fix if you're able to do it!

We also recommend that users transition to langgraph for memory use cases. We have a much more limited offering there of integrations, but the implementations generalize to things beyond just a message history.

https://langchain-ai.github.io/langgraph/tutorials/introduction/

It's also much simpler to set up

I'd be more than happy to fix this bug if the author would let me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants