teknium commited on
Commit
6c26d2d
·
verified ·
1 Parent(s): 54487fb

Update chat_template.jinja

Browse files
Files changed (1) hide show
  1. chat_template.jinja +21 -6
chat_template.jinja CHANGED
@@ -1,6 +1,7 @@
1
  {%- set thinking_prompt = 'You are a deep thinking AI, you may use extremely long chains of thought to deeply consider the problem and deliberate with yourself via systematic reasoning processes to help come to a correct solution prior to answering. You should enclose your thoughts and internal monologue inside <think> </think> tags, and then provide your solution or response to the problem.' %}
2
  {%- set standard_prompt = 'You are Hermes, created by Nous Research.' %}
3
  {%- if not thinking is defined %}{% set thinking = false %}{% endif %}
 
4
  {%- if thinking %}{%- set system_prompt = thinking_prompt %}{%- else %}{%- set system_prompt = standard_prompt %}{%- endif %}
5
  {%- if tools %}
6
  {{- bos_token + '<|start_header_id|>system<|end_header_id|>\n' }}
@@ -23,12 +24,29 @@
23
  {%- endif %}
24
  {%- endif %}
25
  {%- for message in messages %}
26
- {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
27
  {{- '<|start_header_id|>' + message.role + '<|end_header_id|>\n\n' + message.content + '<|eot_id|>' }}
 
 
 
 
 
 
 
 
 
 
 
28
  {%- elif message.role == "assistant" %}
29
  {{- '<|start_header_id|>' + message.role + '<|end_header_id|>\n' }}
30
  {%- if message.content %}
31
- {{- '\n' + message.content }}
 
 
 
 
 
 
32
  {%- endif %}
33
  {%- for tool_call in message.tool_calls %}
34
  {%- if tool_call.function is defined %}
@@ -55,7 +73,4 @@
55
  {%- endfor %}
56
  {%- if add_generation_prompt %}
57
  {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
58
- {%- if thinking %}
59
- {{- '<think>' }}
60
- {%- endif %}
61
- {%- endif %}
 
1
  {%- set thinking_prompt = 'You are a deep thinking AI, you may use extremely long chains of thought to deeply consider the problem and deliberate with yourself via systematic reasoning processes to help come to a correct solution prior to answering. You should enclose your thoughts and internal monologue inside <think> </think> tags, and then provide your solution or response to the problem.' %}
2
  {%- set standard_prompt = 'You are Hermes, created by Nous Research.' %}
3
  {%- if not thinking is defined %}{% set thinking = false %}{% endif %}
4
+ {%- if not keep_cots is defined %}{% set keep_cots = false %}{% endif %}
5
  {%- if thinking %}{%- set system_prompt = thinking_prompt %}{%- else %}{%- set system_prompt = standard_prompt %}{%- endif %}
6
  {%- if tools %}
7
  {{- bos_token + '<|start_header_id|>system<|end_header_id|>\n' }}
 
24
  {%- endif %}
25
  {%- endif %}
26
  {%- for message in messages %}
27
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
28
  {{- '<|start_header_id|>' + message.role + '<|end_header_id|>\n\n' + message.content + '<|eot_id|>' }}
29
+ {%- elif (message.role == "assistant" and not message.tool_calls) %}
30
+ {{- '<|start_header_id|>' + message.role + '<|end_header_id|>\n' }}
31
+ {%- if message.content %}
32
+ {%- set content = message['content'] -%}
33
+ {%- if thinking %}
34
+ {%- if not keep_cots %}
35
+ {%- set content = '<think> </think>' + content.split('</think>', 1)[1] -%}
36
+ {%- endif %}
37
+ {%- endif %}
38
+ {{- '\n' + content + '<|eot_id|>' }}
39
+ {%- endif %}
40
  {%- elif message.role == "assistant" %}
41
  {{- '<|start_header_id|>' + message.role + '<|end_header_id|>\n' }}
42
  {%- if message.content %}
43
+ {%- set content = message['content'] -%}
44
+ {%- if thinking %}
45
+ {%- if not keep_cots %}
46
+ {%- set content = '<think> </think>' + content.split('</think>', 1)[1] -%}
47
+ {%- endif %}
48
+ {%- endif %}
49
+ {{- '\n' + content }}
50
  {%- endif %}
51
  {%- for tool_call in message.tool_calls %}
52
  {%- if tool_call.function is defined %}
 
73
  {%- endfor %}
74
  {%- if add_generation_prompt %}
75
  {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
76
+ {%- endif %}