Update chat_template.jinja
Browse files- chat_template.jinja +0 -21
chat_template.jinja
CHANGED
@@ -23,8 +23,6 @@
|
|
23 |
{#- Tool description appended also if last message is tool. Edits made by Unsloth #}
|
24 |
{%- set tools_description = "" %}
|
25 |
{%- set has_tools = false %}
|
26 |
-
{#- Cannot use set append_tools_index = loop.index0 since temporary variable - must use namespace #}
|
27 |
-
{%- set ns = namespace(append_tools_index=0, append_tools=false) %}
|
28 |
|
29 |
{%- if tools is defined and tools is not none and tools|length > 0 %}
|
30 |
|
@@ -33,25 +31,6 @@
|
|
33 |
|
34 |
{{- tools_description }}
|
35 |
|
36 |
-
{#- If User,Assistant,Tool,Tool we also need to append tools_description to last assistant WITHOUT tool_calls defined. Edits made by Unsloth #}
|
37 |
-
{%- if (loop_messages|last)['role'] == 'tool' %}
|
38 |
-
|
39 |
-
{#- Find last assistant WITHOUT tool_calls defined #}
|
40 |
-
{%- set ns.append_tools = true %}
|
41 |
-
{%- for message in loop_messages %}
|
42 |
-
{%- if message['role'] == 'assistant' %}
|
43 |
-
|
44 |
-
{#- Cannot use set append_tools_index = loop.index0 since temporary variable - must use namespace #}
|
45 |
-
|
46 |
-
{%- if message['tool_calls'] is not defined or message['tool_calls'] is none %}
|
47 |
-
{%- set ns.append_tools_index = loop.index0 %}
|
48 |
-
{%- endif %}
|
49 |
-
|
50 |
-
{%- endif %}
|
51 |
-
{%- endfor %}
|
52 |
-
|
53 |
-
{%- endif %}
|
54 |
-
|
55 |
{%- endif %}
|
56 |
|
57 |
{%- for message in loop_messages %}
|
|
|
23 |
{#- Tool description appended also if last message is tool. Edits made by Unsloth #}
|
24 |
{%- set tools_description = "" %}
|
25 |
{%- set has_tools = false %}
|
|
|
|
|
26 |
|
27 |
{%- if tools is defined and tools is not none and tools|length > 0 %}
|
28 |
|
|
|
31 |
|
32 |
{{- tools_description }}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
{%- endif %}
|
35 |
|
36 |
{%- for message in loop_messages %}
|