This document describes the LLM provider configuration system for the Statistics Agent Team.
The system now supports configurable LLM providers, allowing you to choose between:
- Gemini (Google) - Default
- Claude (Anthropic) - Planned
- OpenAI - Planned
- Ollama (Local) - Planned
✅ Gemini: Fully supported and tested ⏳ Claude: Configuration ready, ADK integration pending ⏳ OpenAI: Configuration ready, ADK integration pending ⏳ Ollama: Configuration ready, ADK integration pending
# Choose your LLM provider
export LLM_PROVIDER=gemini # Options: gemini, claude, openai, ollama# For Gemini (default)
export GOOGLE_API_KEY=your-google-api-key
# or
export GEMINI_API_KEY=your-google-api-key
# For Claude (when supported)
export ANTHROPIC_API_KEY=your-anthropic-api-key
# or
export CLAUDE_API_KEY=your-anthropic-api-key
# For OpenAI (when supported)
export OPENAI_API_KEY=your-openai-api-key
# For Ollama (when supported)
export OLLAMA_URL=http://localhost:11434# Override the default model for your chosen provider
export LLM_MODEL=gemini-2.0-flash-exp # For Gemini
# export LLM_MODEL=claude-3-5-sonnet-20241022 # For Claude
# export LLM_MODEL=gpt-4 # For OpenAI
# export LLM_MODEL=llama3.2 # For Ollama# Use generic API key (overrides provider-specific keys)
export LLM_API_KEY=your-api-key
# Custom base URL (for Ollama or custom endpoints)
export LLM_BASE_URL=http://localhost:11434| Provider | Default Model |
|---|---|
| Gemini | gemini-2.0-flash-exp |
| Claude | claude-3-5-sonnet-20241022 |
| OpenAI | gpt-4 |
| Ollama | llama3.2 |
The pkg/llm/factory.go file provides a centralized ModelFactory that:
- Reads configuration from environment variables
- Creates the appropriate LLM model based on
LLM_PROVIDER - Returns a
model.LLMinterface compatible with Google ADK
All agents use the model factory:
- Research Agent (
agents/research/main.go) - Verification Agent (
agents/verification/main.go) - Orchestration Agent (
agents/orchestration/main.go)
Example usage:
// Create model using factory
modelFactory := llm.NewModelFactory(cfg)
model, err := modelFactory.CreateModel(ctx)
if err != nil {
return nil, fmt.Errorf("failed to create model: %w", err)
}
log.Printf("Agent: Using %s", modelFactory.GetProviderInfo())export GOOGLE_API_KEY=your-google-api-key
make run-all-einoexport LLM_PROVIDER=claude
export ANTHROPIC_API_KEY=your-anthropic-api-key
export LLM_MODEL=claude-3-5-sonnet-20241022
make run-all-einoexport LLM_PROVIDER=openai
export OPENAI_API_KEY=your-openai-api-key
export LLM_MODEL=gpt-4-turbo
make run-all-einoexport LLM_PROVIDER=ollama
export OLLAMA_URL=http://localhost:11434
export LLM_MODEL=llama3.2
make run-all-einoClaude support requires:
- ADK integration or custom HTTP client for Anthropic API
- Adapter to convert Claude responses to ADK's
model.LLMinterface - Testing with Claude-specific prompt engineering
OpenAI support requires:
- ADK integration or custom HTTP client for OpenAI API
- Adapter to convert OpenAI responses to ADK's
model.LLMinterface - Testing with OpenAI-specific parameters
Ollama support requires:
- Custom HTTP client for Ollama API
- Adapter to convert Ollama responses to ADK's
model.LLMinterface - Support for different local models (llama, mistral, etc.)
- Streaming support for better performance
The system uses the following precedence for API keys:
LLM_API_KEY(if set, overrides all provider-specific keys)- Provider-specific key (
GEMINI_API_KEY,CLAUDE_API_KEY, etc.) - Alternative provider key (
GOOGLE_API_KEYfor Gemini,ANTHROPIC_API_KEYfor Claude)
If you select an unsupported provider, the system will return a clear error message:
Error: claude support via ADK is not yet implemented - use gemini for now
Error: openai support via ADK is not yet implemented - use gemini for now
Error: ollama support via ADK is not yet implemented - use gemini for now
To add support for a new LLM provider:
-
Update
pkg/llm/factory.go:- Add a new case in
CreateModel() - Implement
create<Provider>Model()method
- Add a new case in
-
Update
pkg/config/config.go:- Add provider-specific configuration fields
- Update
LoadConfig()to read new environment variables - Add default model in
getDefaultModel()
-
Update documentation:
- Add provider to README.md
- Update this LLM_CONFIGURATION.md
- Update .env.example
-
Test thoroughly with the new provider
- README.md - Main project documentation
- .env.example - Example environment configuration
- pkg/config/config.go - Configuration implementation
- pkg/llm/factory.go - Model factory implementation