490 1 month ago

A lightweight Ollama build of MiniCPM5-2B, the 2B-class open-source SOTA model from OpenBMB

tools thinking
6add1d438814 ยท 1.7kB
{{- if .Messages }}
{{- if or .System .Tools }}<|im_start|>system
{{ .System }}
{{- 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 }}
{{ . }}
{{- end }}
</tools>
Tool usage guidelines:
- You may call zero or more functions. If no function calls are needed, just answer normally and do not include any <function ... </function>.
- When calling a function, return an XML object within <function ... </function> using:
<function name="function-name"><param name="param-name">param-value</param></function>
- param-value may be multi-line. If it contains <, & or newline characters, wrap it in a CDATA block: <param name="param-name"><![CDATA[...multi-line value...]]></param>
{{- end }}<|im_end|>
{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if eq .Role "user" }}<|im_start|>user
{{ .Content }}<|im_end|>
{{- else if eq .Role "assistant" }}<|im_start|>assistant
{{- if .Thinking }}
<think>
{{ .Thinking }}
</think>
{{- end }}
{{ .Content }}
{{- if .ToolCalls }}
{{- range .ToolCalls }}
<function name="{{ .Function.Name }}">
{{- range $k, $v := .Function.Arguments }}
<param name="{{ $k }}">{{ $v }}</param>
{{- end }}
</function>
{{- end }}
{{- end }}<|im_end|>
{{- else if eq .Role "tool" }}<|im_start|>user
<tool_response>
{{ .Content }}
</tool_response><|im_end|>
{{- end }}
{{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
{{ end }}
{{- end }}
{{- else }}
{{- if .System }}<|im_start|>system
{{ .System }}<|im_end|>
{{- end }}<|im_start|>user
{{ .Prompt }}<|im_end|>
<|im_start|>assistant
{{ .Response }}
{{- end }}