From afdff3ea14c53b69253072258d96e49eacdbf263 Mon Sep 17 00:00:00 2001 From: afourney Date: Mon, 9 Oct 2023 17:17:36 -0700 Subject: [PATCH] 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 fa01616128ad..595cbe3bed00 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