Update chat_template.jinja
Browse files- chat_template.jinja +12 -1
chat_template.jinja
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
{%- set tools_system_message_prefix = 'You are a helpful assistant with access to the following tools. You may call one or more tools to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>' %}
|
| 2 |
{%- set tools_system_message_suffix = '\n</tools>\n\nFor each tool call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call>. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.' %}
|
| 3 |
{%- set documents_system_message_prefix = 'You are a helpful assistant with access to the following documents. You may use one or more documents to assist with the user query.\n\nYou are given a list of documents within <documents></documents> XML tags:\n<documents>' %}
|
|
@@ -56,11 +57,21 @@
|
|
| 56 |
{%- set ns.system_message = ns.documents_system_message %}
|
| 57 |
{%- endif %}
|
| 58 |
{%- endif %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
{%- if ns.system_message %}
|
| 60 |
{{- '<|start_of_role|>system<|end_of_role|>' + ns.system_message + '<|end_of_text|>\n' }}
|
| 61 |
{%- else %}
|
| 62 |
{{- '<|start_of_role|>system<|end_of_role|>' + ns.default_system_message + '<|end_of_text|>\n' }}
|
| 63 |
{%- endif %}
|
|
|
|
| 64 |
{%- for message in messages %}
|
| 65 |
{%- set content = namespace(val='') %}
|
| 66 |
{%- if message.content is string %}
|
|
@@ -115,4 +126,4 @@
|
|
| 115 |
{%- endfor %}
|
| 116 |
{%- if add_generation_prompt %}
|
| 117 |
{{- '<|start_of_role|>assistant<|end_of_role|>' }}
|
| 118 |
-
{%- endif %}
|
|
|
|
| 1 |
+
{%- set current_date = now().strftime('%Y-%m-%d') %}
|
| 2 |
{%- set tools_system_message_prefix = 'You are a helpful assistant with access to the following tools. You may call one or more tools to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>' %}
|
| 3 |
{%- set tools_system_message_suffix = '\n</tools>\n\nFor each tool call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call>. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.' %}
|
| 4 |
{%- set documents_system_message_prefix = 'You are a helpful assistant with access to the following documents. You may use one or more documents to assist with the user query.\n\nYou are given a list of documents within <documents></documents> XML tags:\n<documents>' %}
|
|
|
|
| 57 |
{%- set ns.system_message = ns.documents_system_message %}
|
| 58 |
{%- endif %}
|
| 59 |
{%- endif %}
|
| 60 |
+
|
| 61 |
+
{# Inject metadata and reasoning effort #}
|
| 62 |
+
{%- set ns.system_message = '<|start|>system<|message|>' + ns.system_message + '\nknowledge cutoff: 2024-06\nCurrent date: ' + current_date %}
|
| 63 |
+
{%- if reasoning_effort is defined %}
|
| 64 |
+
{%- set ns.system_message = ns.system_message + '\nReasoning: ' + reasoning_effort %}
|
| 65 |
+
{%- else %}
|
| 66 |
+
{%- set ns.system_message = ns.system_message + '\nReasoning: no' %}
|
| 67 |
+
{%- endif %}
|
| 68 |
+
|
| 69 |
{%- if ns.system_message %}
|
| 70 |
{{- '<|start_of_role|>system<|end_of_role|>' + ns.system_message + '<|end_of_text|>\n' }}
|
| 71 |
{%- else %}
|
| 72 |
{{- '<|start_of_role|>system<|end_of_role|>' + ns.default_system_message + '<|end_of_text|>\n' }}
|
| 73 |
{%- endif %}
|
| 74 |
+
|
| 75 |
{%- for message in messages %}
|
| 76 |
{%- set content = namespace(val='') %}
|
| 77 |
{%- if message.content is string %}
|
|
|
|
| 126 |
{%- endfor %}
|
| 127 |
{%- if add_generation_prompt %}
|
| 128 |
{{- '<|start_of_role|>assistant<|end_of_role|>' }}
|
| 129 |
+
{%- endif %}
|