diff --git a/crawl4ai/utils.py b/crawl4ai/utils.py index a871bc91..046351e7 100644 --- a/crawl4ai/utils.py +++ b/crawl4ai/utils.py @@ -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