mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-21 00:21:49 +00:00
fix(proxy): reject non-finite temp budget increases on team member update
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
42429500be
commit
67c522fe73
2 changed files with 8 additions and 3 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue