2024-07-15 19:17:38 +00:00
|
|
|
{{- range $index, $_ := .Messages }}
|
|
|
|
{{- if eq .Role "user" }}
|
2024-07-17 22:35:11 +00:00
|
|
|
{{- if and (eq (len (slice $.Messages $index)) 1) $.Tools }}[AVAILABLE_TOOLS] {{ $.Tools }}[/AVAILABLE_TOOLS]
|
2024-07-15 19:17:38 +00:00
|
|
|
{{- end }}[INST] {{ if and (eq (len (slice $.Messages $index)) 1) $.System }}{{ $.System }}
|
|
|
|
|
|
|
|
{{ end }}{{ .Content }}[/INST]
|
|
|
|
{{- else if eq .Role "assistant" }}
|
|
|
|
{{- if .Content }} {{ .Content }}</s>
|
|
|
|
{{- else if .ToolCalls }}[TOOL_CALLS] [
|
2024-07-17 22:35:11 +00:00
|
|
|
{{- range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
|
2024-07-15 19:17:38 +00:00
|
|
|
{{- end }}]</s>
|
|
|
|
{{- end }}
|
|
|
|
{{- else if eq .Role "tool" }}[TOOL_RESULTS] {"content": {{ .Content }}}[/TOOL_RESULTS]
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|