Skip to main content
Open In ColabOpen on 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={})]