41 lines
1.3 KiB
Plaintext
41 lines
1.3 KiB
Plaintext
|
|
{{- bos_token }}
|
||
|
|
{%- if custom_tools is defined %}
|
||
|
|
{%- set tools = custom_tools %}
|
||
|
|
{%- endif %}
|
||
|
|
{%- if not tools_in_user_message is defined %}
|
||
|
|
{%- set tools_in_user_message = true %}
|
||
|
|
{%- endif %}
|
||
|
|
{%- if not date_string is defined %}
|
||
|
|
{%- set date_string = '26 Jul 2024' %}
|
||
|
|
{%- endif %}
|
||
|
|
{%- if not tools is defined %}
|
||
|
|
{%- set tools = none %}
|
||
|
|
{%- endif %}
|
||
|
|
|
||
|
|
{#- This block extracts the system message, so we can slot it into the system message prompt below #}
|
||
|
|
{%- if messages[0]['role'] == 'system' %}
|
||
|
|
{%- set system_message = messages[0]['content']|trim %}
|
||
|
|
{%- set messages = messages[1:] %}
|
||
|
|
{%- else %}
|
||
|
|
{%- set system_message = '' %}
|
||
|
|
{%- endif %}
|
||
|
|
|
||
|
|
{#- System message #}
|
||
|
|
{{- '<|start_header_id|>system<|end_header_id|>\n\n' }}
|
||
|
|
{%- if tools is not none %}
|
||
|
|
{{- 'You are a helpful assistant.' }}
|
||
|
|
{%- else %}
|
||
|
|
{{- system_message }}
|
||
|
|
{%- endif %}
|
||
|
|
{{- '<|eot_id|>' }}
|
||
|
|
|
||
|
|
{%- for message in messages %}
|
||
|
|
{%- if message['role'] == 'user' %}
|
||
|
|
{{- '<|start_header_id|>user<|end_header_id|>\n\n' + message['content']|trim + '<|eot_id|>' }}
|
||
|
|
{%- elif message['role'] == 'assistant' %}
|
||
|
|
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' + message['content']|trim + '<|eot_id|>' }}
|
||
|
|
{%- endif %}
|
||
|
|
{%- endfor %}
|
||
|
|
{%- if add_generation_prompt %}
|
||
|
|
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
|
||
|
|
{%- endif %}
|