| { | |
| "add_bos_token": true, | |
| "add_eos_token": false, | |
| "added_tokens_decoder": { | |
| "0": { | |
| "content": "<unk>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "1": { | |
| "content": "<s>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "2": { | |
| "content": "</s>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "101": { | |
| "content": "<think>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "102": { | |
| "content": "</think>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "103": { | |
| "content": "<tool_response>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "104": { | |
| "content": "</tool_response>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "105": { | |
| "content": "<tools>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "106": { | |
| "content": "</tools>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "107": { | |
| "content": "<parameters>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "108": { | |
| "content": "</parameters>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "109": { | |
| "content": "<arguments>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "110": { | |
| "content": "</arguments>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "111": { | |
| "content": "<function", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "112": { | |
| "content": "</function>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "113": { | |
| "content": "<param", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "114": { | |
| "content": "</param>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "73440": { | |
| "content": "<|im_end|>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "73441": { | |
| "content": "<|im_start|>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "73442": { | |
| "content": "<tool_call>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "73443": { | |
| "content": "</tool_call>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "73444": { | |
| "content": "<|im_sep|>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "73445": { | |
| "content": "<|fim_prefix|>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "73446": { | |
| "content": "<|fim_middle|>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "73447": { | |
| "content": "<|fim_suffix|>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| } | |
| }, | |
| "additional_special_tokens": [ | |
| "<|im_end|>", | |
| "<|im_start|>", | |
| "<tool_call>", | |
| "</tool_call>", | |
| "<|im_sep|>", | |
| "<|fim_prefix|>", | |
| "<|fim_middle|>", | |
| "<|fim_suffix|>", | |
| "<tool_response>", | |
| "</tool_response>", | |
| "<tools>", | |
| "</tools>", | |
| "<arguments>", | |
| "</arguments>", | |
| "<parameters>", | |
| "</parameters>", | |
| "<function", | |
| "</function>", | |
| "<param", | |
| "</param>" | |
| ], | |
| "bos_token": "<s>", | |
| "clean_up_tokenization_spaces": false, | |
| "eos_token": "<|im_end|>", | |
| "legacy": true, | |
| "model_max_length": 262144, | |
| "pad_token": "</s>", | |
| "sp_model_kwargs": {}, | |
| "spaces_between_special_tokens": false, | |
| "tokenizer_class": "LlamaTokenizer", | |
| "unk_token": "<unk>", | |
| "use_default_system_prompt": false, | |
| "chat_template": "{%- if tools %}\n {%- set tool_definitions %}\n {{- \"# Tools\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson(ensure_ascii=False) }}\n {%- endfor %}\n {{- '\\n</tools>\\n\\nTool usage guidelines:\\n- You may call zero or more functions. If no function calls are needed, just answer normally and do not include any <function ... </function>.\\n- When calling a function, return an XML object within <function ... </function> using:\\n<function name=\"function-name\"><param name=\"param-name\">param-value</param></function>\\n- param-value may be multi-line. If it contains <, & or newline characters, wrap it in a CDATA block: <param name=\"param-name\"><![CDATA[...multi-line value...]]></param>' }}\n {%- endset %}\n \n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {%- if '<tool_def_sep>' in messages[0].content %}\n {{- messages[0].content.replace('<tool_def_sep>', tool_definitions) }}\n {%- else %}\n {{- messages[0].content + '\\n\\n' + tool_definitions }}\n {%- endif %}\n {%- else %}\n {{- tool_definitions.lstrip() }}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n \n {%- if message.tool_calls %}\n {%- set content_parts = content.split('<tool_sep>') %}\n {%- set processed_content = content_parts[0] %}\n {%- set tool_calls_count = message.tool_calls|length %}\n {%- set tool_sep_count = content_parts|length - 1 %}\n {%- set min_count = [tool_calls_count, tool_sep_count]|min %}\n \n {%- for i in range(1, content_parts|length) %}\n {%- set tool_index = i - 1 %}\n {%- if tool_index < tool_calls_count %}\n {%- set tool_call = message.tool_calls[tool_index] %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {%- set single_tool_xml %}\n {{- '<function name=\"' ~ tool_call.name ~ '\">' }}\n {%- if tool_call.arguments %}\n {%- set args_dict = tool_call.arguments %}\n {%- for param_name, param_value in args_dict.items() %}\n {{- '<param name=\"' ~ param_name ~ '\">' }}\n {%- if param_value is string and ('<' in param_value or '&' in param_value or '\\n' in param_value) %}\n {{- '<![CDATA[' + param_value + ']]>' }}\n {%- else %}\n {{- param_value }}\n {%- endif %}\n {{- '</param>' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>' }}\n {%- endset %}\n {%- set processed_content = processed_content + single_tool_xml + content_parts[i] %}\n {%- else %}\n {%- set processed_content = processed_content + content_parts[i] %}\n {%- endif %}\n {%- endfor %}\n \n {%- if tool_calls_count > tool_sep_count %}\n {%- for remaining_index in range(tool_sep_count, tool_calls_count) %}\n {%- set tool_call = message.tool_calls[remaining_index] %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {%- set remaining_tool_xml %}\n {{- '<function name=\"' ~ tool_call.name ~ '\">' }}\n {%- if tool_call.arguments %}\n {%- set args_dict = tool_call.arguments %}\n {%- for param_name, param_value in args_dict.items() %}\n {{- '<param name=\"' ~ param_name ~ '\">' }}\n {%- if param_value is string and ('<' in param_value or '&' in param_value or '\\n' in param_value) %}\n {{- '<![CDATA[' + param_value + ']]>' }}\n {%- else %}\n {{- param_value }}\n {%- endif %}\n {{- '</param>' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>' }}\n {%- endset %}\n {%- set processed_content = processed_content + remaining_tool_xml %}\n {%- endfor %}\n {%- endif %}\n \n {%- set content = processed_content %}\n {%- endif %}\n \n {%- if loop.index0 > ns.last_query_index %}\n {%- if reasoning_content %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n \n {%- if message.tool_calls and not has_tool_sep %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<function name=\"' ~ tool_call.name ~ '\">' }}\n {%- if tool_call.arguments %}\n {%- set args_dict = tool_call.arguments %}\n {%- for param_name, param_value in args_dict.items() %}\n {{- '<param name=\"' ~ param_name ~ '\">' }}\n {%- if param_value is string and ('<' in param_value or '&' in param_value or '\\n' in param_value) %}\n {{- '<![CDATA[' + param_value + ']]>' }}\n {%- else %}\n {{- param_value }}\n {%- endif %}\n {{- '</param>' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {%- if message.content is string %}\n {{- content }}\n {%- else %}\n {{- message.content | tojson(ensure_ascii=False) }}\n {%- endif %}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}" | |
| } |