frob/ mimo-v2.5:310b-a15b-q4_K_M

77 1 week ago

tools thinking
0033b1da0e18 · 2.6kB
<|im_start|>system
{{- if .System }}
{{ .System }}
{{- else }}
You are MiMo, a helpful AI assistant engineered by Xiaomi.
Today's date: {{ currentDate }}. Your knowledge cutoff date is December 2024.
{{- end }}
{{- if .Tools }}
# Tools
You may call one or more functions to assist with the user query.
You have access to the following functions:
<tools>
{{- range .Tools }}
<function>
<name>{{ .Function.Name }}</name>
{{- if .Function.Description }}
<description>{{ .Function.Description }}</description>
{{- end }}
<parameters>
{{- range $name, $prop := .Function.Parameters.Properties }}
<parameter>
<name>{{ $name }}</name>
{{- if $prop.Type }}
<type>{{ $prop.Type }}</type>
{{- end }}
{{- if $prop.Description }}
<description>{{ $prop.Description }}</description>
{{- end }}
</parameter>
{{- end }}
{{- if .Function.Parameters.Required }}
<required>{{ .Function.Parameters.Required | json }}</required>
{{- end }}
</parameters>
</function>
{{- end }}
</tools>
For each function call, output the function name and arguments in the following format:
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>
<IMPORTANT>
- Function calls MUST follow the specified format: an inner JSON block must be nested within <tool_call></tool_call> XML tags
- DO NOT use function calls inside <think></think> tags.
- The value enclosed between parameter tags is preserved exactly as-is, including newlines and spaces.
</IMPORTANT>
{{- end -}}
<|im_end|>
{{- $lastUserIdx := -1 -}}
{{- $persistReasoning := false -}}
{{- range $idx, $_ := .Messages -}}
{{- if eq .Role "user" }}{{ $lastUserIdx = $idx }}{{ end }}
{{- end -}}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- if eq .Role "user" -}}
{{- $persistReasoning := false -}}
<|im_start|>{{ .Role }}
{{ .Content -}}
<|im_end|>
{{- end }}
{{- if eq .Role "assistant" -}}
<|im_start|>{{ .Role }}
{{- if and $.IsThinkSet $.Think .Thinking (or $last (gt $i $lastUserIdx) .ToolCalls $persistReasoning) }}
<think>
{{- .Thinking -}}
</think>
{{- else }}
<think></think>
{{- end -}}
{{ .Content }}
{{- if .ToolCalls -}}
<tool_call>
{{- range .ToolCalls }}
{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
{{- end }}
</tool_call>
{{- $persistReasoning := true -}}
{{- end -}}
{{- if not $last }}<|im_end|>{{ end }}
{{- end }}
{{- if eq .Role "tool" -}}
<|im_start|>{{ .Role }}
<tool_response>
{{ .Content }}
</tool_response>
<|im_end|>
{{- end }}
{{- if and (ne .Role "assistant") $last -}}
<|im_start|>assistant
{{- if and $.IsThinkSet (not $.Think) }}
<think></think>
{{- end }}
{{- end }}
{{- end }}