No project description provided
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
chatgpt_memory-0.0.1.tar.gz
(16.2 kB
view details)
Built Distribution
File details
Details for the file chatgpt_memory-0.0.1.tar.gz
.
File metadata
- Download URL: chatgpt_memory-0.0.1.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.1 CPython/3.10.9 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93d45e5ea41dae46ea69b43202a86cfc788e20850b1df2dea3ce8e08498b21b6 |
|
MD5 | afdaa7838ea64496c2f7827502c3877c |
|
BLAKE2b-256 | ee1abe65b476de84b5b1e04ee5d6a1b3774f1edd1a9db96028149be6fae8a919 |
File details
Details for the file chatgpt_memory-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: chatgpt_memory-0.0.1-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.1 CPython/3.10.9 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a86c00c05884afe205916f206d04bd92b143d5bc1b3b94d26dde6494db86ca74 |
|
MD5 | 907c38ad36f101b5429ecda3945e8267 |
|
BLAKE2b-256 | a6dcbb53028d71d1e20825b46f5e60569af1aeefbfc4c25d1dfe52a82f78a75d |