FalkorDB
FalkorDB 是一个开源图数据库管理系统,以其高效管理高度连接的数据而闻名。与传统数据库以表格形式存储数据不同,FalkorDB 使用图结构,包含节点、边和属性来表示和存储数据。这种设计允许对复杂的数据关系进行高性能查询。
本笔记本介绍了如何使用 FalkorDB 存储聊天消息历史记录
注意:您可以在本地使用 FalkorDB 或使用 FalkorDB Cloud。 请参阅安装说明
# For this example notebook we will be using FalkorDB locally
host = "localhost"
port = 6379
from langchain_falkordb.message_history import (
FalkorDBChatMessageHistory,
)
history = FalkorDBChatMessageHistory(host=host, port=port, session_id="session_id_1")
history.add_user_message("hi!")
history.add_ai_message("whats up?")
history.messages
[HumanMessage(content='hi!', additional_kwargs={}, response_metadata={}),
AIMessage(content='whats up?', additional_kwargs={}, response_metadata={})]