mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix(types): resolve the four type-discipline additions surfaced by the staging merge
This commit is contained in:
parent
51c54b56ac
commit
1a693a3014
4 changed files with 35 additions and 35 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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 {},
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue