googleapis / googleapis/python-genai

`'BaseApiClient' object has no attribute '_async_client_session_request_args'`

Offen
#1,990 7 Kommentare 2 Reaktionen 1 zugewiesene Person Beansprucht von @Venkaiahbabuneelam Auf GitHub ansehen
priority: p2 type: bug
Vorherrschende Sprache
Python
Sterne
4k
Forks
1k
Ø Merge
2 T. 12 Std.
Gemergte PRs (30 T.)
41

Beschreibung

#### Environment details

- Programming language: `Python`
- OS: `Ubuntu 24.04.3 LTS`
- Language runtime version: `3.13.11`
- Package version: `> 1.58.0`

#### Steps to reproduce

1. Pass a custom `aiohttp` session to `Gemini` client through `HttpOptions`
2. Execute the following code
```py
async def run_test() -> None:
async with aiohttp.ClientSession() as session:
http_options = types.HttpOptions(aiohttp_client=session)
gemini = Client(api_key=config_lookup("GEMINI_API_KEY"), http_options=http_options)
response = await gemini.aio.models.generate_content(
model="gemini-2.5-flash",
contents="What is the capital of France?",
config=types.GenerateContentConfig(
thinking_config=types.ThinkingConfig(thinking_budget=0), # Disables thinking
),
)
print(response)

asyncio.run(run_test())
```
3. The following will get raised ``'BaseApiClient' object has no attribute '_async_client_session_request_args'``

I ran into this to workaround https://github.com/googleapis/python-genai/issues/1989 but then encountered this error

As far as I see in the code, `_async_client_session_request_args` never gets instantiated, leading to this error.

Not sure if I missed something that makes it possible for me to set it.

Makes it hard to use a custom aiohttp client for now.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.