mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-12 19:04:59 +00:00
Merge pull request #15330 from jlan-nl/litellm-fix-erroneous-gpt5-cooldown-trigger
Minimal fix: gpt5 models should not go on cooldown when called with temperature!=1
This commit is contained in:
@@ -62,6 +62,8 @@ def _is_cooldown_required(
|
||||
return False
|
||||
|
||||
if isinstance(exception_status, str):
|
||||
if len(exception_status) == 0:
|
||||
return False
|
||||
exception_status = int(exception_status)
|
||||
|
||||
if exception_status >= 400 and exception_status < 500:
|
||||
|
||||
@@ -18,6 +18,7 @@ from litellm.router_utils.cooldown_handlers import (
|
||||
_should_run_cooldown_logic,
|
||||
_should_cooldown_deployment,
|
||||
cast_exception_status_to_int,
|
||||
_is_cooldown_required,
|
||||
)
|
||||
from litellm.router_utils.router_callbacks.track_deployment_metrics import (
|
||||
increment_deployment_failures_for_current_minute,
|
||||
@@ -31,6 +32,7 @@ from litellm.router_utils.cooldown_handlers import _should_cooldown_deployment
|
||||
|
||||
load_dotenv()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_router_cooldown_event_callback_no_deployment():
|
||||
"""
|
||||
@@ -397,3 +399,18 @@ def test_mixed_success_failure(mock_failures, mock_successes, router):
|
||||
assert (
|
||||
should_cooldown is False
|
||||
), "Should not cooldown when failure rate is below threshold"
|
||||
|
||||
|
||||
def test_is_cooldown_required_empty_string_exception_status(testing_litellm_router):
|
||||
"""
|
||||
Test that _is_cooldown_required returns False when exception_status is an empty string
|
||||
"""
|
||||
result = _is_cooldown_required(
|
||||
litellm_router_instance=testing_litellm_router,
|
||||
model_id="test_deployment",
|
||||
exception_status="",
|
||||
)
|
||||
|
||||
assert (
|
||||
result is False
|
||||
), "Should not require cooldown when exception_status is empty string"
|
||||
|
||||
Reference in New Issue
Block a user