Skip to content

fix: warn on silent MIME type fallback and propagate model in recursive calls - #5207

Closed
enjoykumawat wants to merge 4 commits into
google:mainfrom
enjoykumawat:fix/litellm-mime-type-warning
Closed

enjoykumawat wants to merge 4 commits into
google:mainfrom
enjoykumawat:fix/litellm-mime-type-warning

Conversation

@enjoykumawat

Copy link
Copy Markdown
Contributor

Summary

  • Upgrade logger.debug to logger.warning when falling back to application/octet-stream for file URIs without determinable MIME type
  • Fix _content_to_message_param() to propagate model parameter in recursive calls for mixed function_response + content parts

Root Cause

  1. Silent application/octet-stream fallback with only a debug log caused incorrect file handling on Vertex AI
  2. Missing model=model in recursive call lost provider-specific behavior (e.g., Anthropic thinking blocks)

Test Plan

  • Test verifying warning is logged on MIME fallback
  • Test verifying model propagation in recursive calls with mixed parts
  • Existing LiteLLM tests pass

Fixes #5184

@adk-bot adk-bot added the models [Component] This issue is related to model support label Apr 8, 2026
@rohityan rohityan self-assigned this Apr 9, 2026
…ve calls

LiteLLM silently fell back to application/octet-stream when file_uri
MIME type could not be determined, using only a debug log that was easy
to miss. Upgrade to warning level so developers notice the fallback.

Also fix _content_to_message_param() to propagate the model parameter
in recursive calls for mixed function_response + content parts, which
caused incorrect provider detection on Vertex AI / Anthropic.

Fixes google#5184
@enjoykumawat
enjoykumawat force-pushed the fix/litellm-mime-type-warning branch from d149537 to c03864d Compare April 9, 2026 07:41
@rohityan rohityan added the request clarification [Status] The maintainer need clarification or more information from the author label Apr 13, 2026
@rohityan

Copy link
Copy Markdown
Collaborator

Hi @enjoykumawat, Thank you for your contribution! We appreciate you taking the time to submit this pull request. Please fix formatting errors by running autoformat.sh

@enjoykumawat

Copy link
Copy Markdown
Contributor Author

Hi @rohityan, thanks for the feedback! I've run autoformat.sh and pushed the formatting fixes. Ready for review.

@enjoykumawat

Copy link
Copy Markdown
Contributor Author

Closing as superseded. While rebasing this onto current main, I found upstream commit 42eceb3a (fix: raise ValueError for unsupported MIME types in file_data URI path) replaced the entire silent-fallback code path this PR was warning about — _get_content now raises a ValueError instead of silently defaulting to application/octet-stream and logging, so there's no longer a silent fallback to warn on. The model=model recursive-call propagation this PR also fixed is likewise already present in current main.

Nothing left of this PR to contribute — thanks for the review time regardless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

models [Component] This issue is related to model support request clarification [Status] The maintainer need clarification or more information from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LiteLLM silently uses application/octet-stream when file_uri MIME type cannot be determined

3 participants