10 yesterday

tools thinking
4c6178853e58 · 1.1kB
### System{{- if .System }}
{{ .System }}{{- else }}
You are RWKV, a helpful assistant.{{- end }}{{- if .Tools }}
You have access to the following tools:
<tools>
{{ json .Tools }}
</tools>
to use the tools, please output the call in JSON format, surrounded by <tool_call></tool_call> xml blocks
{{- end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1}}
{{- if eq .Role "user" }}
{{- if eq $i 0}}### User
{{ .Content }}
{{- else }}
### User
{{ .Content }}
{{- end }}
{{- else if eq .Role "assistant" }}
### Assistant
<{{- if and $last .Thinking -}}think>{{ .Thinking }}</think>{{- else }}think>
</think>{{- end }}
{{- if .ToolCalls }}
<tool_call>
{{- range .ToolCalls }}
{{- json .Function }}
{{- end }}
</tool_call>
{{- else }}
{{ .Content }}
{{- end }}
{{- else if eq .Role "tool" }}
### Tool Output
<tool_response>
{{ .Content }}
</tool_response>
{{- end }}
{{- if and $last (ne .Role "assistant") }}
### Assistant
{{- if $.IsThinkSet }}<think>{{- if not $.Think }}
</think>
{{- end }}{{- end }}{{- end }}{{- end }}