Describe the bug
When I try to use GcsArtifactService with model provider as LiteLLM, I face this problem,
Traceback (most recent call last):
File "/opt/miniconda3/envs/adk-agents/lib/python3.10/site-packages/litellm/main.py", line 603, in acompletion
response = await init_response
File "/opt/miniconda3/envs/adk-agents/lib/python3.10/site-packages/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py", line 2141, in async_streaming
request_body = await async_transform_request_body(
File "/opt/miniconda3/envs/adk-agents/lib/python3.10/site-packages/litellm/llms/vertex_ai/gemini/transformation.py", line 633, in async_transform_request_body
return _transform_request_body(
File "/opt/miniconda3/envs/adk-agents/lib/python3.10/site-packages/litellm/llms/vertex_ai/gemini/transformation.py", line 535, in _transform_request_body
raise e
File "/opt/miniconda3/envs/adk-agents/lib/python3.10/site-packages/litellm/llms/vertex_ai/gemini/transformation.py", line 490, in _transform_request_body
content = litellm.VertexGeminiConfig()._transform_messages(
File "/opt/miniconda3/envs/adk-agents/lib/python3.10/site-packages/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py", line 1944, in _transform_messages
return _gemini_convert_messages_with_history(messages=messages, model=model)
File "/opt/miniconda3/envs/adk-agents/lib/python3.10/site-packages/litellm/llms/vertex_ai/gemini/transformation.py", line 441, in _gemini_convert_messages_with_history
raise e
File "/opt/miniconda3/envs/adk-agents/lib/python3.10/site-packages/litellm/llms/vertex_ai/gemini/transformation.py", line 293, in _gemini_convert_messages_with_history
raise Exception(
Exception: Unable to determine mime type for file_id: gs://agent-artifact-bucket/davinci_orchestration_agent/1234567890/kursat-test-3/artifact_e-075eb4f7-a958-4d00-9bf9-108346e4d0e4_1/0, set this explicitly using message[0].content[2].file.format
The root cause of this issue is a mismatch between the native data structures (Google GenAI Part objects) used by the Google ADK and the JSON schema expected by LiteLLM (which is generally OpenAI-compatible).
The situation is as follows:
Problem: The Google ADK sends the artifact to LLM as an object with a mime_type attribute. However, LiteLLM requires the OpenAI standard type: "image_url" structure or format parameter when processing image/file data. Because LiteLLM doesn't correctly map the mime_type field sent by the ADK, you receive a "format is required" error.
To Reproduce
root_agent = Agent(
name="DavinciOrchestrationRootAgent",
description="A Davinci Orchestration Agent that orchestrates the services of multiple sub-agents to create a davinci orchestration response",
model= LiteLlm(
model="vertex_ai/gemini-2.5-pro,
drop_params=True,
vertex_credentials=config.service_account_path,
thinking={
type="enabled",
budget_tokens=1024,
},
),
instruction="You are a helpful agent that you answer user questions.",
tools=[
load_artifacts,
],
)
session_service = DatabaseSessionService(db_url=config.session_db_path)
artifact_service = GcsArtifactService(bucket_name=config.artifact_bucket_name)
app = App(
name=config.app_name,
root_agent=root_agent,
plugins=[
SaveFilesAsArtifactsPlugin(),
],
)
runner = Runner(
app=app,
session_service=session_service,
artifact_service=artifact_service
)
Expected behavior
When I use gemini models with native google adk provider there is no problem GcsArtifactService works fine. I want also work this with LiteLLM as provider.
Desktop (please complete the following information):
- OS: MacOS, Linux
- Python version(python -V): 3.10
- ADK version(pip show google-adk): 1.19.0
Model Information:
- Are you using LiteLLM: Yes
- Which model is being used: gemini-2.5-pro
Describe the bug
When I try to use GcsArtifactService with model provider as LiteLLM, I face this problem,
The root cause of this issue is a mismatch between the native data structures (Google GenAI Part objects) used by the Google ADK and the JSON schema expected by LiteLLM (which is generally OpenAI-compatible).
The situation is as follows:
Problem: The Google ADK sends the artifact to LLM as an object with a mime_type attribute. However, LiteLLM requires the OpenAI standard type: "image_url" structure or format parameter when processing image/file data. Because LiteLLM doesn't correctly map the mime_type field sent by the ADK, you receive a "format is required" error.
To Reproduce
Expected behavior
When I use gemini models with native google adk provider there is no problem GcsArtifactService works fine. I want also work this with LiteLLM as provider.
Desktop (please complete the following information):
Model Information: