Abhaykoul commited on
Commit
a78a31c
·
verified ·
1 Parent(s): 3fd874b

Update tokenizer_config.json

Browse files
Files changed (1) hide show
  1. tokenizer_config.json +1 -1
tokenizer_config.json CHANGED
@@ -227,7 +227,7 @@
227
  "<|video_pad|>"
228
  ],
229
  "bos_token": null,
230
- "chat_template": "{%- if tools %}\n<|im_start|>system\n{%- if messages[0].role == 'system' %}\n{{ messages[0].content }}\n\n{%- endif %}\n# Tools\n\nYou have access to one or more tools (functions) that can help you assist the user.\n\nThese tools are defined within <tools></tools> XML tags in JSON format. Each tool has a name and a set of required parameters.\n\nUse these tools **only when**:\n- The user asks something that requires external data (e.g., hint, lookup, calculation, etc.)\n- The question can't be fully answered using your internal knowledge alone\n- The tool clearly matches the user's intent\n\nTo call a tool, respond using this exact format inside a `<tool_call></tool_call>` XML tag:\n\nExample:\n<tool_call>\n{\"name\": \"function\", \"arguments\": {\"question\": \"augment here\"}}\n</tool_call>\n\n**Rules for Tool Calling:**\n- Only use tool calls when appropriate and the user has provided enough input\n- Include all required parameters as described in the tool's schema\n- Do **not** include any explanation before or after the tool_call\n- Do **not** answer the question yourself if the tool is meant to handle it\n- If no tool is relevant, proceed to respond as usual\n\n<tools>\n{%- for tool in tools %}\n{{ tool | tojson }}\n{%- endfor %}\n</tools>\n<|im_end|>\n{%- else %}\n{%- if messages[0].role == 'system' %}\n<|im_start|>system\n{{ messages[0].content }}\n<|im_end|>\n{%- endif %}\n{%- endif %}\n\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for forward_message in messages %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- set message = messages[index] %}\n {%- set current_content = message.content if message.content is not none else '' %}\n {%- set tool_start = '<tool_response>' %}\n {%- set tool_end = '</tool_response>' %}\n {%- set tool_start_length = tool_start|length %}\n {%- set tool_end_length = tool_end|length %}\n {%- set start_of_message = current_content[:tool_start_length] %}\n {%- set end_of_message = current_content[-tool_end_length:] if current_content|length >= tool_end_length else '' %}\n {%- if ns.multi_step_tool and message.role == \"user\" and not (start_of_message == tool_start and end_of_message == tool_end) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n<|im_start|>{{ message.role }}\n{{ message.content }}<|im_end|>\n {%- elif message.role == \"assistant\" %}\n<|im_start|>assistant\n{%- if message.content %}\n{{ message.content }}\n{%- endif %}\n{%- if message.tool_calls %}\n{%- for tool_call in message.tool_calls %}\n{%- set func = tool_call.function if tool_call.function else tool_call %}\n<tool_call>\n{\"name\": \"{{ func.name }}\", \"arguments\": {{ func.arguments if func.arguments is string else func.arguments | tojson }}}\n</tool_call>\n{%- endfor %}\n{%- endif %}\n<|im_end|>\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or messages[loop.index0 - 1].role != \"tool\" %}\n<|im_start|>user\n {%- endif %}\n<tool_response>\n{{ message.content }}\n</tool_response>\n {%- if loop.last or messages[loop.index0 + 1].role != \"tool\" %}\n<|im_end|>\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n\n{%- if add_generation_prompt %}\n<|im_start|>assistant\n{%- endif %}",
231
  "clean_up_tokenization_spaces": false,
232
  "eos_token": "<|im_end|>",
233
  "errors": "replace",
 
227
  "<|video_pad|>"
228
  ],
229
  "bos_token": null,
230
+ "chat_template": "{%- if tools %}\n<|im_start|>system\n{%- if messages[0].role == 'system' %}\n{{ messages[0].content }}\n\n{%- endif %}\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>{%- for tool in tools %}\n{{ tool | tojson }}{%- endfor %}\n</tools>\n\nFor each function 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><|im_end|>\n{%- else %}{%- if messages[0].role == 'system' %}\n<|im_start|>system\n{{ messages[0].content }}<|im_end|>\n{%- endif %}{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for forward_message in messages %}{%- set index = (messages|length - 1) - loop.index0 %}{%- set message = messages[index] %}{%- set current_content = message.content if message.content is not none else '' %}{%- set tool_start = '<tool_response>' %}{%- set tool_start_length = tool_start|length %}{%- set start_of_message = current_content[:tool_start_length] %}{%- set tool_end = '</tool_response>' %}{%- set tool_end_length = tool_end|length %}{%- set start_pos = (current_content|length) - tool_end_length %}{%- if start_pos < 0 %}{%- set start_pos = 0 %}{%- endif %}{%- set end_of_message = current_content[start_pos:] %}{%- if ns.multi_step_tool and message.role == \"user\" and not(start_of_message == tool_start and end_of_message == tool_end) %}{%- set ns.multi_step_tool = false %}{%- set ns.last_query_index = index %}{%- endif %}{%- endfor %}\n{%- for message in messages %}{%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}<|im_start|>{{ message.role }}\n{{ message.content }}<|im_end|>\n{%- elif message.role == \"assistant\" %}<|im_start|>assistant\n{%- if message.content %}{{ message.content }}{%- endif %}{%- if message.tool_calls %}{%- for tool_call in message.tool_calls %}{%- if (loop.first and content) or (not loop.first) %}\n{%- endif %}{%- if tool_call.function %}{%- set tool_call = tool_call.function %}{%- endif %}<tool_call>\n{\"name\": \"{{ tool_call.name }}\", \"arguments\": {{ tool_call.arguments if tool_call.arguments is string else tool_call.arguments | tojson }}}\n</tool_call>{%- endfor %}{%- endif %}<|im_end|>\n{%- elif message.role == \"tool\" %}{%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}<|im_start|>user{%- endif %}\n<tool_response>\n{{ message.content }}\n</tool_response>{%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}<|im_end|>\n{%- endif %}{%- endif %}{%- endfor %}\n{%- if add_generation_prompt %}<|im_start|>assistant\n{%- endif %}",
231
  "clean_up_tokenization_spaces": false,
232
  "eos_token": "<|im_end|>",
233
  "errors": "replace",