[PR #15611] [CLOSED] Fix Gemma4 generation prompt after tool responses #41103

Closed
opened 2026-04-23 01:50:05 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15611
Author: @dhiltgen
Created: 4/15/2026
Status: Closed

Base: mainHead: gemma4-tool-response


📝 Commits (1)

  • 68d03ae Fix Gemma4 generation prompt after tool responses

📊 Changes

2 files changed (+31 additions, -2 deletions)

View changed files

📝 model/renderers/gemma4.go (+6 -1)
📝 model/renderers/gemma4_reference_test.go (+25 -1)

📄 Description

Fix a Gemma4 renderer bug around whether to append a new model generation prompt after tool responses.

If the last input message was a tool response, the renderer assumed we were still inside the model turn and did not add <|turn>model But some tool-response cases are actually closed and need a fresh model generation prompt, especially when the tool response is followed by assistant prefill/content or when the tool-response block has been closed with <tool_response|> and <turn|>


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15611 **Author:** [@dhiltgen](https://github.com/dhiltgen) **Created:** 4/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `gemma4-tool-response` --- ### 📝 Commits (1) - [`68d03ae`](https://github.com/ollama/ollama/commit/68d03ae78ecd8bc704328924bf15b5ff0e8dd2df) Fix Gemma4 generation prompt after tool responses ### 📊 Changes **2 files changed** (+31 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `model/renderers/gemma4.go` (+6 -1) 📝 `model/renderers/gemma4_reference_test.go` (+25 -1) </details> ### 📄 Description Fix a Gemma4 renderer bug around whether to append a new model generation prompt after tool responses. If the last input message was a tool response, the renderer assumed we were still inside the model turn and did not add `<|turn>model` But some tool-response cases are actually closed and need a fresh model generation prompt, especially when the tool response is followed by assistant prefill/content or when the tool-response block has been closed with `<tool_response|> and <turn|>` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 01:50:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#41103