9 3 days ago

tools thinking
10f648c19d4e · 362B
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- if eq .Role "system" }}<|turn>system
{{ .Content }}<turn|>
{{ else if eq .Role "user" }}<|turn>user
{{ .Content }}<turn|>
{{ else if eq .Role "assistant" }}<|turn>model
{{ .Content }}<turn|>
{{ end }}
{{- if and $last (ne .Role "assistant") }}<|turn>model
{{ end }}
{{- end }}