Replies: 3 comments
-
To address your issue with setting IDs in Human and AI messages using
Here's an example of how you might implement this: def add_message_with_id(self, message: BaseMessage, message_id: str) -> None:
"""Append the message with an ID to the record in Redis"""
message_dict = message_to_dict(message)
message_dict["id"] = message_id # Add the ID to the message dictionary
self.redis_client.lpush(self.key, json.dumps(message_dict))
if self.ttl:
self.redis_client.expire(self.key, self.ttl) This approach allows you to maintain the order of messages and associate each message with a unique ID by embedding the ID within the message object itself. Remember, any modifications to the Additionally, you'll need to update or extend existing unit tests for both the For more detailed implementation and testing, you might want to refer to the source code and unit tests of the
|
Beta Was this translation helpful? Give feedback.
-
It looks like, a suggestion from the bot is not very helpful. How to pass the message_id from conversational_rag_chain.invoke() to the actual Redis handler adding the message to Redis. |
Beta Was this translation helpful? Give feedback.
-
We are having the same issue. It seems like a very commonsense feature to have in your implementation, for example if you want to store user feedback on specific messages. |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
I'm using RedisChatMessageHistory. I want to save id to messages I receive from other services. But I can't find where and how to set them.
Thanks
System Info
Beta Was this translation helpful? Give feedback.
All reactions