Adding tool call support in chat template
Browse files- tokenizer_config.json +1 -1
tokenizer_config.json
CHANGED
@@ -9007,7 +9007,7 @@
|
|
9007 |
"<SPECIAL_999>"
|
9008 |
],
|
9009 |
"bos_token": "<s>",
|
9010 |
-
"chat_template":
|
9011 |
"clean_up_tokenization_spaces": false,
|
9012 |
"eos_token": "</s>",
|
9013 |
"extra_special_tokens": {},
|
|
|
9007 |
"<SPECIAL_999>"
|
9008 |
],
|
9009 |
"bos_token": "<s>",
|
9010 |
+
"chat_template": "{%- set today = strftime_now('%Y-%m-%d') -%}{%- set default_system_message = '[SYSTEM_PROMPT]You are Mistral Small 3, a Large Language Model (LLM) created by Mistral AI, a French startup headquartered in Paris.\\nYour knowledge base was last updated on 2023-10-01. The current date is ' + today + '.\\n\\nWhen you\\'re not sure about some information, you say that you don\\'t have the information and don\\'t make up anything.\\nIf the user\\'s question is not clear, ambiguous, or does not provide enough context for you to accurately answer the question, you do not try to answer it right away and you rather ask the user to clarify their request.[/SYSTEM_PROMPT]' %}{{ bos_token }}{%- if tools is defined -%}{%- set tool_instructions = '[AVAILABLE_TOOLS]You can use multiple tools by responding with JSON array like: [{\\\"name\\\": \\\"tool1\\\", \\\"parameters\\\": {}}, {\\\"name\\\": \\\"tool2\\\", \\\"parameters\\\": {}}][/AVAILABLE_TOOLS]' %}{%- set default_system_message = default_system_message + tool_instructions -%}{%- endif -%}{%- if messages[0]['role'] == 'system' -%}{%- set system_message = messages[0]['content'] -%}{%- set loop_messages = messages[1:] -%}{%- else -%}{%- set system_message = default_system_message -%}{%- set loop_messages = messages -%}{%- endif -%}[SYSTEM_PROMPT]{{ system_message }}[/SYSTEM_PROMPT]\\n{%- for message in loop_messages -%}{%- if message['role'] == 'user' -%}[INST]{{ message['content'] }}[/INST]\\n{%- elif message['role'] == 'assistant' -%}{%- if 'tool_calls' in message -%}[TOOL_CALLS][{%- for tool_call in message.tool_calls -%}{{'{\"name\": \"' + tool_call.function.name + '\", \"parameters\": ' + tool_call.function.arguments|tojson + '}'}}{%- if not loop.last -%}, {%- endif -%}{%- endfor -%}][/TOOL_CALLS]\\n{%- else -%}{{ message['content'] + eos_token }}\\n{%- endif -%}{%- elif message['role'] == 'tool' -%}[TOOL_CONTENT]{{ message['content']|string }}[/TOOL_CONTENT]\\n{%- elif message['role'] == 'system' -%}[SYSTEM_PROMPT]{{ message['content'] }}[/SYSTEM_PROMPT]\\n{%- else -%}{{ raise_exception('Only user, system, assistant, and tool roles are supported!') }}\\n{%- endif -%}{%- endfor -%}",
|
9011 |
"clean_up_tokenization_spaces": false,
|
9012 |
"eos_token": "</s>",
|
9013 |
"extra_special_tokens": {},
|