Brainstorm 40x by DavidAU available in [F16, q8_0, q6_K, q4_K_S]
55 Pulls Updated 6 weeks ago
5414df66dd62 · 1.4kB
{{- if .System }}{{ .System }}{{- end -}}
{{- range $index, $msg := .Messages -}}
{{- if eq $msg.Role "user" -}}
<|User|>{{ $msg.Content }}
{{- end -}}
{{- if and (eq $msg.Role "assistant") (not $msg.Content) -}}
{{- range $tool := $msg.ToolCalls -}}
{{- if eq $index 0 -}}
<|Assistant|><|tool_calls_begin|><|tool_call_begin|>{{ $tool.Type }}<|tool_sep|>{{ $tool.Function.Name }}
```json
{{ json $tool.Function.Arguments }}
```
<|tool_call_end|>
{{- else -}}
\n<|tool_call_begin|>{{ $tool.Type }}<|tool_sep|>{{ $tool.Function.Name }}
```json
{{ json $tool.Function.Arguments }}
```
<|tool_call_end|><|tool_calls_end|><|end_of_sentence|>
{{- end -}}
{{- end -}}
{{- end -}}
{{- if and (eq $msg.Role "assistant") $msg.Content -}}
{{- if eq $index 0 -}}
<|Assistant|>{{ $msg.Content }}<|end_of_sentence|>
{{- else -}}
<|tool_outputs_end|>{{ $msg.Content }}<|end_of_sentence|>
{{- end -}}
{{- end -}}
{{- if eq $msg.Role "tool" -}}
{{- if eq $index 0 -}}
<|tool_outputs_begin|><|tool_output_begin|>{{ $msg.Content }}<|tool_output_end|>
{{- else -}}
\n<|tool_output_begin|>{{ $msg.Content }}<|tool_output_end|>
{{- end -}}
{{- end -}}
{{- end -}}
{{- if .Prompt -}}
<|Assistant|>
{{- end -}}