feat: Multi-provider LLM support (Ollama, OpenAI, Claude, Gemini)#23
Open
euvhmac wants to merge 5 commits into
Open
feat: Multi-provider LLM support (Ollama, OpenAI, Claude, Gemini)#23euvhmac wants to merge 5 commits into
euvhmac wants to merge 5 commits into
Conversation
- config.py: single source of truth for all settings (LLM, DB, providers) - .env.example: template for environment configuration - Replaces scattered hardcoded values across modules - Supports Ollama (local), Anthropic, OpenAI, and Google providers
- providers.py: BaseProvider ABC with send()/ping() interface - OllamaProvider: local LLM via /api/chat (messages-based) - AnthropicProvider: Claude API via official SDK - OpenAIProvider: GPT models via official SDK - GoogleProvider: Gemini via google-genai SDK - Factory pattern with get_provider() and list_providers() - All providers use unified messages-based interface
- Replace ask_ollama() with ask_llm() using provider abstraction - Update summarize_tool_output() to use active provider instead of direct Ollama call - Add provider_name/model overrides to analyse_target() and run_tool_calls() - Preserve all existing features: summarizer, evidence gating, _clean parser - Remove hardcoded Ollama URL, model name, and timeout constants - All parameters now loaded from config.py
- New Settings menu (option 3): view providers, switch active, test connection - Per-scan provider override: choose provider before each scan - Banner shows active provider/model dynamically - Cross-platform clear screen (cls on Windows, clear on Linux)
… deps - db.py: import DB settings from config.py instead of hardcoding - export.py: import DB settings from config.py instead of hardcoding - requirements.txt: add python-dotenv, anthropic, openai, google-genai - .gitignore: add .env to prevent accidental API key leaks
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.
What
Adds support for multiple LLM providers beyond Ollama — users can now run METATRON with OpenAI (GPT), Anthropic (Claude), Google (Gemini), or keep using Ollama locally. Provider switching is available both at startup and mid-session via a new Settings menu.
Why
Ollama is great for local/offline use, but not everyone has the hardware to run large models. Cloud providers give users access to stronger models with zero setup. This also opens the door for comparing analysis quality across different LLMs.
How
New files
config.py.envviapython-dotenv. Defines active provider/model, API keys, DB credentials, and provider catalog.providers.pyBaseProviderABC withsend(messages)andping()methods. Concrete implementations:OllamaProvider,AnthropicProvider,OpenAIProvider,GoogleProvider. Factory functionget_provider()..env.exampleModified files
llm.pyask_ollama()→ask_llm()using the provider abstraction.summarize_tool_output()updated to use active provider. Preserves all upstream features (evidence gating,_clean(), summarizer, parser).metatron.pydb.pyconfig.pyfor DB credentials instead of hardcoded values.export.pyconfig.pyfor DB credentials instead of hardcoded values.requirements.txtpython-dotenv,anthropic,openai,google-genai..gitignore.envto prevent accidental API key leaks.Architecture
User → metatron.py → llm.py → providers.py → [Ollama | OpenAI | Claude | Gemini]
↑
config.py (.env)
All providers implement the same
BaseProviderinterface, sollm.pyis completely provider-agnostic. The system prompt, evidence gating rules, tool pipeline, and report generation work identically regardless of which provider is active.Backward Compatibility
.envfile is optional; defaults match current behaviorSetup (for cloud providers)