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.

Update main.py

Andres Caicedo301ff85fd57d
diff --git a/scripts/main.py b/scripts/main.py
index 4e79974369..e334753f37 100644
--- a/scripts/main.py
+++ b/scripts/main.py
@@ -17,6 +17,16 @@ import traceback
import yaml
import argparse
+def check_openai_api_key():
+ """Check if the OpenAI API key is set in config.py or as an environment variable."""
+ if not cfg.openai_api_key:
+ print(
+ Fore.RED +
+ "Please set your OpenAI API key in config.py or as an environment variable."
+ )
+ print("You can get your key from https://beta.openai.com/account/api-keys")
+ exit(1)
+
def print_to_console(
title,
@@ -275,7 +285,7 @@ def parse_arguments():
# TODO: fill in llm values here
-
+check_openai_api_key()
cfg = Config()
parse_arguments()
ai_name = ""