Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Improved logging on connection fail to redis

Eesa Hamzaa850c27dd553
diff --git a/scripts/memory/redismem.py b/scripts/memory/redismem.py
index 2082fe5887..1267c4de2d 100644
--- a/scripts/memory/redismem.py
+++ b/scripts/memory/redismem.py
@@ -7,6 +7,8 @@ from redis.commands.search.indexDefinition import IndexDefinition, IndexType
import numpy as np
from memory.base import MemoryProviderSingleton, get_ada_embedding
+from logger import logger
+from colorama import Fore, Style
SCHEMA = [
@@ -44,6 +46,18 @@ class RedisMemory(MemoryProviderSingleton):
db=0 # Cannot be changed
)
self.cfg = cfg
+
+ # Check redis connection
+ try:
+ self.redis.ping()
+ except redis.ConnectionError as e:
+ logger.typewriter_log("FAILED TO CONNECT TO REDIS", Fore.RED, Style.BRIGHT + str(e) + Style.RESET_ALL)
+ logger.typewriter_log("DOUBLE CHECK CONFIGURATION",
+ Fore.YELLOW,
+ "Please ensure you have setup and configured redis properly for use. " +
+ f"You can check out {Fore.CYAN + Style.BRIGHT}https://github.com/Torantulino/Auto-GPT#redis-setup{Style.RESET_ALL} to ensure you've set up everything correctly.")
+ exit(1)
+
if cfg.wipe_redis_on_start:
self.redis.flushall()
try: