Merge pull request #957 from cryptidv/master

Adds a '--use-memory' flag to choose memory backend at runtime
This commit is contained in:
Richard Beales
2023-04-12 19:33:30 +01:00
committed by GitHub
2 changed files with 20 additions and 2 deletions

View File

@@ -2,7 +2,7 @@ import json
import random
import commands as cmd
import utils
from memory import get_memory
from memory import get_memory, get_supported_memory_backends
import data
import chat
from colorama import Fore, Style
@@ -275,6 +275,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.debug:
@@ -305,6 +306,15 @@ def parse_arguments():
logger.typewriter_log("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 here
check_openai_api_key()