Skip to content

mime_types trucates "image/", passing wrong mime types such as "jpeg"/"png" #2070

@SaarYogev

Description

@SaarYogev

** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.

Describe the bug
When sending parts with a blob containing an image using mime_type and data, the mime_type gets transformed from a type image/jpeg to jpeg.
This then causes the LLM call to fail, as the mime_type is not on the acceptables mime_types list, as this list linked in the error shows:
https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference

To Reproduce
Steps to reproduce the behavior:

  1. Install 'google-adk==1.7.0'
  2. Run parts.append(types.Part(inline_data=types.Blob(mime_type="image/jpeg", data=image_data_base64)))
  3. Send the request to Gemini 2.5 Pro via Vertex AI
  4. See error:
litellm.exceptions.BadRequestError: litellm.BadRequestError: VertexAIException BadRequestError - {
  "error": {
    "code": 400,
    "message": "Unable to submit request because it has a mimeType parameter with value jpeg, which is not supported. Update the mimeType and try again. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini",
    "status": "INVALID_ARGUMENT"
  }
}

Expected behavior
A 200-code response from the LLM, reading the image data correctly, just like it did with google-adk 1.6.1.

Desktop (please complete the following information):

  • OS: [e.g. iOS] Ubuntu 22.04
  • Python version(python -V): Python 3.12.3
  • ADK version(pip show google-adk): 1.7.0

Model Information:
Gemini 2.5 Pro

Additional context
I've located the exact PR and line which cause the issue:
https://github.com/google/adk-python/pull/1917/files
lite_llm.py:256
Why was it added I do not know, but I hope an existing contributor or the PR author himself would.

Metadata

Metadata

Labels

core[Component] This issue is related to the core interface and implementation

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions