Emit an empty thought after a tool response when enable_thinking=false

#53

Same change as https://huggingface.co/google/gemma-4-26B-A4B-it/discussions/67: this repository ships a byte-identical chat_template.jinja.

With enable_thinking=false the generation prompt after a user turn ends with an empty thought
(<|channel>thought\n<channel|>), but after a tool response it ends right after <tool_response|>. The model then
opens the thought channel on its own; on long tool-calling conversations it sometimes never closes it, and a
reasoning parser returns an empty content. This change emits the same empty thought after a tool response. The
renders after a user turn, and with enable_thinking=true, are unchanged.

Reproduction, measurements and a workaround are in the linked PR. They were made with gemma-4-26B-A4B-it; I did not
run this checkpoint.

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment