From 45ba403a3d7dfc46def31d4676136ee099fc5e2e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 22:54:54 +0000 Subject: [PATCH 1/2] Add more options to Gemini class to pass to genai.Client constructor. This change adds `vertexai`, `api_key`, `credentials`, `project`, `location`, and `debug_config` fields to the `Gemini` class in `src/google/adk/models/google_llm.py`. These fields are then passed to the `google.genai.Client` constructor in both `_api_client` and `_live_api_client` methods. This allows for more granular configuration of the Gemini client. --- src/google/adk/models/google_llm.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/google/adk/models/google_llm.py b/src/google/adk/models/google_llm.py index 6b21cf62c7..d8c00fb210 100644 --- a/src/google/adk/models/google_llm.py +++ b/src/google/adk/models/google_llm.py @@ -25,6 +25,7 @@ from typing import TYPE_CHECKING from typing import Union +import google.auth.credentials from google.genai import types from google.genai.errors import ClientError from typing_extensions import override @@ -87,6 +88,12 @@ class Gemini(BaseLlm): model: str = 'gemini-2.5-flash' + vertexai: Optional[bool] = None + api_key: Optional[str] = None + credentials: Optional[google.auth.credentials.Credentials] = None + project: Optional[str] = None + location: Optional[str] = None + speech_config: Optional[types.SpeechConfig] = None retry_options: Optional[types.HttpRetryOptions] = None @@ -241,6 +248,11 @@ def api_client(self) -> Client: from google.genai import Client return Client( + vertexai=self.vertexai, + api_key=self.api_key, + credentials=self.credentials, + project=self.project, + location=self.location, http_options=types.HttpOptions( headers=self._tracking_headers(), retry_options=self.retry_options, @@ -278,6 +290,11 @@ def _live_api_client(self) -> Client: from google.genai import Client return Client( + vertexai=self.vertexai, + api_key=self.api_key, + credentials=self.credentials, + project=self.project, + location=self.location, http_options=types.HttpOptions( headers=self._tracking_headers(), api_version=self._live_api_version ) From 81b376d2e8c03a17aeebd6b1b29a70b6edbcdd8b Mon Sep 17 00:00:00 2001 From: Eytan Heidingsfeld <32422402+ehmm@users.noreply.github.com> Date: Tue, 9 Dec 2025 09:36:41 +0000 Subject: [PATCH 2/2] Fixes after autoformatting --- contributing/samples/gepa/experiment.py | 1 - contributing/samples/gepa/run_experiment.py | 1 - src/google/adk/models/google_llm.py | 4 ++-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/contributing/samples/gepa/experiment.py b/contributing/samples/gepa/experiment.py index 2f5d03a772..f68b349d9c 100644 --- a/contributing/samples/gepa/experiment.py +++ b/contributing/samples/gepa/experiment.py @@ -43,7 +43,6 @@ from tau_bench.types import EnvRunResult from tau_bench.types import RunConfig import tau_bench_agent as tau_bench_agent_lib - import utils diff --git a/contributing/samples/gepa/run_experiment.py b/contributing/samples/gepa/run_experiment.py index cfd850b3a3..1bc4ee58c8 100644 --- a/contributing/samples/gepa/run_experiment.py +++ b/contributing/samples/gepa/run_experiment.py @@ -25,7 +25,6 @@ from absl import flags import experiment from google.genai import types - import utils _OUTPUT_DIR = flags.DEFINE_string( diff --git a/src/google/adk/models/google_llm.py b/src/google/adk/models/google_llm.py index d8c00fb210..7dc413242f 100644 --- a/src/google/adk/models/google_llm.py +++ b/src/google/adk/models/google_llm.py @@ -256,7 +256,7 @@ def api_client(self) -> Client: http_options=types.HttpOptions( headers=self._tracking_headers(), retry_options=self.retry_options, - ) + ), ) @cached_property @@ -297,7 +297,7 @@ def _live_api_client(self) -> Client: location=self.location, http_options=types.HttpOptions( headers=self._tracking_headers(), api_version=self._live_api_version - ) + ), ) @contextlib.asynccontextmanager