ChatGPT Memory
Allows to scale the ChatGPT API to multiple simultaneous sessions with infinite contextual and adaptive memory powered by GPT and Redis datastore.
Getting Started
## set the following ENVIRONMENT Variables before running this script
from chatgpt_memory.environment import OPENAI_API_KEY, REDIS_HOST, REDIS_PASSWORD, REDIS_PORT
from chatgpt_memory.datastore.config import RedisDataStoreConfig
from chatgpt_memory.datastore.redis import RedisDataStore
from chatgpt_memory.llm_client.openai.conversation.chatgpt_client import ChatGPTClient
from chatgpt_memory.llm_client.openai.conversation.config import ChatGPTConfig
from chatgpt_memory.llm_client.openai.embedding.config import EmbeddingConfig
from chatgpt_memory.llm_client.openai.embedding.embedding_client import EmbeddingClient
from chatgpt_memory.memory.manager import MemoryManager
embedding_config = EmbeddingConfig(api_key=OPENAI_API_KEY)
embed_client = EmbeddingClient(config=embedding_config)
redis_datastore_config = RedisDataStoreConfig(
host=REDIS_HOST,
port=REDIS_PORT,
password=REDIS_PASSWORD,
)
redis_datastore = RedisDataStore(config=redis_datastore_config)
redis_datastore.connect()
redis_datastore.create_index()
memory_manager = MemoryManager(datastore=redis_datastore, embed_client=embed_client, topk=1)
chat_gpt_client = ChatGPTClient(
config=ChatGPTConfig(api_key=OPENAI_API_KEY, verbose=True), memory_manager=memory_manager
)
conversation_id = None
while True:
user_message = input("\n Please enter your message: ")
response = chat_gpt_client.converse(message=user_message, conversation_id=conversation_id)
conversation_id = response.conversation_id
print(response.chat_gpt_answer)
Release files for chatgpt-memory 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| chatgpt_memory-0.0.1.tar.gz | 16.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chatgpt_memory-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:37.6 kB
Release files / chatgpt_memory-0.0.1.tar.gz
| Download URL | chatgpt_memory-0.0.1.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93d45e5ea41dae46ea69b43202a86cfc788e20850b1df2dea3ce8e08498b21b6
|
|
BLAKE2b-256 checksum How to use checksums |
ee1abe65b476de84b5b1e04ee5d6a1b3774f1edd1a9db96028149be6fae8a919
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.1 CPython/3.10.9 Darwin/22.3.0
|
Release files / chatgpt_memory-0.0.1-py3-none-any.whl
| Download URL | chatgpt_memory-0.0.1-py3-none-any.whl |
|---|---|
| Size | 21.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a86c00c05884afe205916f206d04bd92b143d5bc1b3b94d26dde6494db86ca74
|
|
BLAKE2b-256 checksum How to use checksums |
a6dcbb53028d71d1e20825b46f5e60569af1aeefbfc4c25d1dfe52a82f78a75d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.1 CPython/3.10.9 Darwin/22.3.0
|