54 1 month ago

DeepSeek-R1 is a family of open reasoning models with performance approaching that of leading models, such as O3 and Gemini 2.5 Pro.

tools thinking
964cb427e883 · 1.3kB
{{- if .Messages }}
{{- if .System }}{{ .System }}{{ end }}
{{- if .Tools }}
# Tools
You may call one or more functions to assist with the user query.
You are provided with function signatures within <tools></tools> XML tags:
<tools>
{{- range .Tools }}
{"type": "function", "function": {{ .Function }}}
{{- end }}
</tools>
For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>
{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1}}
{{- if eq .Role "user" }}REDACTED_SPECIAL_TOKEN{{ .Content }}
{{- else if eq .Role "assistant" }}REDACTED_SPECIAL_TOKEN
{{- if .Thinking }}
<think>
{{ .Thinking }}
</think>
{{ end }}
{{ if .Content }}{{ .Content }}
{{- else if .ToolCalls }}
<tool_call>
{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
{{ end }}
</tool_call>
{{- end }}{{ if not $last }}REDACTED_SPECIAL_TOKEN{{- end }}
{{- else if eq .Role "tool" }}REDACTED_SPECIAL_TOKEN
Tool response: {{ .Content }}
{{ end }}
{{- if and (ne .Role "assistant") $last }}REDACTED_SPECIAL_TOKEN
{{ end }}
{{- end }}
{{- end }}