perf: lazily import the interactions API to speed up import google.genai
The top-level package eagerly imported the interactions submodule, and client.py eagerly imported the _gaos backend, so every `import google.genai` paid for hundreds of interactions-API modules even when the caller only uses generate_content. Defer both: make `interactions` a lazy module attribute via __getattr__, and move the _gaos imports in client.py under TYPE_CHECKING plus into the Client/AsyncClient properties that construct them. `from __future__ import annotations` keeps the property return annotations valid without the eager import. The _gaos modules now load only when .interactions/.agents/ .webhooks (or the nextgen client) are first accessed. PiperOrigin-RevId: 963526443
G
Google Team Member committed
89dcfe5b28f5e794f9a5ac84e2d45e9e7b7bd803
Parent: 288d2ef
Committed by Copybara-Service <copybara-worker@google.com>
on 8/12/2026, 5:28:32 PM