Models
Docs
Pricing
Sign in
Download
Models
Download
Docs
Pricing
Sign in
frob
/
minimax-m2.1
:latest
824
Downloads
Updated
1 month ago
Cancel
tools
thinking
minimax-m2.1:latest
...
/
template
6dc1fe3f1a44 · 1.6kB
{{- $lastUserIdx := -1 -}}
{{- range $idx, $msg := .Messages -}}
{{- if eq $msg.Role "user" }}{{ $lastUserIdx = $idx }}{{ end }}
{{- end -}}
]~!b[]~b]system
{{- if .System }}
{{ .System }}
{{- else }}
You are a helpful assistant.
{{- end }}
{{- if .Tools }}
# Tools
You may call one or more tools to assist with the user query.
Here are the tools available in JSONSchema format:
<tools>
{{- range .Tools }}
{"type": "function", "function": {{ .Function }}}
{{- end }}
</tools>
When making tool calls, use 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 -}}
[e~[
{{- $inTool := false }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if $inTool }}
{{- if ne .Role "tool" }}
{{- $inTool = false -}}
[e~[
{{- end }}
{{- end }}
{{- if eq .Role "assistant" }}
]~b]ai
{{- if (and $.IsThinkSet (and .Thinking (or $last (gt $i $lastUserIdx)))) -}}
<think>
{{ .Thinking }}
</think>
{{ end }}
{{- if .Content }}
{{ .Content }}
{{- end }}
{{- if .ToolCalls -}}
<tool_call>
{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
{{- end -}}
</tool_call>
{{- end -}}
[e~[
{{- end }}
{{- if eq .Role "user" }}
]~b]user
{{ .Content -}}
[e~[
{{- end }}
{{- if eq .Role "tool" }}
{{- if not $inTool }}{{ $inTool = true -}}
]~b]tool
{{- end }}
<response>
{{ .Content }}
</response>
{{- if $last }}
{{- $inTool = false -}}
[e~[
{{- end }}
{{- end }}
{{- if and (ne .Role "assistant") $last }}
]~b]ai
<think>
{{ end }}
{{- end -}}