-
Notifications
You must be signed in to change notification settings - Fork 3.2k
LiteLLM silently uses application/octet-stream when file_uri MIME type cannot be determined #5184
Copy link
Copy link
Open
Description
Bug Description
When file_data.file_uri has no explicit MIME type and the URI has no recognizable file extension, the LiteLLM integration silently falls back to application/octet-stream via _DEFAULT_MIME_TYPE. This causes incorrect file handling with providers that validate MIME types (e.g., Vertex AI for GCS URIs) without any warning to the developer.
Additionally, _content_to_message_param() does not propagate the model parameter in recursive calls for mixed function_response + file content, causing incorrect provider detection on Vertex AI / Gemini.
Steps to Reproduce
# A file_uri with no extension and no explicit MIME type
part = types.Part(file_data=types.FileData(
file_uri="gs://bucket/artifact/0"
# mime_type not set, no extension to infer from
))
# Result: silently uses "application/octet-stream"
# On Vertex AI, this leads to incorrect file handlingExpected Behavior
- A clear error should be raised when MIME cannot be determined and a file block needs to be constructed, with guidance to set
file_data.mime_typeexplicitly - Provider-specific text fallback paths should still work without requiring MIME
Actual Behavior
Silent fallback to application/octet-stream with a debug-level log that's easy to miss.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels