Redis Chatgpt
This package is a useful tool specifically developed for effectively handling chat message history. This Python package's primary goal is to provide a reliable, efficient, and simple method to store chat logs in a Redis database.
redis_chatgpt makes use of Redis, a fast, efficient, and highly scalable in-memory data structure store. By organizing and preserving the chat message history in Redis, users can retrieve message history promptly and easily with the best performance.
This package is the perfect solution if you need to store and recover chat histories effortlessly from the Redis Database. With redis_chatgpt, you can streamline your chat log management tasks while becoming more productive and efficient with your resources.
Getting started
pip install redis-chatgpt
To build a simple data store:
from redis_chatgpt.manager import RedisManager
redis_db = RedisManager(host="localhost", port=6379)
Set data
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)
Get data
chat_history = redis_db.get_data(redis_key)
Truncate history(conversation)
# 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)
Use with FastAPI Swagger
cd examples/chatbot
- Get your
OpenAIAPI key here. - Copy env.example .env (set fastapi webserver workers and openai api key)
cp env.example .env docker-compose up -d- check out :
http://0.0.0.0:8012/docs
Metadata
Release files for redis-chatgpt 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| redis_chatgpt-0.1.2.tar.gz | 3.6 kB | Without provenance | Details for redis_chatgpt-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| redis_chatgpt-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for redis_chatgpt-0.1.2-py3-none-any.whl |
Total release size: 7.8 kB
Release files / redis_chatgpt-0.1.2.tar.gz
| Download URL | redis_chatgpt-0.1.2.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c1d4bcac788fc0bf2acbce9b4dd1f2def6cefd8bd6b7b403f6e876221b004c1
|
|
BLAKE2b-256 checksum How to use checksums |
82a1ec3d93147b751d437f05ca38f0cf4e7999d16e1476a086d5e2e4f431965a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / redis_chatgpt-0.1.2-py3-none-any.whl
| Download URL | redis_chatgpt-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b83a81c9fbeaf514f04b55c8706f4a0c57c0693906ec2ee6d7b3146010fb793
|
|
BLAKE2b-256 checksum How to use checksums |
83fdd1198b768872dfe03eeb26dea3d60c8c6a70ae37357a8a3fd781b01ca915
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for redis-chatgpt 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.