Skip to content

Commit 0f87e5d

Browse files
yinghsienwucopybara-github
authored andcommitted
fix: Make aiohttp an optional dependency, bump aiohttp version upperbound, and ensure HttpOptions.async_client_args propagates to custom aiohttp.ClientSession request args for proxy etc.
fixes #2090 fixes #2051 fixes #1950 PiperOrigin-RevId: 874840825
1 parent c04c489 commit 0f87e5d

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

google/genai/_api_client.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -747,11 +747,10 @@ def __init__(
747747

748748
if self._http_options.aiohttp_client:
749749
self._aiohttp_session = self._http_options.aiohttp_client
750-
else:
751-
# Do it once at the genai.Client level. Share among all requests.
752-
self._async_client_session_request_args = (
753-
self._ensure_aiohttp_ssl_ctx(self._http_options)
754-
)
750+
# Do it once at the genai.Client level. Share among all requests.
751+
self._async_client_session_request_args = (
752+
self._ensure_aiohttp_ssl_ctx(self._http_options)
753+
)
755754
except ImportError:
756755
pass
757756

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,14 @@ dependencies = [
3131
"pydantic>=2.9.0, <3.0.0",
3232
"requests>=2.28.1, <3.0.0",
3333
"tenacity>=8.2.3, <9.2.0",
34-
"websockets>=13.0.0, <15.1.0",
34+
"websockets>=13.0.0, <17.0",
3535
"typing-extensions>=4.11.0, <5.0.0",
3636
"distro>=1.7.0, <2",
3737
"sniffio",
38-
"aiohttp>=3.10.11",
3938
]
4039

4140
[project.optional-dependencies]
42-
aiohttp = ["aiohttp<3.13.3"]
41+
aiohttp = ["aiohttp>=3.10.11, <4.0.0"]
4342
local-tokenizer = ["sentencepiece>=0.2.0", "protobuf"]
4443

4544
[project.urls]

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ rsa==4.9
2727
tenacity==8.2.3
2828
typing_extensions>=4.14.1
2929
urllib3==2.5.0
30-
websockets==15.0.0
30+
websockets==16.0
3131
mcp>=1.14.0; python_version > '3.9'
3232
sentencepiece>=0.2.0
3333
protobuf

0 commit comments

Comments
 (0)