Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidRequestError -> BadRequestError #389

Merged
merged 1 commit into from
Oct 23, 2023
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
Loading