aeat.adapters.outbound.llm._providers.gemini module

Google Gemini provider adapter for the LLM outbound subpackage.

Speaks the Gemini v1beta/models/{model}:generateContent HTTP API and adapts its response shape to the ProviderCompletion contract. Internal pydantic models mirror the upstream JSON schema and are kept private.

class GeminiAdapter(api_key, timeout_s)[source]

Bases: _ProviderAdapter

Provider adapter that invokes the Gemini generateContent HTTP API.

A non-empty api_key is mandatory; the adapter refuses to construct without one because the underlying API rejects unauthenticated calls.

Parameters:
  • api_key (str)

  • timeout_s (int)

provider: LLMProvider
async complete(request)[source]

Execute a Gemini completion request.

Parameters:

request (ProviderRequest) – Normalized provider request.

Return type:

ProviderCompletion

Returns:

A ProviderCompletion containing the concatenated text of the first candidate and reported token counts.

Raises:

LLMProviderError – When the API returns a 4xx or 5xx HTTP error status.