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={})]