Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions autogen/oai/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
ServiceUnavailableError,
RateLimitError,
APIError,
InvalidRequestError,
BadRequestError,
APIConnectionError,
Timeout,
AuthenticationError,
Expand Down Expand Up @@ -261,7 +261,7 @@ def _get_response(cls, config: Dict, raise_on_ratelimit_or_timeout=False, use_ca
f"Failed to get response from openai api due to getting RateLimitError or Timeout for {max_retry_period} seconds."
)
return response
except InvalidRequestError:
except BadRequestError:
if "azure" in config.get("api_type", openai.api_type) and "model" in config:
# azure api uses "engine" instead of "model"
config["engine"] = config.pop("model").replace("gpt-3.5-turbo", "gpt-35-turbo")
Expand Down Expand Up @@ -817,7 +817,7 @@ def yes_or_no_filter(context, config, response):
response["pass_filter"] = pass_filter
return response
cost += response["cost"]
except (AuthenticationError, RateLimitError, Timeout, InvalidRequestError):
except (AuthenticationError, RateLimitError, Timeout, BadRequestError):
logger.debug(f"failed with config {i}", exc_info=1)
if i == last:
raise
Expand Down