You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{#- Default system message if no system prompt is passed. #}
3
+
{%- setdefault_system_message = '# HOW YOU SHOULD THINK AND ANSWER\n\nFirst draft your thinking process (inner monologue) until you arrive at a response. Format your response using Markdown, and use LaTeX for any mathematical equations. Write both your thoughts and the response in the same language as the input.\n\nYour thinking process must follow the template below:[THINK]Your thoughts or/and draft, like working through an exercise on scratch paper. Be as casual and as long as you want until you are confident to generate the response to the user.[/THINK]Here, provide a self-contained response.'%}
4
+
5
+
{#- Begin of sequence token. #}
6
+
{{- bos_token }}
7
+
8
+
{#- Handle system prompt if it exists. #}
9
+
{#- System prompt supports text content or text and thinking chunks. #}
10
+
{%- ifmessages[0]['role'] == 'system'%}
11
+
{{- '[SYSTEM_PROMPT]' -}}
12
+
{%- ifmessages[0]['content'] isstring%}
13
+
{{- messages[0]['content'] -}}
14
+
{%- else%}
15
+
{%- forblockinmessages[0]['content'] %}
16
+
{%- ifblock['type'] == 'text'%}
17
+
{{- block['text'] }}
18
+
{%- elifblock['type'] == 'thinking'%}
19
+
{{- '[THINK]' + block['thinking'] + '[/THINK]' }}
20
+
{%- else%}
21
+
{{- raise_exception('Only text and thinking chunks are supported in system message contents.') }}
{{- raise_exception('After the optional system message, conversation roles must alternate user and assistant roles except for tool calls and results.') }}
50
+
{%- endif%}
51
+
{%- setns.index = ns.index + 1 %}
52
+
{%- endif%}
53
+
{%- endfor%}
54
+
55
+
{#- Handle conversation messages. #}
56
+
{%- formessageinloop_messages%}
57
+
58
+
{#- User messages supports text content or text and image chunks. #}
0 commit comments