mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-20 00:11:50 +00:00
fix(router): reject unknown capability policy fields
This commit is contained in:
parent
914ae9b248
commit
e62f0d0376
2 changed files with 12 additions and 1 deletions
|
|
@ -616,7 +616,7 @@ class CapabilityCalibrationConfig(BaseModel):
|
|||
class CapabilityClassifierConfig(BaseModel):
|
||||
"""Switchyard-compatible probability threshold policy for two model tiers."""
|
||||
|
||||
model_config = ConfigDict(frozen=True)
|
||||
model_config = ConfigDict(extra="forbid", frozen=True)
|
||||
|
||||
efficient_tier: str = Field(
|
||||
description="Tier used when the efficient model's forecasted solve probability meets the adjusted threshold",
|
||||
|
|
|
|||
|
|
@ -2500,6 +2500,17 @@ class TestCapabilityClassifierConfig:
|
|||
with pytest.raises(ValidationError, match="requires classifier_type 'capability'"):
|
||||
ComplexityRouterConfig(**config)
|
||||
|
||||
def test_rejects_misspelled_optional_policy_instead_of_using_defaults(self) -> None:
|
||||
with pytest.raises(ValidationError, match="threshold_steps"):
|
||||
CapabilityClassifierConfig.model_validate(
|
||||
{
|
||||
"efficient_tier": "SIMPLE",
|
||||
"capable_tier": "REASONING",
|
||||
"base_threshold": 0.5,
|
||||
"threshold_steps": 0.2,
|
||||
}
|
||||
)
|
||||
|
||||
def test_threshold_defaults_match_switchyard(self):
|
||||
config = CapabilityClassifierConfig(efficient_tier=" SIMPLE ", capable_tier=" REASONING ", base_threshold=0.5)
|
||||
assert config.efficient_tier == "SIMPLE"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue