Skip to main content
Open In Colab在 GitHub 上打开

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