Remove strict user/assistant alternating validation
#1
by NeonBohdan - opened
- chat_template.jinja +0 -12
chat_template.jinja
CHANGED
|
@@ -38,18 +38,6 @@
|
|
| 38 |
{{- tools_definition }}
|
| 39 |
{%- endif %}
|
| 40 |
|
| 41 |
-
{#- Checks for alternating user/assistant messages. #}
|
| 42 |
-
{%- set ns = namespace() %}
|
| 43 |
-
{%- set ns.index = 0 %}
|
| 44 |
-
{%- for message in loop_messages %}
|
| 45 |
-
{%- if message.role == 'user' or (message.role == 'assistant' and (message.tool_calls is not defined or message.tool_calls is none or message.tool_calls | length == 0)) %}
|
| 46 |
-
{%- if (message['role'] == 'user') != (ns.index % 2 == 0) %}
|
| 47 |
-
{{- raise_exception('After the optional system message, conversation roles must alternate user and assistant roles except for tool calls and results.') }}
|
| 48 |
-
{%- endif %}
|
| 49 |
-
{%- set ns.index = ns.index + 1 %}
|
| 50 |
-
{%- endif %}
|
| 51 |
-
{%- endfor %}
|
| 52 |
-
|
| 53 |
{#- Handle conversation messages. #}
|
| 54 |
{%- for message in loop_messages %}
|
| 55 |
|
|
|
|
| 38 |
{{- tools_definition }}
|
| 39 |
{%- endif %}
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
{#- Handle conversation messages. #}
|
| 42 |
{%- for message in loop_messages %}
|
| 43 |
|