Skip to main content
Open In ColabOpen on GitHub

FalkorDB

FalkorDB 是一个开源的图数据库管理系统,以其对高度关联数据的高效管理而闻名。与将数据存储在表格中的传统数据库不同,FalkorDB 使用包含节点、边和属性的图结构来表示和存储数据。这种设计使得在复杂的数据关系上能够实现高性能的查询。

该笔记本介绍了如何使用 FalkorDB 来存储聊天消息历史

注意:您可以本地使用FalkorDB,或使用FalkorDB云服务。查看安装说明

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