Skip to content

feat: unified LLM config, OpenRouter, safety guards, multi-model eval#98

Merged
VarunGitGood merged 4 commits into
mainfrom
feat/fsm-model
Jun 29, 2026
Merged

feat: unified LLM config, OpenRouter, safety guards, multi-model eval#98
VarunGitGood merged 4 commits into
mainfrom
feat/fsm-model

Conversation

@VarunGitGood

Copy link
Copy Markdown
Owner

Summary

  • Unified LLM config: collapsed 6 per-provider API key fields (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) into single LLM_API_KEY with backward-compatible model_validator migration — old configs keep working
  • Registry-based provider factory: replaced if/elif chain with _PROVIDERS dict lookup, cleaner extension path
  • OpenRouter integration: zero new adapter code — reuses OpenAICompatProvider with custom base_url. Set LLM_PROVIDER=openrouter + key
  • API safety guards: secret masking in GET /config, generic exception messages (real errors server-side only), prompt injection sanitization, CORS locked to localhost:{UI_PORT} (configurable via CORS_ORIGINS), slowapi rate limiting on /investigate (10/min) and /chat (20/min)
  • Multi-model eval harness: --provider, --model, --api-key flags on run_evals.py; new run_multi_model.py orchestrator with --mock dry-run
  • Reflection interval: default changed from 3→2 for fairer cross-model comparison

Test plan

  • All 262 tests pass (uv run pytest tests/ -v)
  • Eval suite runs end-to-end (Mistral MUT + Mistral judge): 2 PASS, 2 FAIL, avg 0.77
  • run_multi_model.py --mock renders comparison table correctly
  • Legacy config migration verified via test_config_isolation.py
  • Manual: GET /config returns masked keys
  • Manual: injection payload in /investigate query gets sanitized
  • Manual: rate limit triggers 429 after threshold

…i-model eval

- Unify 6 per-provider API key fields into single LLM_API_KEY with backward-compatible migration via model_validator
- Replace if/elif factory chain with registry-based provider pattern
- Add OpenRouter as OpenAI-compatible provider (reuses OpenAICompatProvider with custom base_url)
- Add API safety guards: mask secrets in GET /config, sanitize exceptions, input sanitization for prompt injection, tighten CORS from wildcard to localhost
- Add slowapi rate limiting on POST /investigate (10/min) and POST /chat (20/min)
- Add --provider, --model, --api-key flags to eval runner for multi-model testing
- Add eval/run_multi_model.py orchestrator with --mock dry-run support
- Change REFLECTION_INTERVAL default from 3 to 2 for fairer model comparison
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
repi Ready Ready Preview, Comment Jun 29, 2026 5:57pm

@VarunGitGood
VarunGitGood merged commit ebea987 into main Jun 29, 2026
3 of 4 checks passed
VarunGitGood added a commit that referenced this pull request Jul 5, 2026
feat: unified LLM config, OpenRouter, safety guards, multi-model eval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant