fklska/school-answer
020
1 2FROM qwen3-4b-instruct-2507.Q4_K_M.gguf3TEMPLATE """4{{- $lastUserIdx := -1 -}}5{{- range $idx, $msg := .Messages -}}6{{- if eq $msg.Role "user" }}{{ $lastUserIdx = $idx }}{{ end -}}7{{- end }}8{{- if or .System .Tools }}<|im_start|>system9{{ if .System }}10{{ .System }}11{{- end }}12{{- if .Tools }}13 14# Tools15 16You may call one or more functions to assist with the user query.17 18You are provided with function signatures within <tools></tools> XML tags:19<tools>20{{- range .Tools }}21{"type": "function", "function": {{ .Function }}}22{{- end }}23</tools>24 25For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:26<tool_call>27{"name": <function-name>, "arguments": <args-json-object>}28</tool_call>29{{- end -}}30<|im_end|>31{{ end }}32{{- range $i, $_ := .Messages }}33{{- $last := eq (len (slice $.Messages $i)) 1 -}}34{{- if eq .Role "user" }}<|im_start|>user35{{ .Content }}<|im_end|>36{{ else if eq .Role "assistant" }}<|im_start|>assistant37{{ if (and $.IsThinkSet (and .Thinking (or $last (gt $i $lastUserIdx)))) -}}38<think>{{ .Thinking }}</think>39{{ end -}}40{{ if .Content }}{{ .Content }}41{{- else if .ToolCalls }}<tool_call>42{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}43{{ end }}</tool_call>44{{- end }}{{ if not $last }}<|im_end|>45{{ end }}46{{- else if eq .Role "tool" }}<|im_start|>user47<tool_response>48{{ .Content }}49</tool_response><|im_end|>50{{ end }}51{{- if and (ne .Role "assistant") $last }}<|im_start|>assistant52{{ end }}53{{- end }}54"""