Gemma 4 Tool Calling Bug Fixed
Key point
A bug in Gemma 4's chat template that failed to handle complex JSON Schema has been fixed.
Details
A bug was discovered in the default chat template (Jinja) of the Gemma 4 model that failed to properly handle JSON Schema structures such as anyOf, $ref, and $defs.
Due to this bug, complex tool parameters containing nullable references were rendered with an empty type field, and as a result, the model failed to recognize the tool's schema information, causing tool calling to fail.
The issue was resolved through a Jinja template modification, and the fixed template preserves the following key fields:
- $ref, anyOf, oneOf, allOf, $defs
- enum, const
- type arrays and items/properties
This fix was submitted as a PR (Pull Request) to Hugging Face's google/gemma-4-31B-it repository.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.