NaolBM commited on
Commit
1e2ca0d
·
verified ·
1 Parent(s): 3d1b678

Update chat_template.jinja

Browse files
Files changed (1) hide show
  1. chat_template.jinja +5 -11
chat_template.jinja CHANGED
@@ -6,8 +6,7 @@
6
  {%- set messages = messages[1:] -%}
7
  {%- endif -%}
8
  {%- if tools -%}
9
- {%- set ns.system_prompt = ns.system_prompt + ("
10
- " if ns.system_prompt else "") + "List of tools: [" -%}
11
  {%- for tool in tools -%}
12
  {%- if tool is not string -%}
13
  {%- set tool = tool | tojson -%}
@@ -20,9 +19,7 @@
20
  {%- set ns.system_prompt = ns.system_prompt + "]" -%}
21
  {%- endif -%}
22
  {%- if ns.system_prompt -%}
23
- {{- "<|im_start|>system
24
- " + ns.system_prompt + "<|im_end|>
25
- " -}}
26
  {%- endif -%}
27
  {%- set ns.last_assistant_index = -1 -%}
28
  {%- for message in messages -%}
@@ -31,8 +28,7 @@
31
  {%- endif -%}
32
  {%- endfor -%}
33
  {%- for message in messages -%}
34
- {{- "<|im_start|>" + message["role"] + "
35
- " -}}
36
  {%- set content = message["content"] -%}
37
  {%- if content is not string -%}
38
  {%- set content = content | tojson -%}
@@ -42,10 +38,8 @@
42
  {%- set content = content.split("</think>")[-1] | trim -%}
43
  {%- endif -%}
44
  {%- endif -%}
45
- {{- content + "<|im_end|>
46
- " -}}
47
  {%- endfor -%}
48
  {%- if add_generation_prompt -%}
49
- {{- "<|im_start|>assistant
50
- " -}}
51
  {%- endif -%}
 
6
  {%- set messages = messages[1:] -%}
7
  {%- endif -%}
8
  {%- if tools -%}
9
+ {%- set ns.system_prompt = ns.system_prompt + ("\n" if ns.system_prompt else "") + "List of tools: [" -%}
 
10
  {%- for tool in tools -%}
11
  {%- if tool is not string -%}
12
  {%- set tool = tool | tojson -%}
 
19
  {%- set ns.system_prompt = ns.system_prompt + "]" -%}
20
  {%- endif -%}
21
  {%- if ns.system_prompt -%}
22
+ {{- "<|im_start|>system\n" + ns.system_prompt + "<|im_end|>\n" -}}
 
 
23
  {%- endif -%}
24
  {%- set ns.last_assistant_index = -1 -%}
25
  {%- for message in messages -%}
 
28
  {%- endif -%}
29
  {%- endfor -%}
30
  {%- for message in messages -%}
31
+ {{- "<|im_start|>" + message["role"] + "\n" -}}
 
32
  {%- set content = message["content"] -%}
33
  {%- if content is not string -%}
34
  {%- set content = content | tojson -%}
 
38
  {%- set content = content.split("</think>")[-1] | trim -%}
39
  {%- endif -%}
40
  {%- endif -%}
41
+ {{- content + "<|im_end|>\n" -}}
 
42
  {%- endfor -%}
43
  {%- if add_generation_prompt -%}
44
+ {{- "<|im_start|>assistant\n" -}}
 
45
  {%- endif -%}