Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ dependencies = [
"google-cloud-spanner>=3.56.0, <4.0.0", # For Spanner database
"google-cloud-speech>=2.30.0, <3.0.0", # For Audio Transcription
"google-cloud-storage>=2.18.0, <3.0.0", # For GCS Artifact service
# TODO: Modify genai version constraint after the connector/client session warning is fixed.
"google-genai>=1.21.1, <1.37.0", # Google GenAI SDK
"google-genai @ git+https://github.com/googleapis/python-genai.git@copybara/811800162", # For testing purposes
"graphviz>=0.20.2, <1.0.0", # Graphviz for graph rendering
"mcp>=1.8.0, <2.0.0;python_version>='3.10'", # For MCP Toolset
"opentelemetry-api>=1.37.0, <=1.37.0", # OpenTelemetry - limit upper version for sdk and api to not risk breaking changes from unstable _logs package.
Expand Down
4 changes: 2 additions & 2 deletions src/google/adk/sessions/vertex_ai_session_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,9 @@ def _get_api_client(self):
It needs to be instantiated inside each request so that the event loop
management can be properly propagated.
"""
api_client = genai.Client(
api_client = genai.client.BaseApiClient(
vertexai=True, project=self._project, location=self._location
)._api_client
)
Comment on lines +380 to +382
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change to use genai.client.BaseApiClient directly is a good improvement for maintainability. To make this even more robust, consider passing http_options to the BaseApiClient constructor. This would allow removing the subsequent modification of the private _http_options attribute, making the code cleaner and less coupled to the library's internal implementation.


if new_options := self._api_client_http_options_override():
api_client._http_options = new_options
Expand Down