Models
Docs
Pricing
Sign in
Download
Models
Download
Docs
Pricing
Sign in
mua
/
ERNIE-4.5-21B-A3B-Thinking-UD-Q2_K_XL
:latest
98
Downloads
Updated
7 months ago
ERNIE-4.5-21B Thinking Model - Ollama
ERNIE-4.5-21B Thinking Model - Ollama
Cancel
tools
ERNIE-4.5-21B-A3B-Thinking-UD-Q2_K_XL:latest
...
/
template
36ec615cb730 · 1.8kB
{{- /* 采用 Qwen 风格的工具调用(XML 标签) */ -}}
<|im_start|>system
{{- if .System }}
{{ .System }}
{{- end }}
{{- if .Tools }}
# 工具
当需要辅助回答用户问题时,你可以调用一个或多个函数。
工具定义在 <tools></tools> XML 标签内:
<tools>
{{- range .Tools }}
{"type": "function", "function": {{ json .Function }}}
{{- end }}
</tools>
对于每个函数调用,在 <tool_call></tool_call> XML 标签内返回 json 对象(包含函数名和参数):
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>
示例1(调用工具):
用户: "北京天气怎么样?"
助手: <|im_start|>assistant
<think>用户询问北京天气,需要调用get_weather工具获取天气信息,参数city为"北京"</think>
<tool_call>
{"name": "get_weather", "arguments": {"city": "北京"}}
</tool_call><|im_end|>
示例2(最终回复):
用户: "你好"
助手: <|im_start|>assistant
<think>用户打招呼,直接友好回应即可,不需要调用工具</think>
你好!我是纬视智能助手,很高兴为您服务。<|im_end|>
{{- end }}
<|im_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 .Content }}<think>{{ .Content }}</think>
{{ end }}{{ if .ToolCalls }}<tool_call>
{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ json .Function.Arguments }}}
{{ end }}</tool_call>
{{- end }}{{ if not $last }}<|im_end|>
{{ 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 }}