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.
Added a memory backend argument
Eesa Hamza083ccb6bd369
diff --git a/scripts/main.py b/scripts/main.pyindex 15af0c3812..c5963635bf 100644--- a/scripts/main.py+++ b/scripts/main.py@@ -2,7 +2,7 @@ import jsonimport randomimport commands as cmdimport utils-from memory import get_memory+from memory import get_memory, get_supported_memory_backendsimport dataimport chatfrom colorama import Fore, Style@@ -276,6 +276,7 @@ def parse_arguments():parser.add_argument('--debug', action='store_true', help='Enable Debug Mode')parser.add_argument('--gpt3only', action='store_true', help='Enable GPT3.5 Only Mode')parser.add_argument('--gpt4only', action='store_true', help='Enable GPT4 Only Mode')+ parser.add_argument('--use-memory', '-m', dest="memory_type", help='Defines which Memory backend to use')args = parser.parse_args()if args.continuous:@@ -302,6 +303,15 @@ def parse_arguments():print_to_console("Debug Mode: ", Fore.GREEN, "ENABLED")cfg.set_debug_mode(True)+ if args.memory_type:+ supported_memory = get_supported_memory_backends()+ chosen = args.memory_type+ if not chosen in supported_memory:+ print_to_console("ONLY THE FOLLOWING MEMORY BACKENDS ARE SUPPORTED: ", Fore.RED, f'{supported_memory}')+ print_to_console(f"Defaulting to: ", Fore.YELLOW, cfg.memory_backend)+ else:+ cfg.memory_backend = chosen+# TODO: fill in llm values herecheck_openai_api_key()diff --git a/scripts/memory/__init__.py b/scripts/memory/__init__.pyindex a441a46aa9..f4ba5206d3 100644--- a/scripts/memory/__init__.py+++ b/scripts/memory/__init__.py@@ -1,17 +1,21 @@from memory.local import LocalCache++supported_memory = ['local']+try:from memory.redismem import RedisMemory+ supported_memory.append('redis')except ImportError:print("Redis not installed. Skipping import.")RedisMemory = Nonetry:from memory.pinecone import PineconeMemory+ supported_memory.append('pinecone')except ImportError:print("Pinecone not installed. Skipping import.")PineconeMemory = None-def get_memory(cfg, init=False):memory = Noneif cfg.memory_backend == "pinecone":@@ -35,6 +39,8 @@ def get_memory(cfg, init=False):memory.clear()return memory+def get_supported_memory_backends():+ return supported_memory__all__ = ["get_memory",