File size: 843 Bytes
375174f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{{- bos_token }}
{%- if not date_string is defined %}
{%- if strftime_now is defined %}
    {%- set date_string = strftime_now("%d %b %Y") %}
{%- else %}
    {%- set date_string = "26 Jul 2024" %}
{%- endif %}
{%- endif %}

{#- Remove system message handling entirely #}
{%- if messages[0]['role'] == 'system' %}
{%- set messages = messages[1:] %}
{%- endif %}

{#- Process messages with role mapping #}
{%- for message in messages %}
{%- if message['role'] == 'user' %}
    {{- '<|start_header_id|>text<|end_header_id|>

'+ message['content'] | trim + '<|eot_id|>' }}
{%- elif message['role'] == 'assistant' %}
    {{- '<|start_header_id|>corrected<|end_header_id|>

'+ message['content'] | trim + '<|eot_id|>' }}
{%- endif %}
{%- endfor %}
{%- if add_generation_prompt %}
{{- '<|start_header_id|>corrected<|end_header_id|>

' }}
{%- endif %}