23 6 months ago

ollama run rushikesh_67/gpt-oss-finetuned:q3km

tools thinking
3285d50e87f1 · 2.5kB
<|start|>system<|message|>{{ .System }}
Current date: {{ currentDate }}
{{- if and .IsThinkSet .Think (ne .ThinkLevel "") }}
Reasoning: {{ .ThinkLevel }}
{{- else if or (not .IsThinkSet) (and .IsThinkSet .Think) }}
Reasoning: medium
{{- end }}
{{- if .Tools -}}
{{- $hasPython := false }}
{{- range .Tools }}
{{- if eq .Function.Name "python" -}}{{- $hasPython = true -}}{{- end }}
{{- end }}
{{- if $hasPython }}
# Tools
## python
Use this tool to execute Python code in your chain of thought. The code will not be shown to the user. This tool should be used for internal reasoning, but not for code that is intended to be visible to the user (e.g. plots/tables/files).
When you send a message containing Python code to python, it will be executed in a stateful Jupyter notebook environment and respond with its output. Internet access may be unavailable.
{{- end }}
{{- end }}
# Valid channels: analysis, commentary, final. Channel must be included for every message.
<|end|>
{{- /* Render conversation messages (no external tools except python) */ -}}
{{- $lastUserIdx := -1 }}
{{- $prefillingContent := false }}
{{- $prefillingThinkingOnly := false }}
{{- range $i, $msg := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if eq $msg.Role "user" }}{{- $lastUserIdx = $i }}{{- end -}}
{{- if and $last (eq $msg.Role "assistant") (gt (len $msg.Content) 0) }}{{- $prefillingContent = true }}
{{- else if and $last (eq $msg.Role "assistant") (gt (len $msg.Thinking) 0) }}{{- $prefillingThinkingOnly = true }}{{- end }}
{{- end }}
{{- range $i, $msg := .Messages }}
{{- if (ne $msg.Role "system") -}}
{{- if eq $msg.Role "tool" -}}
{{- if eq $msg.ToolName "python" -}}
<|start|>python to=assistant<|message|>{{ $msg.Content }}<|end|>
{{- end -}}
{{- else if eq $msg.Role "assistant" -}}
{{- if and $msg.Thinking (gt $i $lastUserIdx) -}}
<|start|>assistant<|channel|>analysis<|message|>{{ $msg.Thinking }}{{- if not $prefillingThinkingOnly -}}<|end|>{{- end -}}
{{- end -}}
{{- if gt (len $msg.Content) 0 -}}
<|start|>assistant<|channel|>final<|message|>{{ $msg.Content }}{{- if not $prefillingContent -}}<|end|>{{- end -}}
{{- end -}}
{{- else if eq $msg.Role "user" -}}
<|start|>user<|message|>{{ $msg.Content }}<|end|>
{{- end }}
{{- end }}
{{- end }}
{{- if not (or $prefillingContent $prefillingThinkingOnly) -}}
<|start|>assistant
{{- end -}}