fix: raise error on last attempt failure in perform_completion_with_backoff. ref #989

This commit is contained in:
ntohidi
2025-09-02 16:49:01 +08:00
parent 6772134a3a
commit 487839640f

View File

@@ -1790,6 +1790,10 @@ def perform_completion_with_backoff(
except RateLimitError as e:
print("Rate limit error:", str(e))
if attempt == max_attempts - 1:
# Last attempt failed, raise the error.
raise
# Check if we have exhausted our max attempts
if attempt < max_attempts - 1:
# Calculate the delay and wait