From 5fa4dc3fb0de507b9be02e62c04501ab18197bde Mon Sep 17 00:00:00 2001 From: Adam Fourney Date: Mon, 9 Oct 2023 11:46:54 -0700 Subject: [PATCH] Output a warning if attempting to load the OAI_CONFIG_LIST from a file, but the file is not found. --- autogen/oai/openai_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autogen/oai/openai_utils.py b/autogen/oai/openai_utils.py index b34d5d465ab..cbae458c59c 100644 --- a/autogen/oai/openai_utils.py +++ b/autogen/oai/openai_utils.py @@ -237,10 +237,12 @@ def config_list_from_json( if json_str: config_list = json.loads(json_str) else: + config_list_path = os.path.join(file_location, env_or_file) try: - with open(os.path.join(file_location, env_or_file)) as json_file: + with open(config_list_path) as json_file: config_list = json.load(json_file) except FileNotFoundError: + logging.warning(f"The specified config_list file '{config_list_path}' does not exist.") return [] return filter_config(config_list, filter_dict)