Pattern Proposal: Dual-Mode LLM Provider Abstraction
Summary
Isolates model invocation behind a provider client interface pairing a multi-model gateway (LiteLLM) with a fully deterministic mock client.
Candidate Pattern
- ID:
dual-mode-llm-provider-abstraction - Classification: intelligence
- Maturity: established
- Type: implemented
Observed Signals
No specific signals listed.
Evidence
Supporting Evidence
- src/cas_runner/llm/litellm_client.py (LiteLLMClient) - Production LLM wrapper handling API calls via LiteLLM.
- src/cas_runner/llm/mock_client.py (MockLLMClient) - Mock client delivering canned deterministic responses for test runs.
Scope Assessment
- Evidence Strength: high
- Confidence: high
- Applies to: ideas-to-life-cas
Rationale
- Intent: Decouple agent business logic from specific cloud LLM APIs and allow zero-cost deterministic offline testing.
- Context: Instantiated by runners, analyzers, and mergers to execute LLM inferences.
- Force: Directly binding agents to a specific LLM SDK makes multi-cloud deployment or model migration arduous.
- Force: CI pipelines fail or accrue massive costs when executing integration tests against live LLMs.
Traceability
Artifact source: proposed-patterns