redis chatgpt
v0.1.2
이 패키지는 채팅 메시지 기록을 효과적으로 처리하기 위해 특별히 개발 된 유용한 도구입니다. 이 Python 패키지의 주요 목표는 Redis 데이터베이스에 채팅 로그를 저장하는 신뢰할 수 있고 효율적이며 간단한 방법을 제공하는 것입니다.
Redis_chatgpt는 빠르고 효율적이며 확장 가능한 메모리 데이터 구조 저장소 인 Redis를 사용합니다. Redis에서 채팅 메시지 기록을 구성하고 보존함으로써 사용자는 최고의 성능으로 메시지 기록을 즉시 쉽게 검색 할 수 있습니다.
이 패키지는 Redis 데이터베이스에서 쉽게 채팅 역사를 저장하고 복구 해야하는 경우 완벽한 솔루션입니다. redis_chatgpt를 사용하면 채팅 로그 관리 작업을 간소화하면서 리소스를보다 생산적이고 효율적으로 만들 수 있습니다.
pip install redis-chatgpt
간단한 데이터 저장소 구축 :
from redis_chatgpt.manager import RedisManager
redis_db = RedisManager(host="localhost", port=6379)
데이터 설정
redis_key = "chat_key"
chat_memory = [
{
"role": "system",
"content": "Assistant is a large language model trained by OpenAI."
},
{
"role": "assistant",
"content": "Hello! How can I assist you today?"
},
{
"role": "user",
"content": "hi"
},
]
redis_db.set_data(redis_key, chat_memory)
데이터를 얻으십시오
chat_history = redis_db.get_data(redis_key)
역사를 자르기 (대화)
# You can choose whether to update the Redis database or
# not by specifying the 'overwrite' parameter (boolean).
data = redis_db.truncate_conversation(redis_key, overwrite=True)
cd examples/chatbot
OpenAI
API 키를 얻으십시오.cp env.example .env
docker-compose up -d
http://0.0.0.0:8012/docs