test(router): verify deployed classifier cost and provider accounting

This commit is contained in:
Joshua Valluru 2026-10-10 19:55:02 -07:00
parent d948091b9f
commit 58746028d4

View file

@ -559,6 +559,7 @@ async def test_deployed_decision_classifier_uses_registered_connection(
status_code: int, monkeypatch: pytest.MonkeyPatch
) -> None:
monkeypatch.setattr(litellm, "disable_aiohttp_transport", True)
monkeypatch.setitem(litellm.model_cost, "typesafe/jev-latest", {"input_cost_per_token": 0.01})
router: Final = litellm.Router(
model_list=[
{
@ -586,7 +587,11 @@ async def test_deployed_decision_classifier_uses_registered_connection(
route: Final = requests.post("https://decision.test/v1/systemone").mock(
return_value=httpx.Response(
status_code,
json={"model": "jev-latest", "answers": {"tier": _answer().model_dump()}},
json={
"model": "jev-latest",
"answers": {"tier": _answer().model_dump()},
"usage": {"input_tokens": 31, "output_tokens": 0},
},
)
)
outcome: Final = await classifier.aclassify("What is two plus two?")
@ -598,6 +603,9 @@ async def test_deployed_decision_classifier_uses_registered_connection(
assert outcome.jev_verdict is not None
assert outcome.jev_verdict.label == _answer().choice
assert outcome.jev_verdict.provider == "typesafe"
assert outcome.classifier_cost == pytest.approx(0.31)
@pytest.mark.parametrize("deployment_name", ["", " "])
def test_deployed_decision_classifier_rejects_blank_deployment_name(deployment_name: str) -> None: