sd-inf commited on
Commit
2f19ca6
·
verified ·
1 Parent(s): 524a664

Update chat_template.jinja

Browse files
Files changed (1) hide show
  1. chat_template.jinja +10 -6
chat_template.jinja CHANGED
@@ -1,7 +1,9 @@
1
  {%- if tools %}
2
  {{- '<|im_start|>system\n' }}
3
- {%- if messages[0].role == 'system' %}
4
  {{- messages[0].content + '\n\n' }}
 
 
5
  {%- endif %}
6
  {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
  {%- for tool in tools %}
@@ -10,8 +12,10 @@
10
  {%- endfor %}
11
  {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
  {%- else %}
13
- {%- if messages[0].role == 'system' %}
14
  {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
 
 
15
  {%- endif %}
16
  {%- endif %}
17
  {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
@@ -36,13 +40,13 @@
36
  {%- set reasoning_content = message.reasoning_content %}
37
  {%- else %}
38
  {%- if '</think>' in content %}
39
- {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
40
- {%- set content = content.split('</think>')[-1].lstrip('\n') %}
41
  {%- endif %}
42
  {%- endif %}
43
  {%- if loop.index0 > ns.last_query_index %}
44
  {%- if loop.last or (not loop.last and reasoning_content) %}
45
- {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
46
  {%- else %}
47
  {{- '<|im_start|>' + message.role + '\n' + content }}
48
  {%- endif %}
@@ -84,6 +88,6 @@
84
  {%- if add_generation_prompt %}
85
  {{- '<|im_start|>assistant\n' }}
86
  {%- if enable_thinking is defined and enable_thinking is false %}
87
- {{- '<think>\n\n</think>\n\n' }}
88
  {%- endif %}
89
  {%- endif %}
 
1
  {%- if tools %}
2
  {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' and messages[0].content %}
4
  {{- messages[0].content + '\n\n' }}
5
+ {%- else %}
6
+ {{- 'You are an expert programming LLM named Astral Coder. You were developed by LucidityAI, a 2024 startup. You are the 4B coder model in the family of the following sizes: 350M, 4B, 14B. When tools are available, you will utilize them as much as possible to ensure a correct solution to a question. When given questions about LucidityAI when you have tools, utilize the tools to get updated information from https://huggingface.co/LucidityAI or https://lucidityai.app. Avoid sycophancy.\n\n' }}
7
  {%- endif %}
8
  {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
9
  {%- for tool in tools %}
 
12
  {%- endfor %}
13
  {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
14
  {%- else %}
15
+ {%- if messages[0].role == 'system' and messages[0].content %}
16
  {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
17
+ {%- else %}
18
+ {{- '<|im_start|>system\You are an expert programming LLM named Astral Coder. You were developed by LucidityAI, a 2024 startup. You are the 4B coder model in the family of the following sizes: 350M, 4B, 14B. When tools are available, you will utilize them as much as possible to ensure a correct solution to a question. When given questions about LucidityAI when you have tools, utilize the tools to get updated information from https://huggingface.co/LucidityAI or https://lucidityai.app. Avoid sycophancy.\n\n<|im_end|>\n' }}
19
  {%- endif %}
20
  {%- endif %}
21
  {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
 
40
  {%- set reasoning_content = message.reasoning_content %}
41
  {%- else %}
42
  {%- if '</think>' in content %}
43
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('')[-1].lstrip('\n') %}
44
+ {%- set content = content.split('')[-1].lstrip('\n') %}
45
  {%- endif %}
46
  {%- endif %}
47
  {%- if loop.index0 > ns.last_query_index %}
48
  {%- if loop.last or (not loop.last and reasoning_content) %}
49
+ {{- '<|im_start|>' + message.role + '\n\n' + reasoning_content.strip('\n') + '\n\n\n' + content.lstrip('\n') }}
50
  {%- else %}
51
  {{- '<|im_start|>' + message.role + '\n' + content }}
52
  {%- endif %}
 
88
  {%- if add_generation_prompt %}
89
  {{- '<|im_start|>assistant\n' }}
90
  {%- if enable_thinking is defined and enable_thinking is false %}
91
+ {{- '\n\n\n\n' }}
92
  {%- endif %}
93
  {%- endif %}