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

单存储数据库

此笔记本介绍如何使用 SingleStoreDB 存储聊天消息历史记录。

from langchain_community.chat_message_histories import (
SingleStoreDBChatMessageHistory,
)

history = SingleStoreDBChatMessageHistory(
session_id="foo", host="root:pass@localhost:3306/db"
)

history.add_user_message("hi!")

history.add_ai_message("whats up?")
history.messages