Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(types): resolve the four type-discipline additions surfaced by the staging merge

mateo-berri1a693a3014cb
diff --git a/litellm/types/files.py b/litellm/types/files.py
index e351a8cba37..259a836d9ad 100644
--- a/litellm/types/files.py
+++ b/litellm/types/files.py
@@ -250,36 +250,38 @@ Other FileType Groupings
"""
# Accepted file types for GEMINI 1.5 through Vertex AI
# https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/send-multimodal-prompts#gemini-send-multimodal-samples-images-nodejs
-GEMINI_1_5_ACCEPTED_FILE_TYPES: Final[set[FileType]] = {
- # Image
- FileType.PNG,
- FileType.JPEG,
- FileType.WEBP,
- # Audio
- FileType.AAC,
- FileType.FLAC,
- FileType.MP3,
- FileType.MPA,
- FileType.MPEG,
- FileType.MPGA,
- FileType.OPUS,
- FileType.PCM,
- FileType.WAV,
- FileType.WEBM,
- # Video
- FileType.FLV,
- FileType.MOV,
- FileType.MPEG,
- FileType.MPEGPS,
- FileType.MPG,
- FileType.MP4,
- FileType.WEBM,
- FileType.WMV,
- FileType.THREE_GPP,
- # PDF
- FileType.PDF,
- FileType.TXT,
-}
+GEMINI_1_5_ACCEPTED_FILE_TYPES: Final[frozenset[FileType]] = frozenset(
+ {
+ # Image
+ FileType.PNG,
+ FileType.JPEG,
+ FileType.WEBP,
+ # Audio
+ FileType.AAC,
+ FileType.FLAC,
+ FileType.MP3,
+ FileType.MPA,
+ FileType.MPEG,
+ FileType.MPGA,
+ FileType.OPUS,
+ FileType.PCM,
+ FileType.WAV,
+ FileType.WEBM,
+ # Video
+ FileType.FLV,
+ FileType.MOV,
+ FileType.MPEG,
+ FileType.MPEGPS,
+ FileType.MPG,
+ FileType.MP4,
+ FileType.WEBM,
+ FileType.WMV,
+ FileType.THREE_GPP,
+ # PDF
+ FileType.PDF,
+ FileType.TXT,
+ }
+)
def is_gemini_1_5_accepted_file_type(file_type: FileType) -> bool:
diff --git a/litellm/types/guardrails.py b/litellm/types/guardrails.py
index 329b043c019..60c3830fbef 100644
--- a/litellm/types/guardrails.py
+++ b/litellm/types/guardrails.py
@@ -171,15 +171,13 @@ class GuardrailItem(BaseModel):
enabled_roles: list[Role] | None = default_roles,
callback_args: dict[str, dict] | None = None,
) -> None:
- if callback_args is None:
- callback_args = {}
super().__init__(
callbacks=callbacks,
default_on=default_on,
logging_only=logging_only,
guardrail_name=guardrail_name,
enabled_roles=enabled_roles,
- callback_args=callback_args,
+ callback_args=callback_args or {},
)
diff --git a/litellm/types/integrations/slack_alerting.py b/litellm/types/integrations/slack_alerting.py
index a96e70ff496..56616c00aa0 100644
--- a/litellm/types/integrations/slack_alerting.py
+++ b/litellm/types/integrations/slack_alerting.py
@@ -30,7 +30,7 @@ class OutageModel(BaseOutageModel):
class ProviderRegionOutageModel(BaseOutageModel):
provider_region_id: str
- deployment_ids: set[str]
+ deployment_ids: set[str] # mutable-ok: outage state accumulates ids via .add() and round-trips the cache as a list
# we use this for the email header, please send a test email if you change this. verify it looks good on email
diff --git a/litellm/types/utils.py b/litellm/types/utils.py
index 1a022e58495..0d34ca21cef 100644
--- a/litellm/types/utils.py
+++ b/litellm/types/utils.py
@@ -1220,7 +1220,7 @@ ChatCompletionMessage(content='This is a test', role='assistant', function_call=
def add_provider_specific_fields(object: BaseModel, provider_specific_fields: dict[str, Any] | None) -> None:
if not provider_specific_fields: # set if provider_specific_fields is not empty
return
- object.provider_specific_fields = provider_specific_fields
+ object.provider_specific_fields = provider_specific_fields # rebind-ok: sets the field on the caller's model
class Message(SafeAttributeModel, OpenAIObject):