diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 7728c7ee34f..d9529f7d575 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -4400,6 +4400,7 @@ class TeamMemberUpdateRequest(TeamMemberDeleteRequest): temp_budget_increase: float | None = Field( default=None, ge=0, + allow_inf_nan=False, description="Temporary additive budget increase for this team member, active until temp_budget_expiry", ) temp_budget_expiry: datetime | None = Field( diff --git a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py index b458b85602d..a7748220e44 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py +++ b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py @@ -15447,8 +15447,12 @@ def test_team_member_update_request_temp_budget_fields_must_be_set_together() -> TeamMemberUpdateRequest(team_id="team-1", user_id="user-1", temp_budget_expiry="2030-01-01T00:00:00Z") -def test_team_member_update_request_rejects_negative_temp_budget_increase() -> None: - with pytest.raises(ValidationError, match="greater than or equal to 0"): +@pytest.mark.parametrize( + ("increase", "message"), + [(-1.0, "greater than or equal to 0"), (float("inf"), "finite number")], +) +def test_team_member_update_request_rejects_unusable_temp_budget_increase(increase: float, message: str) -> None: + with pytest.raises(ValidationError, match=message): TeamMemberUpdateRequest( - team_id="team-1", user_id="user-1", temp_budget_increase=-1.0, temp_budget_expiry="2030-01-01T00:00:00Z" + team_id="team-1", user_id="user-1", temp_budget_increase=increase, temp_budget_expiry="2030-01-01T00:00:00Z" )