Skip to content

Commit

Permalink
fix: handle badrequesterror
Browse files Browse the repository at this point in the history
  • Loading branch information
Naman-ntc committed Jan 17, 2025
1 parent b145991 commit a594dca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions r2e/llms/openai_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def _run_single(self, payload: list[dict[str, str]]) -> list[str]:
messages=payload, # type: ignore
**self.client_kwargs,
)
except openai.BadRequestError as e:
return [
f"OpenAI BadRequestError: {e}"
for _ in range(self.client_kwargs.get("n", 1))
]
except (
openai.APIError,
openai.RateLimitError,
Expand Down

0 comments on commit a594dca

Please sign in to comment.