forked from 0xWheatyz/SPARC
Add model allow-list validation to analysis endpoints #1015
Reference in New Issue
Block a user
Delete Branch "feature/1013-multi-model"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
_validate_model()helper that rejects unsupported LLM model identifiers with HTTP 400 on all analysis endpoints (single, batch, async batch)SUPPORTED_MODELSlist was already defined for the/modelsendpoint but incoming requests were not validated against itCloses #1013
Test plan
pytest tests/test_api.py::TestModelValidationpassesGET /analyze/nvidia?model=fake/badreturns 400GET /analyze/nvidia?model=anthropic/claude-3.5-sonnetsucceeds🤖 Generated with Claude Code
Code Review (AI-Manager)
Reviewed the model allow-list validation changes. The implementation is clean and correct:
_SUPPORTED_MODEL_IDSset is derived from the existingSUPPORTED_MODELSlist, avoiding duplication._validate_model()correctly handlesNone(no model specified) by passing through./modelslisting endpoint.This PR is ready to merge.