🔴 Required Information
Describe the Bug:
When using ADK's LiteLLM with any Gemma 4 model on any LLM serving backend, the message for a tool call result should have role tool_responses (specified in the model card).
This is a known issue in #5650 . However, the bugfix only handled the situation of using Ollama as the serving backend, by checking if the model name contains string gemma4:
tool_role = "tool_responses" if "gemma4" in model.lower() else "tool"
Google published Gemma 4 models in huggingface using gemma-4 as the prefix of model names. As a result, when serving with other backends (e.g., vLLM, llama.cpp, etc.), the corresponding tool_role will still be tool. This would still cause Gemma 4 misbehavior as either dead loop till OOM, or hallucinate.
Steps to Reproduce:
Please provide a numbered list of steps to reproduce the behavior:
- Using vLLM or llama.cpp to serve gemma4 model from hugging face
- Run any ADK agent with a tool use, using the vLLM/llama.cpp via ADK's built-in litellm as default model
Expected Behavior:
After tool use, the result message being sent to the model should have role being tool_responses and the model should response based on tool results.
Observed Behavior:
After tool use, the result message being sent to the model had role tool, and the model start produce emojis, weird symbols, or dead loops.
Environment Details:
- ADK Library Version (pip show google-adk): 2.3.0
- Desktop OS:** macOS
- Python Version (python -V): 3.13.14
Model Information:
- Are you using LiteLLM: Yes
- Which model is being used: google/gemma-4-26B-A4B
🟡 Optional Information
Regression:
No
Additional Context:
Relevant issue: #5650
Relevant bugfix: 3d07960
How often has this issue occurred?:
Wrong role always occurred (100%). The model often respond in unexpected low quality (50%+.)
🔴 Required Information
Describe the Bug:
When using ADK's LiteLLM with any Gemma 4 model on any LLM serving backend, the message for a tool call result should have role
tool_responses(specified in the model card).This is a known issue in #5650 . However, the bugfix only handled the situation of using Ollama as the serving backend, by checking if the model name contains string
gemma4:tool_role = "tool_responses" if "gemma4" in model.lower() else "tool"Google published Gemma 4 models in huggingface using
gemma-4as the prefix of model names. As a result, when serving with other backends (e.g., vLLM, llama.cpp, etc.), the correspondingtool_rolewill still betool. This would still cause Gemma 4 misbehavior as either dead loop till OOM, or hallucinate.Steps to Reproduce:
Please provide a numbered list of steps to reproduce the behavior:
Expected Behavior:
After tool use, the result message being sent to the model should have role being
tool_responsesand the model should response based on tool results.Observed Behavior:
After tool use, the result message being sent to the model had role
tool, and the model start produce emojis, weird symbols, or dead loops.Environment Details:
Model Information:
🟡 Optional Information
Regression:
No
Additional Context:
Relevant issue: #5650
Relevant bugfix: 3d07960
How often has this issue occurred?:
Wrong role always occurred (100%). The model often respond in unexpected low quality (50%+.)