AlexTrinityBlock commited on
Commit
2c89682
·
verified ·
1 Parent(s): a41f468

Upload template

Browse files
Files changed (1) hide show
  1. template +44 -0
template ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{ if .Messages }}
2
+ {{- if or .System .Tools }}<|im_start|>system
3
+ {{ .System }}
4
+ {{- if .Tools }}
5
+
6
+ # Tools
7
+
8
+ You are provided with function signatures within <tools></tools> XML tags:
9
+ <tools>{{- range .Tools }}
10
+ {"type": "function", "function": {{ .Function }}}{{- end }}
11
+ </tools>
12
+
13
+ For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
14
+ <tool_call>
15
+ {"name": <function-name>, "arguments": <args-json-object>}
16
+ </tool_call>
17
+ {{- end }}<|im_end|>
18
+ {{ end }}
19
+ {{- range $i, $_ := .Messages }}
20
+ {{- $last := eq (len (slice $.Messages $i)) 1 -}}
21
+ {{- if eq .Role "user" }}<|im_start|>user
22
+ {{ .Content }}<|im_end|>
23
+ {{ else if eq .Role "assistant" }}<|im_start|>assistant
24
+ {{ if .Content }}{{ .Content }}
25
+ {{- else if .ToolCalls }}<tool_call>
26
+ {{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
27
+ {{ end }}</tool_call>
28
+ {{- end }}{{ if not $last }}<|im_end|>
29
+ {{ end }}
30
+ {{- else if eq .Role "tool" }}<|im_start|>user
31
+ <tool_response>
32
+ {{ .Content }}
33
+ </tool_response><|im_end|>
34
+ {{ end }}
35
+ {{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
36
+ {{ end }}
37
+ {{- end }}
38
+ {{- else }}
39
+ {{- if .System }}<|im_start|>system
40
+ {{ .System }}<|im_end|>
41
+ {{ end }}{{ if .Prompt }}<|im_start|>user
42
+ {{ .Prompt }}<|im_end|>
43
+ {{ end }}<|im_start|>Alice
44
+ {{ end }}{{ .Response }}{{ if .Response }}<|im_end|>{{ end }}