mirror of
https://github.com/ollama/ollama
synced 2026-04-23 08:45:14 +00:00
gemma4: fix nothink case renderer (#15553)
Regressed in #15490 Fixes: #15536
This commit is contained in:
parent
798fd09bfe
commit
4d75f5da03
|
|
@ -40,6 +40,7 @@ func (r *Gemma4Renderer) Render(messages []api.Message, tools []api.Tool, thinkV
|
|||
|
||||
// Emit system turn if there's a system/developer role, tools, or thinking.
|
||||
hasThink := thinkValue != nil && thinkValue.Bool()
|
||||
thinkingExplicitlyDisabled := thinkValue != nil && thinkValue.IsBool() && !thinkValue.Bool()
|
||||
if hasSystemRole || len(tools) > 0 || hasThink {
|
||||
sb.WriteString("<|turn>system\n")
|
||||
if hasThink {
|
||||
|
|
@ -124,7 +125,7 @@ func (r *Gemma4Renderer) Render(messages []api.Message, tools []api.Tool, thinkV
|
|||
// Generation prompt.
|
||||
if prevMessageType != "tool_response" && prevMessageType != "tool_call" {
|
||||
sb.WriteString("<|turn>model\n")
|
||||
if !hasThink {
|
||||
if !hasThink && !thinkingExplicitlyDisabled {
|
||||
sb.WriteString("<|channel>thought\n<channel|>")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue