feat(google-genai): add timeout and max_retries to chat generator#2875
Merged
bogdankostic merged 4 commits intodeepset-ai:mainfrom Mar 3, 2026
Merged
Conversation
Contributor
Author
bogdankostic
requested changes
Mar 2, 2026
Contributor
bogdankostic
left a comment
There was a problem hiding this comment.
Thanks for the PR @Keyur-S-Patel! I just have a small comment on how the PR can be improved.
Comment on lines
73
to
80
| if http_options is not None: | ||
| return Client( | ||
| vertexai=True, | ||
| project=vertex_ai_project, | ||
| location=vertex_ai_location, | ||
| http_options=http_options, | ||
| ) | ||
| return Client(vertexai=True, project=vertex_ai_project, location=vertex_ai_location) |
Contributor
There was a problem hiding this comment.
Since the SDK accepts http_options=None (default), we can simplify this branch by always passing http_options=http_options
Suggested change
| if http_options is not None: | |
| return Client( | |
| vertexai=True, | |
| project=vertex_ai_project, | |
| location=vertex_ai_location, | |
| http_options=http_options, | |
| ) | |
| return Client(vertexai=True, project=vertex_ai_project, location=vertex_ai_location) | |
| return Client(vertexai=True, project=vertex_ai_project, location=vertex_ai_location, http_options=http_options) |
Comment on lines
85
to
87
| if http_options is not None: | ||
| return Client(vertexai=True, api_key=resolved_api_key, http_options=http_options) | ||
| return Client(vertexai=True, api_key=resolved_api_key) |
Contributor
There was a problem hiding this comment.
Suggested change
| if http_options is not None: | |
| return Client(vertexai=True, api_key=resolved_api_key, http_options=http_options) | |
| return Client(vertexai=True, api_key=resolved_api_key) | |
| return Client(vertexai=True, api_key=resolved_api_key, http_options=http_options) |
Comment on lines
94
to
96
| if http_options is not None: | ||
| return Client(api_key=resolved_api_key, http_options=http_options) | ||
| return Client(api_key=resolved_api_key) |
Contributor
There was a problem hiding this comment.
Suggested change
| if http_options is not None: | |
| return Client(api_key=resolved_api_key, http_options=http_options) | |
| return Client(api_key=resolved_api_key) | |
| return Client(api_key=resolved_api_key, http_options=http_options) |
Keyur-S-Patel
commented
Mar 3, 2026
Contributor
Author
Keyur-S-Patel
left a comment
There was a problem hiding this comment.
Address the feedback regarding None branch
4 tasks
bogdankostic
approved these changes
Mar 3, 2026
Contributor
bogdankostic
left a comment
There was a problem hiding this comment.
Thanks for the PR @Keyur-S-Patel, looking good :)
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.
Related Issues
Proposed Changes:
timeoutandmax_retriestoGoogleGenAIChatGenerator.__init__._get_client(...)to accepttimeoutandmax_retries.types.HttpRetryOptions(attempts=max_retries)types.HttpOptions(timeout=<milliseconds>, retry_options=...)genai.Client(..., http_options=...).HttpOptions.GoogleGenAIChatGenerator._get_clientforwarding throughhttp_optionsHow did you test it?
hatch run test:unit tests/test_utils.pyhatch run test:unit tests/test_chat_generator.pyAll selected unit tests passed on this branch.
Notes for the reviewer
HttpOptions.http_options+ retry policy) rather than passing raw top-level kwargs.Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.