mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
Merge pull request #115 from AndresCdo/open_ai_api_key
Introduce check to OPENAI_API_KEY
This commit is contained in:
@@ -17,6 +17,16 @@ import traceback
|
|||||||
import yaml
|
import yaml
|
||||||
import argparse
|
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(
|
def print_to_console(
|
||||||
title,
|
title,
|
||||||
@@ -277,7 +287,7 @@ def parse_arguments():
|
|||||||
|
|
||||||
|
|
||||||
# TODO: fill in llm values here
|
# TODO: fill in llm values here
|
||||||
|
check_openai_api_key()
|
||||||
cfg = Config()
|
cfg = Config()
|
||||||
parse_arguments()
|
parse_arguments()
|
||||||
ai_name = ""
|
ai_name = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user