Skip to main content

GoogleAPIClient

GoogleAPIClient is the Google GenAI backend client in AutoPipeline. It is implemented in src/autopipeline/components/primitives/clients/google_client.py and registered in CLIENT_REGISTRY as google.

Client
Overview

Registry Entry

FieldValue
Registry keygoogle
ClassGoogleAPIClient
Base classBaseClient
Signature

Class Signature

GoogleAPIClient(
model_name="gemini-3-pro-native",
**kwargs,
)
Constructor

Constructor Parameters

KeyRequiredDefaultMeaning
model_nameNogemini-3-pro-nativeTarget model name for generate_content.
base_urlYesnoneBase URL for the configured Google-compatible endpoint.
api_keyYesnoneAPI key for the SDK client.
api_versionNov1alphaAPI version passed through HTTP options.
max_tokensNo2048Maximum output tokens.
retriesNo3Retry budget.

The constructor asserts that base_url and api_key exist, then builds a genai.Client.

Methods

Public Methods

MethodPurpose
call_model(messages)Execute Gemini-style content generation with retry logic.
Signature

Callable Interface

call_model(messages)

Input contract

messages should already be Gemini-style contents, typically produced by GoogleGenAIStylePromptAdapter.

Return value

On success, the method returns response.text.

If no valid response text is produced after retries, it returns None.

Config

Minimal Config Example

init_config:
backend: google
model_name: gemini-3-pro-native
base_url: ${client_config.base_url}
api_key: ${client_config.api_key}
api_version: v1alpha
max_tokens: 2048
retries: 3
Failure Mode

Failure Semantics

The retry loop:

  • retries range(self.retries)
  • uses exponential backoff with jitter
  • treats 429 and exhausted-resource cases as retriable
  • logs empty responses and transport failures

Terminal failure returns None.

Extension

Extension Notes

  • Use this client when the runtime is genuinely Google GenAI / Gemini-shaped.
  • Keep parts formatting in the prompt adapter, not in this client.
  • If SDK behavior changes, this file is the right place to isolate that change from the module layer.