ADR-001: Provider Abstraction Layer
Status
Accepted (2024-01)
Context
We needed to support multiple LLM providers (OpenAI, Anthropic Claude, Google Gemini) while maintaining a consistent API for consumers. Each provider has different:
- API endpoints and authentication methods
- Request/response formats
- Model naming conventions
- Capability sets (vision, embeddings, streaming, tools)
Decision
Implement a provider abstraction layer with:
Provideras the core contract.Interface -
Capability interfaces for optional features:
Embedding.Capable Interface Vision.Capable Interface Streaming.Capable Interface Tool.Capable Interface
Abstractbase class with shared functionality.Provider Llmas the unified entry point.Service Manager
Consequences
Positive:
- ●● Consumers use single API regardless of provider.
- ●● Easy to add new providers.
- ● Capability checking via interface detection.
- ●● Provider switching requires no code changes.
Negative:
- ✕ Lowest common denominator for shared features.
- ◑ Provider-specific features require direct provider access.
- ◑ Additional abstraction layer complexity.
Net Score: +5.5 (Strong positive impact - abstraction enables flexibility and maintainability)
Alternatives considered
- Single monolithic class: Rejected due to maintenance complexity.
- Strategy pattern only: Insufficient for capability detection.
- Factory pattern: Used in combination with interfaces.