Skip to main content

Upstash Redis

Upstash 是一个无服务器的 RedisKafkaQStash API 提供商。

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

from langchain_community.chat_message_histories import (
UpstashRedisChatMessageHistory,
)

URL = "<UPSTASH_REDIS_REST_URL>"
TOKEN = "<UPSTASH_REDIS_REST_TOKEN>"

history = UpstashRedisChatMessageHistory(
url=URL, token=TOKEN, ttl=10, session_id="my-test-session"
)

history.add_user_message("hello llm!")
history.add_ai_message("hello user!")
history.messages

此页面是否有帮助?


您还可以留下详细的反馈 在 GitHub 上