模块
示例(Examples)
Redis 聊天消息历史(Redis Chat Message History)

Redis Chat Message History #

This notebook goes over how to use Redis to store chat message history.

from langchain.memory import RedisChatMessageHistory

history = RedisChatMessageHistory("foo")

history.add_user_message("hi!")

history.add_ai_message("whats up?")
history.messages
[AIMessage(content='whats up?', additional_kwargs={}),
 HumanMessage(content='hi!', additional_kwargs={})]