Postgres
PostgreSQL also known as
Postgres, is a free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance.
本笔记本介绍了如何使用 Postgres 存储聊天消息历史记录。
from langchain_community.chat_message_histories import (
PostgresChatMessageHistory,
)
history = PostgresChatMessageHistory(
connection_string="postgresql://postgres:mypassword@localhost/chat_history",
session_id="foo",
)
history.add_user_message("hi!")
history.add_ai_message("whats up?")
API 参考:PostgresChatMessageHistory
history.messages