File size: 1,671 Bytes
8e2d13d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

{{- if .System }}{{ .System }}{{ end }}
{{- if .Tools }}

## Tools

### Function

You have the following functions available:

{{- range .Tools }}
- {{ .Function.Name }}
```json
{{ .Function }}
```
{{- end }}

For function call returns, you should first print <|tool▁calls▁begin|>

For each function call, you must return:

<|tool▁call▁begin|>function<|tool▁sep|><function_name>\n```json\n<function_arguments_in_json_format>\n```<|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.

At the end of function call returns, you should print <|tool▁calls▁end|>.

{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1}}
{{- if eq .Role "user" }}<|User|>{{ .Content }}
{{- else if eq .Role "tool" }}<|User|><|tool▁outputs▁begin|><|tool▁output▁begin|>{{ .Content }}<|tool▁output▁end|><|tool▁outputs▁end|>
{{- else if eq .Role "assistant" }}<|Assistant|>
{{- if and $.IsThinkSet (and $last .Thinking) -}}
<think>
{{ .Thinking }}
</think>
{{- end }}
{{- if .ToolCalls }}<|tool▁calls▁begin|>
{{- range .ToolCalls }}<|tool▁call▁begin|>function<|tool▁sep|>{{ .Function.Name }}
```json
{{ .Function.Arguments }}
```<|tool▁call▁end|>{{ end }}<|tool▁calls▁end|>
{{- else if .Content }}{{ .Content }}{{- end }}
{{- if not $last }}<|end▁of▁sentence|>{{ end }}
{{- end }}
{{- if and $last (ne .Role "assistant") }}<|Assistant|>
{{- if and $.IsThinkSet (not $.Think) -}}
</think>
{{ end }}
{{- end }}
{{- end }}