Add pluggable LLM support with Gemini provider

- Add LLMProvider registry (llm/registry.py) that builds a provider from
  env vars (LLM_PROVIDER, GEMINI_API_KEY, GEMINI_MODEL)
- Add GeminiLLMProvider using the google-genai SDK
- Wire build_llm_provider() into CLI and web pipeline route (replacing llm=None)
- Wrap pass 2 and pass 4 LLM calls in per-combo try/except so API errors
  skip individual combos rather than aborting the whole run
- Add gemini optional dep to pyproject.toml; Dockerfile installs [web,gemini]
- Document env vars in .env.example and README
- Lower requires-python to >=3.10 to match installed system Python

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-18 22:04:35 -06:00
parent f1b3c75190
commit 20dae0dce3
10 changed files with 204 additions and 40 deletions

View File

@@ -7,8 +7,13 @@ services:
- physcom-data:/app/data
environment:
- PHYSCOM_DB=/app/data/physcom.db
- FLASK_SECRET_KEY=${FLASK_SECRET_KEY:-physcom-dev-key}
- FLASK_SECRET_KEY=${FLASK_SECRET_KEY:-}
- LLM_PROVIDER=${LLM_PROVIDER:-}
- GEMINI_API_KEY=${GEMINI_API_KEY:-}
- GEMINI_MODEL=${GEMINI_MODEL:-gemini-2.0-flash}
restart: unless-stopped
expose:
- 5000
cli:
build: .
@@ -16,6 +21,9 @@ services:
- physcom-data:/app/data
environment:
- PHYSCOM_DB=/app/data/physcom.db
- LLM_PROVIDER=${LLM_PROVIDER:-}
- GEMINI_API_KEY=${GEMINI_API_KEY:-}
- GEMINI_MODEL=${GEMINI_MODEL:-gemini-2.0-flash}
entrypoint: ["python", "-m", "physcom"]
profiles: [cli]