Repository navigation
Conversation
Merging this PR will not alter performance
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
BrickerP
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES on head 7e01b1f045bf3a847877bbf07addcadb50d28782.
Blocker: _LITELLM_PARAMS_ADAPTER.validate_python(deployment["litellm_params"]) assumes a plain dict, but Router deployments commonly carry a LiteLLM_Params model. That raises ValidationError: Input should be a valid dictionary ... input_type=LiteLLM_Params inside _update_kwargs_with_deployment and breaks the existing helper-utils / tag / tools tests (CI unit job: 12 failed, including test_update_kwargs_with_deployment* — run 39040008906).
Also: when stream=True and only timeout_by_service_tier matches, deployment/router stream_timeout is skipped entirely — easy to shorten long stream budgets after adding a flex non-stream map.
Caller-override precedence and invalid-duration validation look solid once the adapter coercion is fixed.
| router_stream_timeout=_router_stream_timeout, | ||
| service_tier_timeout=get_service_tier_timeout( | ||
| _FALLBACK_HOP_ADAPTER.validate_python(kwargs), | ||
| _LITELLM_PARAMS_ADAPTER.validate_python(deployment["litellm_params"]), |
There was a problem hiding this comment.
This is the regression. _LITELLM_PARAMS_ADAPTER is TypeAdapter(Mapping[str, object]), so a live LiteLLM_Params instance fails with dict_type before timeout resolution runs.
CI evidence (unit/router): test_update_kwargs_with_deployment, test_update_kwargs_with_deployment_propagates_model_tags, …_merges_tags_without_duplicates, …_no_tags, …_merges_tools, and the malformed-tools-drop matrix all fail with that ValidationError on this head.
Coerce first, e.g. params if isinstance(params, Mapping) else params.model_dump(exclude_none=False) (same for self.default_litellm_params and the non-passthrough _get_timeout call below), or teach the adapter/helper to accept LiteLLM_Params.
There was a problem hiding this comment.
Fixed in a0af8a1 by normalizing typed deployments before timeout resolution. Added dictionary/model regressions, and the router CI job now passes
| ) | ||
| if stream_timeout is not None: | ||
| return stream_timeout | ||
| overrides: Final = deployment.get("timeout_by_service_tier") |
There was a problem hiding this comment.
Stream footgun: if stream is true and stream_timeout_by_service_tier is missing or has no entry for the tier, this falls through to timeout_by_service_tier and _get_timeout then early-returns that value — never consulting deployment/router stream_timeout (old _get_stream_timeout path).
Example: timeout=1, stream_timeout=30, timeout_by_service_tier={flex: 4}, request service_tier=flex&stream=true → 4 instead of 30.
Prefer: miss on the stream tier map → keep the existing stream timeout chain; only use the non-stream tier map for non-stream (or when no stream_timeout is configured). At minimum document + test that case.
There was a problem hiding this comment.
Fixed in a0af8a1, preserving deployment/router stream limits unless a stream-tier entry matches. Regression coverage includes both routing paths. Could you take another look?
|
Thanks for this. The feature landed in #47406 with the same keys and precedence, and you are credited as co-author there. Closing as superseded |
TLDR
Problem this solves:
How it solves it:
Intentional product change: configured service tiers get their own timeout without changing the timeout for standard requests
User Flow
Before: a slow Flex request hits the ordinary deployment timeout
service_tier: flexto/v1/chat/completionsor/v1/responses, without a timeout headerAfter: the admin can allow Flex requests more time
Relevant issues
Fixes #46205
Pre-Submission checklist
Local
make checkand static router coverage pass. The router, registry, and core-timeout run passes 3,066 tests. Also verified 37 local HTTP cases at7b02da03The new split-timeout matrix fails eight cases if non-stream tier selection is bypassed and passes all 40 with the resolution. Both deployment dictionaries and typed deployments are covered
Screenshots / Proof of Fix
Not tested against real provider APIs. This proof uses a localhost LiteLLM proxy and a scripted HTTP upstream that responds after two seconds
Both runs use
timeout: 1,stream_timeout: 1and no retries. After adds:The same curl requests are used on both revisions.
auth.headerssupplies the local proxy bearer tokenBefore (f370235)
Chat completions
post chat/completions '{"model":"audit","service_tier":"flex","messages":[{"role":"user","content":"delay=2"}]}'HTTP 408, elapsed 1.436341s, request timed out at the one-second deployment limitResponses
post responses '{"model":"audit","service_tier":"flex","input":"delay=2"}'HTTP 408, elapsed 1.082554s, connection timed out withTimeout passed=1.0After (7b02da0)
Chat completions
post chat/completions '{"model":"audit","service_tier":"flex","messages":[{"role":"user","content":"delay=2"}]}'HTTP 200, elapsed 2.134317s, contentaudit ok,service_tier: flexResponses
post responses '{"model":"audit","service_tier":"flex","input":"delay=2"}'HTTP 200, elapsed 2.078123s, statuscompleted, output textaudit okType
New Feature
Caveats
Low