liponex/ deepseek-r1:8b-llama-distill-q4_K_M

44 10 months ago

tools thinking
b509c5ba6725 · 2.1kB
{{- if .System -}}
{{- .System -}}
{{- end -}}
{{- if .Tools }}
## Tools
### Function
You have the following functions available:
{{- range .Tools }}
- {{ .Function.Name }}
{{ .Function }}
{{- end }}
For each function call, you must return:
<|tool▁call▁begin|><function_name><|tool▁sep|>\n<function_arguments_in_json_format>\n<|tool▁call▁end|>
Make sure to not place json schema of selected functions, but only json with arguments, for e.g.: ```text
<|tool▁call▁begin|>meta_search<|tool▁sep|>
{
"query": "How many stars in the sky?",
"page": 1
}
<|tool▁call▁end|>
```
Do not forget the function name or arguments. If more than one function call is required, return them in the same response instead of separately.
{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- if eq .Role "system" }}<|System|>{{ .Content }}{{"\n"}}
{{- else if eq .Role "user" }}<|User|>{{ .Content }}{{"\n"}}
{{- else if eq .Role "tool" -}}
<|User|><|tool▁outputs▁begin|><|tool▁output▁begin|>
{{- .Content -}}
<|tool▁output▁end|><|tool▁outputs▁end|>{{"\n"}}
{{- else if eq .Role "assistant" }}<|Assistant|>
{{- if and $.IsThinkSet (and $last .Thinking) -}}
<think>
{{- .Thinking -}}
</think>
{{- end }}
{{- if .ToolCalls -}}{{- range .ToolCalls -}}
<|tool▁call▁begin|>
{"name": "{{ .Function.Name }}", "arguments": "{{ .Function.Arguments }}"}{{"\n" -}}
<|tool▁call▁end|>{{"\n"}}
{{- end -}}{{- end }}
{{- if .Content }}{{ .Content }}{{ end }}
{{- end }}
{{- if not $last }}{{"\n"}}<|end▁of▁sentence|>{{"\n"}}{{ end }}
{{- if and $last (ne .Role "assistant") }}<|Assistant|>
{{- if and $.IsThinkSet (not $.Think) -}}
<think></think>{{"\n"}}
{{- end }}
{{- end }}
{{- end -}}