ractogateway.adapters.google_kit

Google Gemini adapter (using the google-genai SDK).

ractogateway.adapters.google_kit.build_google_contents(history, user_message, attachments=None)[source]

Build a Gemini contents value that includes prior conversation turns.

When history is empty or None and there are no attachments a plain string is returned (identical to the single-turn behaviour). With history or image attachments a list of types.Content objects is returned so the model sees the full conversation context.

Gemini uses "model" where OpenAI/Anthropic use "assistant". Image attachments are embedded as Part.from_bytes inline data parts.

Return type:

Any

class ractogateway.adapters.google_kit.GoogleLLMKit(model='gemini-2.0-flash', *, api_key=None, **kwargs)[source]

Bases: BaseLLMAdapter

Adapter for the Google Gemini API via google-genai.

Parameters:
  • model (str) – Model name (e.g. "gemini-2.0-flash", "gemini-2.5-pro").

  • api_key (str | None) – Gemini API key. Falls back to GEMINI_API_KEY env var.

provider: str = 'google'
translate_tools(registry)[source]

Convert registry schemas to Gemini function declarations.

Return type:

list[dict[str, Any]]

run(prompt, user_message, *, history=None, tools=None, temperature=0.0, max_tokens=4096, **kwargs)[source]

Execute a prompt against the provider and return a normalised response.

Return type:

LLMResponse

async arun(prompt, user_message, *, history=None, tools=None, temperature=0.0, max_tokens=4096, **kwargs)[source]

Async variant of run().

Return type:

LLMResponse