yesterday

tools thinking
c04a13c684d5 · 845B
{{ if .System }}<|im_start|>system
{{ .System }}<|im_end|>
{{ end }}{{ if .Tools }}<|im_start|>system
Tools: [{{ range $j, $t := .Tools }}{{ if $j }}, {{ end }}{{ json $t }}{{ end }}]
To call a tool, output: <tool_call>{"name": "fn", "arguments": {}}</tool_call>
<|im_end|>
{{ end }}{{ range $i, $_ := .Messages }}{{ $last := eq (len (slice $.Messages $i)) 1 }}{{ if eq .Role "user" }}<|im_start|>user
{{ .Content }}<|im_end|>
{{ else if eq .Role "assistant" }}<|im_start|>assistant
{{ if .Thinking }}<think>
{{ .Thinking }}
</think>
{{ end }}{{ if .ToolCalls }}<tool_call>
{{ range .ToolCalls }}{{ json .Function }}
{{ end }}</tool_call>
{{ else }}{{ .Content }}
{{ end }}<|im_end|>
{{ else if eq .Role "tool" }}<|im_start|>tool
{{ .Content }}<|im_end|>
{{ end }}{{ if and $last (ne .Role "assistant") }}<|im_start|>assistant
{{ end }}{{ end }}