1 1 week ago

tools thinking
... /
template
722bdb561308 · 967B
### System{{- if .System }}
{{ .System }}{{- else }}
You are RWKV, a helpful multilingual assistant.{{- end }}{{- if .Tools }}
You have access to these tools:
{{ json .Tools }}
To use a tool, output: <tool_call>{"name": "function_name", "arguments": {"param": "value"}}</tool_call>
{{- 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 }}
{{- end }}
{{- if .ToolCalls }}
<tool_call>
{{- range .ToolCalls }}
{{- json .Function }}
{{- end }}
</tool_call>
{{- else }}
{{ .Content }}
{{- end }}
{{- else if eq .Role "tool" }}
### Tool Result
{{ .Content }}
{{- end }}
{{- if and $last (ne .Role "assistant") }}
### Assistant
{{- if $.IsThinkSet }}
{{- if not $.Think }}
{{- end }}{{- end }}{{- end }}{{- end }}