update chat_template
Browse files- chat_template.jinja +17 -5
chat_template.jinja
CHANGED
|
@@ -29,7 +29,10 @@
|
|
| 29 |
{%- set content = '' %}
|
| 30 |
{%- endif %}
|
| 31 |
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
| 32 |
-
{{- '<|im_start|>' + message.role + '\n'
|
|
|
|
|
|
|
|
|
|
| 33 |
{%- elif message.role == "assistant" %}
|
| 34 |
{%- set reasoning_content = '' %}
|
| 35 |
{%- if message.reasoning_content is string %}
|
|
@@ -40,14 +43,18 @@
|
|
| 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 |
-
{{- '<
|
| 46 |
{%- else %}
|
| 47 |
-
{{-
|
| 48 |
{%- endif %}
|
| 49 |
{%- else %}
|
| 50 |
-
{{-
|
| 51 |
{%- endif %}
|
| 52 |
{%- if message.tool_calls %}
|
| 53 |
{%- for tool_call in message.tool_calls %}
|
|
@@ -82,8 +89,13 @@
|
|
| 82 |
{%- endif %}
|
| 83 |
{%- endfor %}
|
| 84 |
{%- if add_generation_prompt %}
|
| 85 |
-
{{- '<|im_start|>
|
|
|
|
|
|
|
|
|
|
| 86 |
{%- if enable_thinking is defined and enable_thinking is false %}
|
| 87 |
{{- '<think>\n\n</think>\n\n' }}
|
|
|
|
|
|
|
| 88 |
{%- endif %}
|
| 89 |
{%- endif %}
|
|
|
|
| 29 |
{%- set content = '' %}
|
| 30 |
{%- endif %}
|
| 31 |
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
| 32 |
+
{{- '<|im_start|>' + message.role + '\n' }}
|
| 33 |
+
{%- if message.name %}<name>{{ message.name }}</name>
|
| 34 |
+
{%- endif -%}
|
| 35 |
+
{{- '\n' + message.content | trim + '<|im_end|>\n' }}
|
| 36 |
{%- elif message.role == "assistant" %}
|
| 37 |
{%- set reasoning_content = '' %}
|
| 38 |
{%- if message.reasoning_content is string %}
|
|
|
|
| 43 |
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 44 |
{%- endif %}
|
| 45 |
{%- endif %}
|
| 46 |
+
{{- '<|im_start|>' + message.role + '\n' }}
|
| 47 |
+
{%- if message.name %}<name>{{ message.name }}</name>
|
| 48 |
+
{{- '\n' }}
|
| 49 |
+
{%- endif %}
|
| 50 |
{%- if loop.index0 > ns.last_query_index %}
|
| 51 |
{%- if loop.last or (not loop.last and reasoning_content) %}
|
| 52 |
+
{{- '<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
| 53 |
{%- else %}
|
| 54 |
+
{{- content }}
|
| 55 |
{%- endif %}
|
| 56 |
{%- else %}
|
| 57 |
+
{{- content }}
|
| 58 |
{%- endif %}
|
| 59 |
{%- if message.tool_calls %}
|
| 60 |
{%- for tool_call in message.tool_calls %}
|
|
|
|
| 89 |
{%- endif %}
|
| 90 |
{%- endfor %}
|
| 91 |
{%- if add_generation_prompt %}
|
| 92 |
+
{{- '<|im_start|>user\n' }}
|
| 93 |
+
{%- if speak_as is defined and speak_as %}<name>{{ speak_as }}</name>
|
| 94 |
+
{%- endif -%}
|
| 95 |
+
{{- '\n' }}
|
| 96 |
{%- if enable_thinking is defined and enable_thinking is false %}
|
| 97 |
{{- '<think>\n\n</think>\n\n' }}
|
| 98 |
+
{%- elif enable_thinking is defined and enable_thinking is true %}
|
| 99 |
+
{{- '<think>' }}
|
| 100 |
{%- endif %}
|
| 101 |
{%- endif %}
|