mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-26 01:12:21 +00:00
test(complexity_router): allow provider latency in live classification checks
This commit is contained in:
parent
57e137f346
commit
e4c7276e75
1 changed files with 7 additions and 1 deletions
|
|
@ -39,7 +39,7 @@ def heuristic_first_router(proxy: ProxyClient, request: pytest.FixtureRequest) -
|
|||
"heuristic_first_max_tier": "MEDIUM",
|
||||
"heuristic_first_max_context_tokens": 8000,
|
||||
"classifier_fallback": "heuristic",
|
||||
"classifier_llm_config": {"model": "gpt-5.5"},
|
||||
"classifier_llm_config": {"model": "gpt-5.5", "timeout_ms": 30000},
|
||||
"tiers": {
|
||||
"SIMPLE": "gpt-5.5",
|
||||
"MEDIUM": "claude-haiku-4-5",
|
||||
|
|
@ -133,6 +133,9 @@ def _send(
|
|||
|
||||
|
||||
def _assert_classifier_consulted(response: StreamingResponse, context: str) -> None:
|
||||
assert response.headers.get("x-litellm-complexity-router-cause") == "llm_classifier", (
|
||||
f"{context}: expected a successful classifier decision; observed headers={response.headers!r}"
|
||||
)
|
||||
classifier_cost: Final = response.headers.get("x-litellm-classifier-cost")
|
||||
assert classifier_cost is not None, (
|
||||
f"{context}: classifier header missing; observed headers={response.headers!r}; body={response.body[:300]!r}"
|
||||
|
|
@ -190,6 +193,9 @@ class TestHeuristicFirstLongContext:
|
|||
f"single-turn heuristic path unexpectedly consulted classifier; "
|
||||
f"observed headers={response.headers!r}; body={response.body[:300]!r}"
|
||||
)
|
||||
assert response.headers.get("x-litellm-complexity-router-cause") == "heuristic_first_short_circuit", (
|
||||
f"single-turn request should bypass the classifier; observed headers={response.headers!r}"
|
||||
)
|
||||
rows: Final = client.proxy.poll_logs_for_key(heuristic_first_key, min_rows=1)
|
||||
served: Final = tuple(row.model for row in rows if row.model is not None)
|
||||
assert len(served) == 1 and served[0] in SIMPLE_MODELS, (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue