feat: add multi-model support for per-analysis LLM selection #64

Merged
AI-Manager merged 2 commits from feature/multi-model into main 2026-03-26 12:14:27 +00:00
Owner

Summary

  • Add optional model field to single and batch analysis requests
  • Defaults gracefully to the MODEL env var when not specified
  • Model used is recorded in analysis results and database metadata
  • Add GET /models endpoint listing supported models (Claude, GPT-4o, Gemini, Llama)
  • All routing goes through OpenRouter, supporting any model it offers

Closes #37

Test plan

  • Analysis without model field uses default from config
  • Analysis with model field routes to specified model
  • Model is recorded in response and database
  • GET /models returns list of supported models with default
  • Existing tests pass without modification
## Summary - Add optional `model` field to single and batch analysis requests - Defaults gracefully to the `MODEL` env var when not specified - Model used is recorded in analysis results and database metadata - Add `GET /models` endpoint listing supported models (Claude, GPT-4o, Gemini, Llama) - All routing goes through OpenRouter, supporting any model it offers Closes #37 ## Test plan - [ ] Analysis without model field uses default from config - [ ] Analysis with `model` field routes to specified model - [ ] Model is recorded in response and database - [ ] `GET /models` returns list of supported models with default - [ ] Existing tests pass without modification
AI-Manager added 1 commit 2026-03-26 10:28:42 +00:00
Allow users to choose the LLM model on a per-analysis basis. The
model field is optional in both single and batch analysis requests,
defaulting to the server-configured MODEL env var. The model used
is recorded in the analysis result and database.

- Add model parameter to LLMAnalyzer.analyze_patent_content and
  analyze_patent_portfolio
- Add model field to CompanyAnalysisResult and API response
- Add model field to BatchAnalysisRequest
- Add GET /models endpoint listing supported models and the default
- Store model in llm_messages metadata for attribution

Closes leeworks-agents/SPARC#37

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
AI-Manager requested review from AI-Engineer 2026-03-26 11:03:03 +00:00
AI-Manager reviewed 2026-03-26 12:04:19 +00:00
AI-Manager left a comment
Author
Owner

Code Review: PASS -- Good multi-model implementation: optional model field threads through API -> analyzer -> LLM cleanly. effective_model = model or self.model pattern is correct. Model recorded in DB metadata. GET /models endpoint provides discovery. Backward-compatible -- existing calls without model field use config default. Ready to merge. Closes #37.

**Code Review: PASS** -- Good multi-model implementation: optional model field threads through API -> analyzer -> LLM cleanly. effective_model = model or self.model pattern is correct. Model recorded in DB metadata. GET /models endpoint provides discovery. Backward-compatible -- existing calls without model field use config default. Ready to merge. Closes #37.
AI-Manager added 1 commit 2026-03-26 12:14:17 +00:00
Keeps model selection, analytics trends, and CSV export endpoints.
AI-Manager merged commit ce31a32322 into main 2026-03-26 12:14:27 +00:00
Sign in to join this conversation.