Pattern Proposal: LLM provider adapter and test double port
Summary
LiteLLMClient and MockLLMClient provide separate provider clients under an llm package, abstracting LLM transport from business logic.
Candidate Pattern
- ID:
llm-provider-adapter-port - Classification: architectural
- Maturity: emerging
- Type: emerging
Observed Signals
No specific signals listed.
Evidence
Supporting Evidence
- src/cas_runner/llm/litellm_client.py (LiteLLMClient) - Production LLM provider client.
- src/cas_runner/llm/mock_client.py (MockLLMClient) - Test double for provider interaction.
- pyproject.toml - Declares litellm>=1.83.14 as a dependency.
Scope Assessment
- Evidence Strength: high
- Confidence: high
- Applies to: ideas-to-life-cas
Rationale
- Intent: Decouple application and governance logic from a concrete LLM provider and enable deterministic testing.
- Context: The project depends on litellm and likely needs both real provider calls and fake responses for tests or dry runs.
- Force: Real provider calls are expensive and nondeterministic
- Force: Tests need stable provider behavior
- Force: Provider APIs may change faster than domain logic
Traceability
Artifact source: proposed-patterns