Adding tool call support in chat template
Browse filesAdded tool calling feature in it. Kindly check for it.
- tokenizer_config.json +1 -1
tokenizer_config.json
CHANGED
|
@@ -9007,7 +9007,7 @@
|
|
| 9007 |
"<SPECIAL_999>"
|
| 9008 |
],
|
| 9009 |
"bos_token": "<s>",
|
| 9010 |
-
"chat_template": "{%- set today = strftime_now(\"%Y-%m-%d\") %}
|
| 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 = \"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 are unsure about some information, state that you do not have the information and do not make up anything.\\nIf the user's question is unclear, ambiguous, or lacks enough context for an accurate answer, you do not answer immediately.\\nInstead, you ask the user to clarify their request.\\nFor example:\\n- \\\"What are some good restaurants around me?\\\" → \\\"Where are you?\\\"\\n- \\\"When is the next flight to Tokyo?\\\" → \\\"Where are you departing from?\\\"\" -%}{{- bos_token -}}{%- if tools is defined and tools | length > 0 -%}{%- set tool_instructions = \"\\n\\nYou can use tools by responding with JSON: {\\\"name\\\": \\\"tool_name\\\", \\\"parameters\\\": {\\\"arg\\\": value}}\" -%}{%- 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]' -}}{%- for message in loop_messages -%}{%- if message['role'] == 'user' -%}{{- '[INST]' + message['content'] + '[/INST]' -}}{%- elif message['role'] == 'assistant' -%}{%- if 'tool_calls' in message -%}{%- if message.tool_calls|length != 1 -%}{{- raise_exception('Only single tool calls supported') -}}{%- endif -%}{{- '[TOOL_CALL]' + '{\\\"name\\\": \\\"' + message.tool_calls[0].function.name + '\\\", \\\"parameters\\\": ' + message.tool_calls[0].function.arguments|tojson + '}' + '[/TOOL_CALL]' -}}{%- else -%}{{- message['content'] + eos_token -}}{%- endif -%}{%- elif message['role'] == 'tool' -%}{{- '[TOOL_OUTPUT]' + message['content'] + '[/TOOL_OUTPUT]' -}}{%- endif -%}{%- endfor -%}",
|
| 9011 |
"clean_up_tokenization_spaces": false,
|
| 9012 |
"eos_token": "</s>",
|
| 9013 |
"extra_special_tokens": {},
|