Add Google Gemini as AI provider

- Add gemini.py provider using google-genai SDK
- Update config.py with gemini provider and GEMINI_API_KEY
- Update ai_service.py factory to support gemini
- Add google-genai to requirements.txt
- Update .env.example, README.md, and CLAUDE.md documentation
This commit is contained in:
2026-01-11 20:23:03 +01:00
parent b05fa034a6
commit 5761529c7f
8 changed files with 89 additions and 7 deletions

View File

@@ -25,9 +25,10 @@ This is a Discord bot that responds to @mentions with AI-generated responses (mu
### Provider Pattern
The AI system uses a provider abstraction pattern:
- `services/providers/base.py` defines `AIProvider` abstract class with `generate()` method
- `services/providers/openai.py`, `openrouter.py`, `anthropic.py` implement the interface
- `services/providers/openai.py`, `openrouter.py`, `anthropic.py`, `gemini.py` implement the interface
- `services/ai_service.py` is the factory that creates the correct provider based on `AI_PROVIDER` env var
- OpenRouter uses OpenAI's client with a different base URL
- Gemini uses the `google-genai` SDK
### Cog System
Discord functionality is in `cogs/`:
@@ -45,4 +46,4 @@ All config flows through `config.py` using pydantic-settings. The `settings` sin
## Environment Variables
Required: `DISCORD_TOKEN`, plus one of `OPENAI_API_KEY`, `OPENROUTER_API_KEY`, or `ANTHROPIC_API_KEY` depending on `AI_PROVIDER` setting.
Required: `DISCORD_TOKEN`, plus one of `OPENAI_API_KEY`, `OPENROUTER_API_KEY`, `ANTHROPIC_API_KEY`, or `GEMINI_API_KEY` depending on `AI_PROVIDER` setting.