From d8ebf6c8c63a48cd5046fd5918192c176248c81d Mon Sep 17 00:00:00 2001 From: afourney Date: Mon, 9 Oct 2023 13:15:39 -0700 Subject: [PATCH 1/6] Output a warning if attempting to load the OAI_CONFIG_LIST from a file, but the file is not found. (#174) --- 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) From 4522900487b65766d0f89dd30b10b6021b45e313 Mon Sep 17 00:00:00 2001 From: afourney Date: Mon, 9 Oct 2023 14:30:20 -0700 Subject: [PATCH 2/6] Warn if GroupChat is underpopulatd. (#170) --- autogen/agentchat/groupchat.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/autogen/agentchat/groupchat.py b/autogen/agentchat/groupchat.py index fae72f26ac4..d2f53002b41 100644 --- a/autogen/agentchat/groupchat.py +++ b/autogen/agentchat/groupchat.py @@ -3,6 +3,9 @@ from typing import Dict, List, Optional, Union from .agent import Agent from .conversable_agent import ConversableAgent +import logging + +logger = logging.getLogger(__name__) @dataclass @@ -42,6 +45,14 @@ def select_speaker_msg(self): def select_speaker(self, last_speaker: Agent, selector: ConversableAgent): """Select the next speaker.""" selector.update_system_message(self.select_speaker_msg()) + + # Warn if GroupChat is underpopulated, without established changing behavior + n_agents = len(self.agent_names) + if n_agents < 3: + logger.warning( + f"GroupChat is underpopulated with {n_agents} agents. Direct communication would be more efficient." + ) + final, name = selector.generate_oai_reply( self.messages + [ From 9571b7fbe753c91f4a7460d6a7c16ce13f33b98f Mon Sep 17 00:00:00 2001 From: afourney Date: Mon, 9 Oct 2023 16:27:54 -0700 Subject: [PATCH 3/6] Display a warning if use_docker evlauates to True but the python docker package is not available. (#172) Co-authored-by: Qingyun Wu --- autogen/code_utils.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/autogen/code_utils.py b/autogen/code_utils.py index ff97f567de5..a338e642e67 100644 --- a/autogen/code_utils.py +++ b/autogen/code_utils.py @@ -218,7 +218,7 @@ def execute_code( timeout: Optional[int] = None, filename: Optional[str] = None, work_dir: Optional[str] = None, - use_docker: Optional[Union[List[str], str, bool]] = docker is not None, + use_docker: Optional[Union[List[str], str, bool]] = True, lang: Optional[str] = "python", ) -> Tuple[int, str, str]: """Execute code in a docker container. @@ -257,6 +257,15 @@ def execute_code( logger.error(error_msg) raise AssertionError(error_msg) + # Warn if docker was requested but cannot be provided. In this case + # the current behavior is to fall back to run natively, but this behavior + # is subject to change. + if use_docker and docker is None: + use_docker = False + logger.warning( + "execute_code was called with use_docker evaluating to True, but the python docker package is not available. Falling back to native code execution. Note: this fallback behavior is subject to change" + ) + timeout = timeout or DEFAULT_TIMEOUT original_filename = filename if WIN32 and lang in ["sh", "shell"] and (not use_docker): From 72239a6d5d00f4d0d94a337a966ee8cd2235ce80 Mon Sep 17 00:00:00 2001 From: Chi Wang Date: Mon, 9 Oct 2023 17:08:08 -0700 Subject: [PATCH 4/6] bump version to 0.1.9 (#177) Co-authored-by: Qingyun Wu --- autogen/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen/version.py b/autogen/version.py index 9cb17e79762..c11f861afbe 100644 --- a/autogen/version.py +++ b/autogen/version.py @@ -1 +1 @@ -__version__ = "0.1.8" +__version__ = "0.1.9" From afdff3ea14c53b69253072258d96e49eacdbf263 Mon Sep 17 00:00:00 2001 From: afourney Date: Mon, 9 Oct 2023 17:17:36 -0700 Subject: [PATCH 5/6] Warn if oai.Completion is provided with an empty config_list (#178) Co-authored-by: Qingyun Wu --- autogen/oai/completion.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/autogen/oai/completion.py b/autogen/oai/completion.py index fa01616128a..595cbe3bed0 100644 --- a/autogen/oai/completion.py +++ b/autogen/oai/completion.py @@ -768,6 +768,13 @@ def yes_or_no_filter(context, config, response): """ if ERROR: raise ERROR + + # Warn if a config list was provided but was empty + if type(config_list) is list and len(config_list) == 0: + logger.warning( + "Completion was provided with a config_list, but the list was empty. Adopting default OpenAI behavior, which reads from the 'model' parameter instead." + ) + if config_list: last = len(config_list) - 1 cost = 0 From 37a07a83c3c3c938e54b837329c885d815d0cd0f Mon Sep 17 00:00:00 2001 From: Li Jiang Date: Tue, 10 Oct 2023 13:21:56 +0800 Subject: [PATCH 6/6] Bump version to 0.1.10 (#181) --- autogen/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen/version.py b/autogen/version.py index c11f861afbe..569b1212f7e 100644 --- a/autogen/version.py +++ b/autogen/version.py @@ -1 +1 @@ -__version__ = "0.1.9" +__version__ = "0.1.10"