langchain_community.chat_message_histories.upstash_redis
.UpstashRedisChatMessageHistory¶
- class langchain_community.chat_message_histories.upstash_redis.UpstashRedisChatMessageHistory(session_id: str, url: str = '', token: str = '', key_prefix: str = 'message_store:', ttl: Optional[int] = None)[source]¶
Chat message history stored in an Upstash Redis database.
Attributes
key
Construct the record key to use
messages
Retrieve the messages from Upstash Redis
Methods
__init__
(session_id[, url, token, ...])add_ai_message
(message)Convenience method for adding an AI message string to the store.
add_message
(message)Append the message to the record in Upstash Redis
add_user_message
(message)Convenience method for adding a human message string to the store.
clear
()Clear session memory from Upstash Redis
- __init__(session_id: str, url: str = '', token: str = '', key_prefix: str = 'message_store:', ttl: Optional[int] = None)[source]¶
- add_ai_message(message: Union[AIMessage, str]) None ¶
Convenience method for adding an AI message string to the store.
- Parameters
message – The AI message to add.
- add_message(message: BaseMessage) None [source]¶
Append the message to the record in Upstash Redis
- add_user_message(message: Union[HumanMessage, str]) None ¶
Convenience method for adding a human message string to the store.
- Parameters
message – The human message to add