Skip to content

Bug PDF MIME Type Misconfiguration for LiteLLM Models #2430

@yacinebouaouni

Description

@yacinebouaouni

Describe the bug
Requests to Vertex AI using mimeType: "pdf" fail with a 400 Bad Request error because "pdf" is not a supported MIME type. As the error message states:

...mimeType parameter with value pdf, which is not supported. Update the mimeType and try again...
(Error originates from Vertex AI’s Gemini model endpoint)

 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'}}
This misconfiguration causes litellm operations involving PDF handling to break.

To Reproduce
Steps to reproduce the behavior:

  1. Install google-adk 1.10.0
  2. Run adk web with an agent that uses litellm models
  3. Open adk web
  4. Send a request that contains pdf file
  5. A 400 error is raised

Example code:

import os
import litellm
from google.adk.models.lite_llm import LiteLlm
from google.adk.agents import Agent

auth_headers = {
    "Authorization": f"Bearer {os.getenv('LITELLM_PROXY_API_KEY')}",  
    "Proxy-Authorization": f"Bearer {os.getenv('IAP_ACCESS_TOKEN')}",  
}

litellm.use_litellm_proxy = True
root_agent = Agent(
    name="agent_litellm_proxy",
    model=LiteLlm(
        model="gemini-2.5-flash",
        extra_headers=auth_headers,
    ),
    description="Provides information using a model from LiteLLM proxy.",
    instruction="You are a helpful assistant that provides information based on the user's queries.",
)

Expected behavior
Expected to get an answer from litellm.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS] WSL2
  • Python version(python -V): 3.11
  • ADK version(pip show google-adk): 1.10.0

Model Information:
gemini models > 2.0

Metadata

Metadata

Assignees

Labels

bot triaged[Bot] This issue is triaged by ADK botmodels[Component] Issues related to model support

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions