Qwen2.5-Coder is the latest series of Code-Specific Qwen large language models available in [F16, q8_0, q6_K, q4_K_S]
tools
567 Pulls Updated 8 weeks ago
40a31ca1af2a · 2.5kB
{{- /* Handle system message and tools */}}
{{- if .Tools}}
<|im_start|>system
{{- if and (gt (len .Messages) 0) (eq (index .Messages 0).Role "system")}}
{{- (index .Messages 0).Content -}}
{{- else}}
You are a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
{{- 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}}
{{- if and (gt (len .Messages) 0) (eq (index .Messages 0).Role "system")}}
<|im_start|>system
{{- (index .Messages 0).Content}}<|im_end|>
{{- else}}
<|im_start|>system
You are a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.<|im_end|>
{{- end}}
{{- end}}
{{- /* Process messages */}}
{{- range $index, $message := .Messages}}
{{- /* Skip first system message if tools are present */}}
{{- if and $.Tools (eq $index 0) (eq $message.Role "system")}}{{else}}
{{- if or (eq $message.Role "user") (eq $message.Role "system")}}
<|im_start|>{{$message.Role}}
{{$message.Content}}<|im_end|>
{{- else if and (eq $message.Role "assistant") $message.ToolCalls}}
<|im_start|>assistant
{{- if $message.Content}}{{$message.Content}}{{- end}}
{{- range $toolCall := $message.ToolCalls}}
<tool_call>
{"name": "{{$toolCall.Function.Name}}", "arguments": {{$toolCall.Function.Arguments | json}}}
</tool_call>
{{- end}}<|im_end|>
{{- else if eq $message.Role "assistant"}}
<|im_start|>assistant
{{$message.Content}}<|im_end|>
{{- else if eq $message.Role "tool"}}
{{- /* Simplified tool response grouping */}}
<|im_start|>user
<tool_response>
{{$message.Content}}
</tool_response>
<|im_end|>
{{- end}}
{{- end}}
{{- end}}
{{- /* Add generation prompt */}}
<|im_start|>assistant