mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-21 00:21:49 +00:00
fix(router): rank litellm_settings.request_timeout on the passthrough route like the completion route
This commit is contained in:
parent
74e9fb2323
commit
e75ad61fce
2 changed files with 17 additions and 1 deletions
|
|
@ -3877,11 +3877,17 @@ class Router:
|
|||
)
|
||||
|
||||
_router_timeout: Final = (
|
||||
float(self._explicit_timeout) if isinstance(self._explicit_timeout, (int, float)) else None
|
||||
self.request_timeout
|
||||
if self.request_timeout is not None
|
||||
else float(self._explicit_timeout)
|
||||
if isinstance(self._explicit_timeout, (int, float))
|
||||
else None
|
||||
)
|
||||
_router_stream_timeout: Final = (
|
||||
self.stream_timeout
|
||||
if self.stream_timeout is not None
|
||||
else self.request_timeout
|
||||
if self.request_timeout is not None
|
||||
else self.default_litellm_params.get("stream_timeout")
|
||||
)
|
||||
kwargs["timeout"] = resolve_llm_passthrough_timeout(
|
||||
|
|
|
|||
|
|
@ -8230,6 +8230,16 @@ class TestRouterRequestTimeoutPropagation:
|
|||
== 60
|
||||
)
|
||||
|
||||
def test_passthrough_prefers_request_timeout_over_router_timeout(self, explicit_request_timeout):
|
||||
router = self._make_router(timeout=330)
|
||||
deployment: Final = router.model_list[0]
|
||||
assert _passthrough_timeout(router, deployment, stream=False) == 300.0
|
||||
assert _passthrough_timeout(router, deployment, stream=True) == 300.0
|
||||
|
||||
def test_passthrough_stream_timeout_still_wins_over_request_timeout(self, explicit_request_timeout):
|
||||
router = self._make_router(timeout=330, stream_timeout=45)
|
||||
assert _passthrough_timeout(router, router.model_list[0], stream=True) == 45.0
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Deferred-stream eager-fetch tests
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue