Upload qwen3.5/chat_template.jinja with huggingface_hub
Browse files- qwen3.5/chat_template.jinja +13 -0
qwen3.5/chat_template.jinja
CHANGED
|
@@ -113,6 +113,19 @@
|
|
| 113 |
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 114 |
{%- elif message.role == "assistant" %}
|
| 115 |
{%- set reasoning_content = '' %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
{%- if message.reasoning_content is string %}
|
| 117 |
{%- set reasoning_content = message.reasoning_content %}
|
| 118 |
{%- else %}
|
|
|
|
| 113 |
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 114 |
{%- elif message.role == "assistant" %}
|
| 115 |
{%- set reasoning_content = '' %}
|
| 116 |
+
{#- Auto-close unclosed think before tool_call -#}
|
| 117 |
+
{%- if '<think>' in content and '<tool_call>' in content %}
|
| 118 |
+
{%- set last_think = content.rfind('<think>') %}
|
| 119 |
+
{%- set last_close = content.rfind('</think>') %}
|
| 120 |
+
{%- set tool_pos = content.find('<tool_call>') %}
|
| 121 |
+
{%- if last_close < last_think or last_close == -1 %}
|
| 122 |
+
{%- if tool_pos > last_think %}
|
| 123 |
+
{%- set content = content[:tool_pos] + '</think>' + content[tool_pos:] %}
|
| 124 |
+
{%- else %}
|
| 125 |
+
{%- set content = content + '</think>' %}
|
| 126 |
+
{%- endif %}
|
| 127 |
+
{%- endif %}
|
| 128 |
+
{%- endif %}
|
| 129 |
{%- if message.reasoning_content is string %}
|
| 130 |
{%- set reasoning_content = message.reasoning_content %}
|
| 131 |
{%- else %}
|