diff --git a/litellm/llms/vertex_ai/gemini/transformation.py b/litellm/llms/vertex_ai/gemini/transformation.py index f92e3ae4ca8..a109769f832 100644 --- a/litellm/llms/vertex_ai/gemini/transformation.py +++ b/litellm/llms/vertex_ai/gemini/transformation.py @@ -73,10 +73,13 @@ _GEMINI_MIME_TYPE_ALIASES: Dict[str, str] = { def _apply_gemini_mime_type_aliases(mime_type: str) -> str: - """Normalize known MIME aliases only; does not consult the file-type registry.""" - return _GEMINI_MIME_TYPE_ALIASES.get( - mime_type.strip().lower(), mime_type.strip().lower() - ) + """Normalize known MIME aliases only; does not consult the file-type registry. + + Also strips MIME parameters (e.g. ``; charset=utf-8``) so that values + sourced from GCS object metadata (``contentType``) validate correctly. + """ + normalized = mime_type.split(";", 1)[0].strip().lower() + return _GEMINI_MIME_TYPE_ALIASES.get(normalized, normalized) def _get_vertex_base() -> Any: