Skip to content

max_retries and backoff config not applied; improve retry logic for quota errors #857

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

Open
louisgthier opened this issue Apr 13, 2025 · 1 comment · May be fixed by #915
Open

max_retries and backoff config not applied; improve retry logic for quota errors #857

louisgthier opened this issue Apr 13, 2025 · 1 comment · May be fixed by #915
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@louisgthier
Copy link

In libs/genai/langchain_google_genai/chat_models.py, the max_retries parameter appears to be unused — the retry mechanism always defaults to 2 retries regardless of the value passed.

Additionally, the following backoff-related parameters are currently hardcoded:

multiplier = 2
min_seconds = 1
max_seconds = 60

It would be helpful to make these configurable so that users can adjust the retry behavior as needed.

Lastly, for cases where the API returns a quota-exceeded error and provides a recommended retry delay, it would be good to parse that value and wait accordingly, if the suggested delay is less than the configured timeout. This would allow for more efficient handling of rate limits.

@lkuligin
Copy link
Collaborator

would you be open to send a PR for this, please?

@lkuligin lkuligin added enhancement New feature or request good first issue Good for newcomers labels Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
2 participants