feat(llm): pluggable LLM-provider abstraction (OpenAI + Anthropic)#5
Merged
Conversation
Mirror of the QA agent change. Decouple the agent from the OpenAI SDK behind a small LLMProvider protocol so the backend is swappable (OpenAI today, Anthropic drop-in) without touching the processing/agent code. - New src/llm/ package: LLMProvider protocol + normalised errors, OpenAIProvider, AnthropicProvider (lazy import), get_provider() factory. - Route all five LLM call sites through the provider: summarizer, trend_analyzer, source_discoverer (now injectable via `provider=`) and keyword_extractor / report_generator. - settings: add LLM_PROVIDER (default openai) and ANTHROPIC_API_KEY. - Tests: summarizer + keyword-extractor tests switch to provider injection; new tests/test_llm/ covers the factory + OpenAI error translation. 107 tests pass, coverage 64% -> 65%, ruff clean. README/.env.example updated. OpenAI behaviour is unchanged (verified by the existing suite). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mirror of the QA agent change. Decouples the agent from the OpenAI SDK behind a small
LLMProviderprotocol (OpenAI today, Anthropic drop-in). Newsrc/llm/package + all 5 call sites routed through it + provider injection for testability. 107 tests pass, 64% → 65% coverage, ruff clean. OpenAI behaviour unchanged.🤖 Generated with Claude Code