Models
GitHub
Discord
Docs
Pricing
Sign in
Download
Models
Download
GitHub
Discord
Docs
Pricing
Sign in
huihui_ai
/
glm-4.7-abliterated
:358b-q2_K
65
Downloads
Updated
2 days ago
Advancing the Coding Capability
Advancing the Coding Capability
Cancel
tools
thinking
glm-4.7-abliterated:358b-q2_K
...
/
template
da24502589fd · 1.5kB
{{- $lastUserIdx := -1 }}
{{- range $idx, $msg := .Messages -}}
{{- if eq $msg.Role "user" }}{{ $lastUserIdx = $idx }}{{ end -}}
{{- end }}
[gMASK]<sop>
{{- if or .System .Tools }}<|system|>
{{ if .System }}{{ .System }}
{{ end }}
{{- if .Tools }}# Tools
You may call one or more functions to assist with the user query.
You are provided with function signatures within <tools></tools> XML tags:
<tools>
{{- range .Tools }}
{"type": "function", "function": {{ .Function }}}
{{- end }}
</tools>
For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>
{{- end -}}
{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if eq .Role "user" }}<|user|>
{{ .Content }}
{{- else if eq .Role "assistant" }}<|assistant|>
{{- if (and $.IsThinkSet $.Think .Thinking (or $last (gt $i $lastUserIdx))) -}}
<think>{{ .Thinking }}</think>
{{- end }}
{{ if .Content }}{{ .Content }}{{ end }}
{{- if .ToolCalls }}
{{- range .ToolCalls }}
<tool_call>
{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
</tool_call>
{{- end }}
{{- end }}{{ if not $last }}
{{ end }}
{{- else if eq .Role "tool" }}<|user|>
<tool_response>
{{ .Content }}
</tool_response>
{{- end }}
{{- if and (ne .Role "assistant") $last }}<|assistant|>{{ if and $.IsThinkSet (not $.Think) }}</think>{{ else }}<think>{{ end }}
{{ end }}
{{- end }}