Skip to content

Add Google Gemini adapter #3

@simonhsze

Description

@simonhsze

What

Add a Google Gemini adapter (adapters/gemini.py) that implements the LLMAdapter interface.

Why

Gemini models are free-tier friendly and widely used. Expanding backend support lowers the barrier to try Agent Constitution.

How

  1. Copy adapters/anthropic_api.py as a starting template
  2. Implement call() using the google-generativeai Python SDK
  3. Map response to LLMResponse
  4. Add lazy import in adapters/__init__.py
  5. Add tests (no real API calls)
  6. Add google-generativeai to optional dependencies in pyproject.toml

Reference

  • adapters/base.py — the interface to implement
  • adapters/ollama.py — another HTTP-based adapter for reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions