-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[Question]: Redis Chat Store with ChatSummaryMemoryBuffer guide #13308
Comments
Yes, the RedisChatStore is indeed supported and can be effectively used with the ChatSummaryMemoryBuffer for managing session-based memory history. Here's how you can integrate them:
This setup allows you to manage long chat histories efficiently by summarizing older messages and keeping the most relevant information within a specified token limit. For detailed examples and tests, including handling token limits and summarizing long messages, refer to the
|
It's definitely still supported 😅 at first glance the not response looks right. I can check further in a bit |
Thanks a lot, @logan-markewich , please let me know! And just to confirm I can pass chat_summary_memory_buffer to the agent.chat directly directly for dynamic updation of user conversation instead of the manual chat_summary_memory_buffer.put |
pydantic.v1.error_wrappers.ValidationError: 1 validation error for ChatSummaryMemoryBuffer Getting this error when building with redis client
|
This worked for me: from llama_index.core.memory import ChatSummaryMemoryBuffer
from llama_index.storage.chat_store.redis import RedisChatStore
from llama_index.core import Document, VectorStoreIndex
index = VectorStoreIndex.from_documents([Document.example()])
chat_store = RedisChatStore(redis_url="redis://localhost:6379")
memory = ChatSummaryMemoryBuffer.from_defaults(
token_limit=5000,
chat_store=chat_store,
chat_store_key="user123"
)
chat_engine = index.as_chat_engine(
chat_mode="condense_plus_context",
memory=memory
)
response = chat_engine.chat("hello!")
print(memory.get_all())
chat_store = RedisChatStore(redis_url="redis://localhost:6379")
memory = ChatSummaryMemoryBuffer.from_defaults(
token_limit=5000,
chat_store=chat_store,
chat_store_key="user123"
)
print(memory.get_all()) Although I noticed a bug in |
I am getting |
Never mind, found it in #12364 |
@logan-markewich seem like when you call the chat_engine, that's when the redis data gets pushed
How do we do that when we are using agent.chat? I tried a couple of time even added this chat_mode in agent.chat but redis doesn't seem to get updated. |
@risos8200 that's not when it gets pushed? It gets pushed on every .chat() call? |
It seems to work fine for me, other than that bug I mentioned above |
Base on my analysis of the code, there is |
@risos8200 are you able to get messages showing up at Redis side? Even I am not seeing this updated at Redis side. I am using stream_chat call. |
Expected type 'BaseChatStore | None', got 'RedisChatStore' instead getting above mentioned error on the following line memory = ChatMemoryBuffer.from_defaults( |
Question Validation
Question
Is the redis chat store still supported?
I am trying to have a session managed based memory history, some another question recommended using chat store with keys, so I wanted to use Redis Chat Store to do so. Anyone has guide or test examples for using redischatstore with the new ChatSummaryMemoryBuffer?
The text was updated successfully, but these errors were encountered: