mistral.gotmpl 643 B

123456789101112131415
  1. {{- range $index, $_ := .Messages }}
  2. {{- if eq .Role "user" }}
  3. {{- if and (eq (len (slice $.Messages $index)) 1) $.Tools }}[AVAILABLE_TOOLS] {{ $.Tools }}[/AVAILABLE_TOOLS]
  4. {{- end }}[INST] {{ if and (eq (len (slice $.Messages $index)) 1) $.System }}{{ $.System }}
  5. {{ end }}{{ .Content }}[/INST]
  6. {{- else if eq .Role "assistant" }}
  7. {{- if .Content }} {{ .Content }}</s>
  8. {{- else if .ToolCalls }}[TOOL_CALLS] [
  9. {{- range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
  10. {{- end }}]</s>
  11. {{- end }}
  12. {{- else if eq .Role "tool" }}[TOOL_RESULTS] {"content": {{ .Content }}}[/TOOL_RESULTS]
  13. {{- end }}
  14. {{- end }}