danielhanchen commited on
Commit
8e2d13d
·
verified ·
1 Parent(s): fe0ff4b

Create template

Browse files
Files changed (1) hide show
  1. template +52 -0
template ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ {{- if .System }}{{ .System }}{{ end }}
3
+ {{- if .Tools }}
4
+
5
+ ## Tools
6
+
7
+ ### Function
8
+
9
+ You have the following functions available:
10
+
11
+ {{- range .Tools }}
12
+ - {{ .Function.Name }}
13
+ ```json
14
+ {{ .Function }}
15
+ ```
16
+ {{- end }}
17
+
18
+ For function call returns, you should first print <|tool▁calls▁begin|>
19
+
20
+ For each function call, you must return:
21
+
22
+ <|tool▁call▁begin|>function<|tool▁sep|><function_name>\n```json\n<function_arguments_in_json_format>\n```<|tool▁call▁end|>
23
+
24
+ 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.
25
+
26
+ At the end of function call returns, you should print <|tool▁calls▁end|>.
27
+
28
+ {{ end }}
29
+ {{- range $i, $_ := .Messages }}
30
+ {{- $last := eq (len (slice $.Messages $i)) 1}}
31
+ {{- if eq .Role "user" }}<|User|>{{ .Content }}
32
+ {{- else if eq .Role "tool" }}<|User|><|tool▁outputs▁begin|><|tool▁output▁begin|>{{ .Content }}<|tool▁output▁end|><|tool▁outputs▁end|>
33
+ {{- else if eq .Role "assistant" }}<|Assistant|>
34
+ {{- if and $.IsThinkSet (and $last .Thinking) -}}
35
+ <think>
36
+ {{ .Thinking }}
37
+ </think>
38
+ {{- end }}
39
+ {{- if .ToolCalls }}<|tool▁calls▁begin|>
40
+ {{- range .ToolCalls }}<|tool▁call▁begin|>function<|tool▁sep|>{{ .Function.Name }}
41
+ ```json
42
+ {{ .Function.Arguments }}
43
+ ```<|tool▁call▁end|>{{ end }}<|tool▁calls▁end|>
44
+ {{- else if .Content }}{{ .Content }}{{- end }}
45
+ {{- if not $last }}<|end▁of▁sentence|>{{ end }}
46
+ {{- end }}
47
+ {{- if and $last (ne .Role "assistant") }}<|Assistant|>
48
+ {{- if and $.IsThinkSet (not $.Think) -}}
49
+ </think>
50
+ {{ end }}
51
+ {{- end }}
52
+ {{- end }}