Skip to content

Fix PDF MIME type for LiteLLM models #2429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yacinebouaouni
Copy link

@yacinebouaouni yacinebouaouni commented Aug 7, 2025

Problem

The "pdf" format is currently used as the MIME type in models/lite_llm.py, causing Vertex AI to return a 400 Bad Request error due to an unsupported mimeType. For example:
litellm.exceptions.BadRequestError: litellm.BadRequestError: Error code: 400 - {'error': {'message': 'litellm.BadRequestError: VertexAIException BadRequestError - {\n "error": {\n "code": 400,\n "message": "Unable to submit request because it has a mimeType parameter with value pdf, which is not supported. Update the mimeType and try again. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini",\n "status": "INVALID_ARGUMENT"\n }\n}\n. Received Model Group=gemini-2.5-flash\nAvailable Model Group Fallbacks=None', 'type': None, 'param': None, 'code': '400'}}
`

Solution

This PR updates the MIME type to a supported format (e.g., application/pdf) in the relevant sections of the code.

Fixes #2430

Validation

  • All unit tests (via pytest ./tests/unittests) now pass successfully.
  • The fix has been tested end-to-end, and the operation that previously failed now completes without errors. (screenshots below)

Screenshots

The agent code

contribution_adk_code

Test with adk eb

contribution_adk_example

Copy link

google-cla bot commented Aug 7, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@adk-bot
Copy link
Collaborator

adk-bot commented Aug 7, 2025

Response from ADK Triaging Agent

Hello @yacinebouaouni, thank you for your contribution!

Before we can review your pull request, a couple of things need to be addressed:

  • Contributor License Agreement (CLA): It looks like the CLA check has failed. Please visit https://cla.developers.google.com/ to sign the agreement.
  • Associated Issue: For bug fixes, we require an associated GitHub issue. Could you please create one and link it to this PR?

You can find more details in our contribution guidelines.

Thank you!

@adk-bot adk-bot added bot triaged [Bot] This issue is triaged by ADK bot models [Component] Issues related to model support labels Aug 8, 2025
@adk-bot adk-bot requested a review from genquan9 August 8, 2025 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot triaged [Bot] This issue is triaged by ADK bot models [Component] Issues related to model support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug PDF MIME Type Misconfiguration for LiteLLM Models
2 participants