Warn if oai.Completion is provided with an empty config_list (#178)

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
This commit is contained in:
afourney 2023-10-09 17:17:36 -07:00 committed by GitHub
parent 72239a6d5d
commit afdff3ea14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -768,6 +768,13 @@ class Completion(openai_Completion):
"""
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