-
Notifications
You must be signed in to change notification settings - Fork 710
Open
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
This is a client library issue where setting the "timeout" option in genai.Client's http_options raises an error, making it impossible to set both the toal and connection timeout using aiohttp.
Environment details
- Programming language: Python
- OS: Linux (affects all OSes)
- Language runtime version: Python 3.12
- Package version: 1.51.0
Steps to reproduce
- Make a streaming request with the following client options:
client = genai.Client(
...,
http_options=types.HttpOptions(
async_client_args={
"timeout": aiohttp.ClientTimeout(
total=600.0,
connect=10.0,
)
}
),
)
- This raises an error
TypeError: aiohttp.client.ClientSession.request() got multiple values for keyword argument 'timeout'
This is due to the timeout field being hardcoded in the aiohttp_session request
python-genai/google/genai/_api_client.py
Line 1257 in a4f4205
| timeout=aiohttp.ClientTimeout(total=http_request.timeout), |
while also being unpacked in
python-genai/google/genai/_api_client.py
Line 1258 in a4f4205
| **self._async_client_session_request_args, |
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.