llama2-chat.gotmpl 394 B

12345678910111213141516
  1. {{- if .Messages }}
  2. {{- range $index, $_ := .Messages }}
  3. {{- if eq .Role "user" }}[INST] {{ if eq $index 0 }}<<SYS>>
  4. {{- if $.System }}
  5. {{ $.System }}
  6. {{ end }}<</SYS>>
  7. {{ end }}{{ .Content }}
  8. {{- else }} [/INST] {{ .Content }}</s><s>
  9. {{- end }}
  10. {{- end }} [/INST]
  11. {{- else -}}
  12. [INST] <<SYS>>{{ if .System }}{{ .System }}{{ end }}<</SYS>>
  13. {{ .Prompt }} [/INST] {{ .Response }}</s>
  14. {{- end -}}