Qwen2.5-32B-Instruct finetune surpassing R1-Distill from Scratch
tools
52 Pulls Updated 5 weeks ago
868aadf97f65 · 1.7kB
{{- if gt (len .Tools) 0 -}}
<|im_start|>system
{{- with index .Messages 0 -}}
{{- if eq .Role "system" -}}
{{ .Content }}
{{- else -}}
Be Helpful in the most Efficient way possible.
{{- end -}}
{{- end -}}
# 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 -}}
{{ . | json }}
{{- 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><|im_end>
{{- else -}}
{{- with index .Messages 0 -}}
{{- if eq .Role "system" -}}
<|im_start|>system
{{ .Content }}<|im_end>
{{- else -}}
<|im_start|>system
You are a helpful assistant.<|im_end>
{{- end -}}
{{- end -}}
{{- end -}}
{{- range $i, $msg := .Messages -}}
{{- if or (eq $msg.Role "user") (and (eq $msg.Role "system") (gt $i 0)) (and (eq $msg.Role "assistant") (not $msg.ToolCalls)) -}}
<|im_start|>{{ $msg.Role }}
{{ $msg.Content }}<|im_end>
{{- end -}}
{{- if eq $msg.Role "assistant" -}}
{{- if $msg.ToolCalls -}}
<|im_start|>assistant
{{- if $msg.Content -}}
{{ $msg.Content }}
{{- end -}}
{{- range $toolCall := $msg.ToolCalls -}}
<tool_call>
{"name": "{{ $toolCall.Function.Name }}", "arguments": {{ $toolCall.Function.Arguments | json }}}
</tool_call>
{{- end -}}
<|im_end>
{{- end -}}
{{- end -}}
{{- if eq $msg.Role "tool" -}}
<|im_start|>user
<tool_response>
{{ $msg.Content }}
</tool_response>
<|im_end>
{{- end -}}
{{- end -}}
{{- if true -}}
<|im_start|>assistant
<think>
{{- end -}}