Skip to content

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

Open
@louisgthier

Description

@louisgthier

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions