Skip to content

client.models.generate_content() does not honor http_options' httpx_client override #1876

@Attila-Roomr

Description

@Attila-Roomr

Environment details

  • Programming language: Python
  • OS: Linux
  • Language runtime version: 1.55.0
  • Package version: 1.55.0

Steps to reproduce

  1. _http_client = httpx.Client(transport = LogTransport(httpx.HTTPTransport()), event_hooks = {'request': [log_request]}) # Trying to capture what goes on the "wire" via the event hooks
  2. _http_options = types.HttpOptions(httpx_client = _http_client, timeout = 30000)
  3. _config=types.GenerateContentConfig(http_options=_http_options)
  4. client.models.generate_content(config=_config)

The generate_content call does not honor the httpx_client override.
Looing at file _api_client.py, after line 1222, the relevant options are ignored. Adding something like:
try:
if http_options.httpx_client != None:
self._httpx_client = http_options.httpx_client
except:
pass
may enable that the overridden httpx_client is used.

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.status:awaiting user responsestatus:staletype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions