How googleapis/python-genai works
Google Gen AI SDK is a Python client library for Gemini Developer API and Gemini Enterprise Agent Platform. The principal workflow is application code creating a client, invoking a model operation with typed or dictionary input, and receiving an API response through the SDK’s HTTP layer. The package also exposes chat, live, files, batches, caches, tuning, and Agent Platform resources. Relationships beyond those stated in the README or visible in the supplied source index are marked unverified; unsampled implementation details are not inferred.
Main entry points: client.py Client · models.py Model operations · _api_client.py API client · webhooks.py Webhook resources
Components 22
Client entry
- Client
google/genai/client.py
Model interaction
- Model operations
google/genai/models.py - Chats
google/genai/chats.py - Live sessions
google/genai/live.py
Transport and types
- Public types
google/genai/types.py - API client
google/genai/_api_client.py - Shared utilities
google/genai/_common.py
Platform resources
- File operations
google/genai/files.py - Batch operations
google/genai/batches.py - Caches
google/genai/caches.py - Model tuning
google/genai/tunings.py - Token operations
google/genai/tokens.py - Long operations
google/genai/operations.py - Agents
google/genai/agents.py - Interactions
google/genai/interactions.py - Environments
google/genai/environments.py - Triggers
google/genai/triggers.py - Voices
google/genai/voices.py - Webhook resources
google/genai/webhooks.py - Generated webhook API
google/genai/_gaos/webhooks.py
Other components
- Python application
- Google Gen AI APIs
Connections 24
- Python application → Client: creates
- Client → Model operations: exposes
google/genai/client.py - Python application → Model operations: requests generation
- Model operations → Public types: accepts input
- Client → API client: configures
google/genai/client.py - Model operations → API client: sends requests
- API client → Google Gen AI APIs: communicates with
- Google Gen AI APIs → Python application: returns response
- Client → Chats: exposes
google/genai/client.py - Client → Live sessions: exposes
google/genai/client.py - Client → File operations: exposes
google/genai/client.py - Client → Batch operations: exposes
google/genai/client.py - Client → Caches: exposes
google/genai/client.py - Client → Model tuning: exposes
google/genai/client.py - Client → Token operations: exposes
google/genai/client.py - Client → Long operations: exposes
google/genai/client.py - Client → Agents: exposes
- Client → Interactions: exposes
google/genai/client.py - Client → Environments: exposes
- Client → Triggers: exposes
- Client → Voices: exposes
- Client → Webhook resources: exposes
- Webhook resources → Generated webhook API: delegates to
google/genai/webhooks.py - Shared utilities → API client: supports
google/genai/_api_client.py