Repository navigation
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. |
bb7af9d to
38e2ef4
Compare
|
Hi @014-code, thank you for your contribution! We truly appreciate your work on this PR. I have noticed that your branch is currently out of sync with main and there are some issues with the Maven build with your changes. Could you please rebase your branch and resolve the build issues so we can proceed with the review process? |
38e2ef4 to
b4a1a05
Compare
Hi @hemasekhar-p, thanks for the feedback. I rebased the branch onto the latest I also updated the asynchronous retry tests to wait for retry completion before asserting the terminal error. Validation performed:
The branch has been force-pushed as a single commit ( This PR fixes #1397. |
|
Hi @014-code, thank you for the update. Our team is currently reviewing your PR and we will let you know if any further information is required. Thank you! |
|
Based on current checks this is not a standard approach in ADK. Would exposing retry options on Gemini work instead, similar how ADK Python models it ? |
b4a1a05 to
411bfb7
Compare
|
Hi @damianmomotgoogle, thanks for the suggestion. I updated PR #1413 to follow ADK Python's provider-level retry configuration:
I rebased onto the latest Validation:
This keeps retry policy provider-specific and addresses #1397 through Gemini model configuration. |
| * @param apiKey The Google Gemini API key. | ||
| * @param retryOptions Options for retrying transient HTTP failures. | ||
| */ | ||
| public Gemini(String modelName, String apiKey, @Nullable HttpRetryOptions retryOptions) { |
There was a problem hiding this comment.
Could you try introducing a Builder instead of another constructor ?
i.e. introduce a Builder, redirect existing constructors to builder one for backward compatibility but for more configurability we'll keep extending builder ?
There was a problem hiding this comment.
Thanks for the guidance. I've refactored this to use the existing Gemini.Builder as the configuration entry point.
The two retry-enabled public constructor overloads have been removed. All three original public constructors now delegate to a single private Gemini(Builder) constructor, and Builder.build() uses that same constructor. Client selection and creation are centralized there, so future configuration can be added to the builder without expanding the public constructor API.
Retry options are configured through Gemini.builder().retryOptions(...) and passed to the Gen AI SDK for the API-key, Vertex-credentials, and default-client paths. An explicitly supplied Client retains precedence and its existing configuration. The original constructors retain their null-argument checks, and omitting retry options leaves the SDK defaults unchanged.
I added 10 tests in GeminiBuilderTest covering retry-option propagation through the public builder, all three original constructor paths, client/credential precedence, default options, and argument validation. The existing Gemini generation, continuation, and caching tests also pass.
I also rebased onto the latest main (84bae34a) and resolved the overlap with the recent tracking-header refactor. The shared ADK client builder and the internal Apigee constructor path retain their tracking-header behavior.
Validation on the rebased code: the full core module clean test completed with BUILD SUCCESS (the standard test execution reported 2901 tests, 0 failures, 0 errors, and 30 skipped). The additional environment-specific test executions, including the tracking-header and Apigee variants, also completed without failures. Google Java Format and git diff --check passed.
I've kept the PR as a single amended commit and updated its description to match the builder-based implementation.
411bfb7 to
cfaf88f
Compare
cfaf88f to
4c13333
Compare
Summary
Expose optional Google Gen AI
HttpRetryOptionsthroughGemini.Builder.retryOptions(...), allowing callers to configure retry attempts, backoff, jitter, and retryable HTTP status codes at the Gemini provider level.All three existing public constructors and
Builder.build()now use one private constructor taking the builder. Existing constructor signatures and null-argument checks are preserved; no new public constructor overloads are introduced. Retry options are forwarded for API-key, Vertex-credentials, and default-client construction. An explicitly suppliedClientkeeps its own configuration, and omitting retry options preserves the SDK defaults.Tests
GeminiBuilderTestcases covering retry-option propagation, the original constructors, client/credential precedence, default options, and argument validation.GeminiTestcases covering HTTP retry-option configuration.clean testafter rebasing ontomain(84bae34a):BUILD SUCCESS; standard test execution reported 2901 tests, 0 failures, 0 errors, and 30 skipped. Additional environment-specific executions, including the tracking-header and Apigee variants, completed without failures.git diff --checkpassed.Fixes #1397