diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 767e5d7b5ff..49fe39a6d17 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -1,7 +1,7 @@ import enum import json import os -from collections.abc import Callable, Mapping +from collections.abc import Callable, Mapping, Sequence from datetime import datetime from types import MappingProxyType from typing import TYPE_CHECKING, Any, Final, Literal, NamedTuple @@ -1278,7 +1278,7 @@ class GenerateKeyResponse(KeyRequestBase): updated_by: str | None = None created_at: datetime | None = None updated_at: datetime | None = None - warnings: list[KeyTeamLimitWarning] | None = None + warnings: Sequence[KeyTeamLimitWarning] | None = None @model_validator(mode="before") @classmethod diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py index 7ef0d7ca736..fa08a316ef7 100644 --- a/litellm/proxy/management_endpoints/key_management_endpoints.py +++ b/litellm/proxy/management_endpoints/key_management_endpoints.py @@ -1529,10 +1529,10 @@ def _collect_key_team_limit_warnings( def _maybe_add_key_team_limit_warnings( - payload: dict[str, object], + payload: Mapping[str, object], data: GenerateKeyRequest | UpdateKeyRequest, team_table: LiteLLM_TeamTable | LiteLLM_TeamTableCachedObj | None, -) -> dict[str, object]: +) -> Mapping[str, object]: """Attach team-limit warnings to a key update payload when caps are exceeded.""" if team_table is None: return payload @@ -3239,7 +3239,7 @@ async def update_key_fn( if response is None: raise ValueError("Failed to update key got response = None") - updated_key_info: Final[dict[str, object]] = {"key": key, **response["data"]} + updated_key_info: Final[Mapping[str, object]] = {"key": key, **response["data"]} if team_limit_warnings: return {**updated_key_info, "warnings": list(team_limit_warnings)} return updated_key_info