You've already forked adk-python
mirror of
https://github.com/encounter/adk-python.git
synced 2026-03-30 10:57:20 -07:00
fix: unbreak client closed errors when using vertexai session service
PiperOrigin-RevId: 811911528
This commit is contained in:
committed by
Copybara-Service
parent
da6f1d3653
commit
e172811bc7
+1
-2
@@ -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>=1.21.1, <=1.40.0, !=1.37.0, !=1.38.0, !=1.39.0", # Google GenAI SDK
|
||||
"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.
|
||||
|
||||
@@ -371,15 +371,15 @@ class VertexAiSessionService(BaseSessionService):
|
||||
) -> Optional[genai.types.HttpOptions]:
|
||||
return None
|
||||
|
||||
def _get_api_client(self):
|
||||
def _get_api_client(self) -> genai.client.BaseApiClient:
|
||||
"""Instantiates an API client for the given project and location.
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
if new_options := self._api_client_http_options_override():
|
||||
api_client._http_options = new_options
|
||||
|
||||
Reference in New Issue
Block a user