FoolDev Claude Fable 5 commited on
Commit
f4db68f
·
1 Parent(s): cd9bae2

fix: honor think=false by gating the <think> prefill on IsThinkSet

Browse files

The generation prompt unconditionally prefilled an open <think>, so requests with think=false still forced a reasoning trace (it leaked into content). Gate the prefill on IsThinkSet: emit a closed empty think block when thinking is explicitly off, else open <think>. Verified vs Ollama 0.30.8: think=true keeps reasoning in the thinking field, think=false suppresses it, unset still reasons. template + Modelfile kept bridge-synced. Also corrects the stale '-o on ollama run' comment (no such flag; use /set parameter).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Files changed (2) hide show
  1. Modelfile +8 -1
  2. template +7 -0
Modelfile CHANGED
@@ -54,7 +54,14 @@ For each function call, return a json object with function name and arguments wi
54
  </tool_response><|im_end|>
55
  {{ end }}
56
  {{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
 
57
  <think>
 
 
 
 
 
 
58
  {{ end }}
59
  {{- end }}"""
60
 
@@ -121,7 +128,7 @@ Behavior rules:
121
  # `ollama ps` shows 3% CPU / 97% GPU at 4096 ctx.
122
  #
123
  # To run on a 32 GB unified-memory laptop, override these in your local
124
- # Modelfile copy (or pass via -o on `ollama run`):
125
  # PARAMETER num_ctx 4096
126
  # PARAMETER num_batch 256
127
  #
 
54
  </tool_response><|im_end|>
55
  {{ end }}
56
  {{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
57
+ {{ if and $.IsThinkSet (not $.Think) -}}
58
  <think>
59
+
60
+ </think>
61
+
62
+ {{ else -}}
63
+ <think>
64
+ {{ end -}}
65
  {{ end }}
66
  {{- end }}"""
67
 
 
128
  # `ollama ps` shows 3% CPU / 97% GPU at 4096 ctx.
129
  #
130
  # To run on a 32 GB unified-memory laptop, override these in your local
131
+ # Modelfile copy (or via `/set parameter` in the interactive `ollama run` REPL):
132
  # PARAMETER num_ctx 4096
133
  # PARAMETER num_batch 256
134
  #
template CHANGED
@@ -46,6 +46,13 @@ For each function call, return a json object with function name and arguments wi
46
  </tool_response><|im_end|>
47
  {{ end }}
48
  {{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
 
49
  <think>
 
 
 
 
 
 
50
  {{ end }}
51
  {{- end }}
 
46
  </tool_response><|im_end|>
47
  {{ end }}
48
  {{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
49
+ {{ if and $.IsThinkSet (not $.Think) -}}
50
  <think>
51
+
52
+ </think>
53
+
54
+ {{ else -}}
55
+ <think>
56
+ {{ end -}}
57
  {{ end }}
58
  {{- end }}