32 1 year ago

Qwen2.5 14b with a simplified template for chat and manual tool handling

13aed2e713a3 · 455B
{{- range $i, $msg := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- if eq $msg.Role "user" }}<|im_start|>user
{{ $msg.Content }}<|im_end|>
{{- else if eq $msg.Role "assistant" }}<|im_start|>assistant
{{ $msg.Content }}<|im_end|>
{{- else if eq $msg.Role "system" }}<|im_start|>system
{{ $msg.Content }}<|im_end|>
{{- end }}
{{- if and (ne $msg.Role "assistant") $last }}<|im_start|>assistant
{{- end }}
{{- end }}