[gMASK]<sop>
{{ if .System }}<|system|>
{{ .System }}{{ end }}
{{ if .Tools }}
# Available tools
{{ range .Tools }}
## {{ .Function.Name }}
{{ .Function }}
{{ end }}
When using the above functions you MUST use JSON format.
{{ end }}
{{ range .Messages }}
{{ if eq .Role "system" }}
<|system|>
{{ .Content }}
{{ end }}
{{ if eq .Role "user" }}
<|user|>
{{ .Content }}
{{ end }}
{{ if eq .Role "assistant" }}
<|assistant|>
{{ .Content }}
{{ end }}
{{ if eq .Role "tool" }}
<|tool|>
{{ .Content }}
{{ end }}
{{ end }}
{{ if .ToolCalls }}
<|assistant|><|tool_calls_begin|>
{{ range .ToolCalls }}
<|tool_call_begin|>{{ .Function.Name }}<|tool_call_sep|>
{
"parameters": {
{{ range $key, $value := .Function.Arguments }}
"{{ $key }}": "{{ $value }}"{% if not @last %}, {% endif %}
{{ end }}
}
}
<|tool_call_end|>{{ end }}
<|tool_calls_end|>
{{ end }}
{{ if .AddGenerationPrompt }}<|assistant|>{{ end }}