Add automatic retry logic for transient Gemini API errors (503, 429)#385
Open
YuqiGuo105 wants to merge 2 commits intogoogle:mainfrom
Open
Add automatic retry logic for transient Gemini API errors (503, 429)#385YuqiGuo105 wants to merge 2 commits intogoogle:mainfrom
YuqiGuo105 wants to merge 2 commits intogoogle:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Fixes google#240 This change implements exponential backoff retry for transient errors in the Gemini provider, preventing entire document processing failures when a single chunk encounters temporary service overload (503) or rate limiting (429) errors. Changes: - Add retry configuration parameters (max_retries, retry_delay, max_retry_delay) - Implement _is_retryable_error() to distinguish temporary vs permanent errors - Add exponential backoff retry logic in _process_single_prompt() - Each chunk retries independently without affecting other chunks - Add comprehensive test coverage (30 test cases) Benefits: - Prevents API quota waste from re-processing entire documents - Reduces 429 errors from excessive retries - Improves reliability for large batch processing
beaf0dc to
5152918
Compare
65139a1 to
5152918
Compare
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #240
This change implements exponential backoff retry for transient errors in the Gemini provider, preventing entire document processing failures when a single chunk encounters temporary service overload (503) or rate limiting (429) errors.
Changes:
max_retries,retry_delay,max_retry_delay)_is_retryable_error()to distinguish temporary vs permanent errors_process_single_prompt()How Has This Been Tested?
Test suite in
tests/test_gemini_retry.pywith 30 test cases covering error classification, retry logic, parallel processing, and configuration.Checklist