{ "add_prefix_space": false, "added_tokens_decoder": { "200000": { "content": "]!p~[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200001": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200002": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200003": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200004": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200005": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200006": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200007": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200008": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200009": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200010": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200011": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200012": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200013": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200014": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200015": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200016": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200017": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200018": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200019": { "content": "]~b]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200020": { "content": "[e~[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200021": { "content": "]!d~[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200022": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200023": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200024": { "content": "]<]speech[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200025": { "content": "]<]image[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200026": { "content": "]<]video[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200027": { "content": "]<]start of speech[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200028": { "content": "]<]end of speech[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200029": { "content": "]<]start of image[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200030": { "content": "]<]end of image[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200031": { "content": "]<]start of video[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200032": { "content": "]<]end of video[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200033": { "content": "]<]vision pad[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200034": { "content": "]~!b[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200035": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200036": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200037": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200038": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200039": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200040": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200041": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200042": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200043": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200044": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200045": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200046": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200047": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200048": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200049": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200050": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "200051": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "200052": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "200053": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "200054": { "content": "]<]frame[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200055": { "content": "]<]start of frame[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200056": { "content": "]<]end of frame[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200057": { "content": "<|content_altered_placeholder|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200058": { "content": "]<]minimax[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "200059": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "200060": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false } }, "bos_token": "]~b]", "clean_up_tokenization_spaces": false, "eos_token": "[e~[", "pad_token": "]!p~[", "model_max_length": 40960000, "tokenizer_class": "PreTrainedTokenizerFast", "unk_token": "[e~[", "chat_template": "{# ---------- special token variables ---------- #}\n{%- set ns_token = ']<]minimax[>[' -%}\n{%- set bod_token = ']~!b[' -%}\n{%- set bos_token = ']~b]' -%}\n{%- set eos_token = '[e~[' -%}\n{%- set toolcall_begin_token = ns_token ~ '' -%}\n{%- set toolcall_end_token = ns_token ~ '' -%}\n{%- set think_begin_token = '' -%}\n{%- set think_end_token = '' -%}\n{%- set image_token = ']<]image[>[' -%}\n{%- set video_token = ']<]video[>[' -%}\n{#- Thinking mode: \"enabled\" / \"disabled\" / \"adaptive\" / not defined -#}\n{#- Recursive XML renderer for tool_call arguments ======================== -#}\n{#- None values are intentionally skipped in mapping iteration so that\n `null` (which would round-trip to the literal string \"null\")\n never appears in the rendered tool_call. The convention is: omit the\n field entirely. The top-level `_args` loop applies the same rule.\n The `val is none` branch below is a safety net only — upstream cleaning\n (drop_none_in_tool_arguments) should ensure no None ever reaches here. -#}\n{%- macro to_xml(val, ns) -%}\n{%- if val is mapping -%}\n{%- for k, v in val.items() if v is not none -%}\n{{ ns }}<{{ k }}>{{ to_xml(v, ns) }}{{ ns }}\n{%- endfor -%}\n{%- elif val is iterable and val is not string -%}\n{%- for item in val -%}\n{{ ns }}{{ to_xml(item, ns) }}{{ ns }}\n{%- endfor -%}\n{%- elif val is none -%}\n{#- Should be unreachable when upstream cleaning is applied. -#}\n{%- elif val is boolean -%}\n{{ val | tojson }}\n{%- else -%}\n{{ val }}\n{%- endif -%}\n{%- endmacro -%}\n{#- Tool Rendering Functions ============================================== -#}\n{%- macro render_tool_namespace(namespace_name, tool_list) -%}\n{%- for tool in tool_list -%}\n{{ tool.function | tojson(ensure_ascii=False) }}\n{% endfor -%}\n{%- endmacro -%}\n{%- macro visible_text(content) -%}\n {%- if content is string -%}\n {{ content }}\n {%- elif content is iterable and content is not mapping -%}\n {%- for item in content -%}\n {%- if item is mapping and item.type == 'text' -%}\n {{- item.text }}\n {%- elif item is mapping and item.type == 'image' -%}\n {{- image_token }}\n {%- elif item is mapping and item.type == 'video' -%}\n {{- video_token}}\n {%- elif item is string -%}\n {{- item }}\n {%- endif -%}\n {%- endfor -%}\n {%- elif content is none -%}\n {{- '' }}\n {%- else -%}\n {{- content }}\n {%- endif -%}\n{%- endmacro -%}\n{#- System Message Construction ============================================ -#}\n{%- macro build_system_message(system_message) -%}\n {%- if system_message and system_message.content -%}\n {{- visible_text(system_message.content) }}\n {#- Handle current_date -#}\n {%- if system_message.current_date -%}\n {{- '\\n' ~ 'Current date: ' + system_message.current_date }}\n {%- endif -%}\n {#- Handle current_location -#}\n {%- if system_message.current_location -%}\n {{- '\\n' ~ 'Current location: ' + system_message.current_location }}\n {%- endif -%}\n {%- endif -%}\n\n {#- Thinking mode instructions -#}\n {{- '\\n\\n\\n' }}\n {{- 'You have a thinking capability that allows you to reason step by step before responding. When thinking is enabled, wrap your reasoning in ' ~ think_begin_token ~ think_end_token ~ ' tags before your response. When thinking is disabled, begin your response directly after the ' ~ think_end_token ~ ' prefix. When thinking is adaptive, decide on your own whether to think for the current turn.\\n' }}\n {%- if thinking_mode is defined -%}\n {%- if thinking_mode == \"enabled\" -%}\n {{- 'Current thinking mode: enabled. You MUST think step by step before every response, including after receiving function/tool results.\\n' }}\n {%- elif thinking_mode == \"disabled\" -%}\n {{- 'Current thinking mode: disabled. Do not output any thinking process.\\n' }}\n {%- elif thinking_mode == \"adaptive\" -%}\n {{- 'Current thinking mode: adaptive. You are encouraged to think for complex decision-making, multi-step reasoning, or when analyzing function/tool results.\\n' }}\n {%- endif -%}\n {%- else -%}\n {{- 'Current thinking mode: adaptive. You are encouraged to think for complex decision-making, multi-step reasoning, or when analyzing function/tool results.\\n' }}\n {%- endif -%}\n {{- '' }}\n {%- if template_model_id is defined -%}\n {{- '\\n\\n' ~ template_model_id ~ '' }}\n {%- endif -%}\n{%- endmacro -%}\n{%- macro build_developer_message(developer_message) -%}\n {%- if developer_message and developer_message.content -%}\n {{- visible_text(developer_message.content) }}\n {%- else -%}\n {%- if model_identity is not defined -%}\n {%- set model_identity = \"You are a helpful assistant.\" -%}\n {%- endif -%}\n {{- model_identity }}\n {%- endif -%}\n{%- endmacro -%}\n{#- Main Template Logic ================================================= -#}\n{#- Role mapping: root -> system sp (high priority), system/developer -> developer sp (low priority) -#}\n{%- set system_message = none -%}\n{%- set developer_message = none -%}\n{%- set conversation_messages = messages -%}\n{%- if messages and messages[0].role == \"root\" -%}\n {%- set system_message = messages[0] -%}\n {%- set conversation_messages = messages[1:] -%}\n {%- if conversation_messages and conversation_messages[0].role in [\"system\", \"developer\"] -%}\n {%- set developer_message = conversation_messages[0] -%}\n {%- set conversation_messages = conversation_messages[1:] -%}\n {%- endif -%}\n{%- elif messages and messages[0].role in [\"system\", \"developer\"] -%}\n {%- set developer_message = messages[0] -%}\n {%- set conversation_messages = messages[1:] -%}\n{%- endif -%}\n{#- Render system sp (higher priority, root role only) -#}\n{{- bod_token ~ bos_token ~ 'system' ~ '\\n' }}\n{{- build_system_message(system_message) }}\n{{- eos_token ~ '\\n' }}\n\n{#- Render developer sp (lower priority: system/developer role + tools) -#}\n{{- bos_token ~ 'developer' ~ '\\n' }}\n{{- build_developer_message(developer_message) }}\n{%- if tools -%}\n {{- '\\n\\n' ~ '# Tools' ~ '\\n' ~ 'You may call one or more tools to assist with the user query.\\nHere are the tools available in JSONSchema format:' ~ '\\n' }}\n {{- '\\n' ~ '' ~ '\\n' }}\n {{- render_tool_namespace(\"functions\", tools) }}\n {{- '' ~ '\\n\\n' }}\n {{- 'To call tools, wrap all invocations in a single ' ~ toolcall_begin_token ~ toolcall_end_token ~ ' block. Parameter values containing nested objects or arrays are recursively expanded into XML elements. Example:\\n' }}\n {{- '\\n' ~ toolcall_begin_token ~ '\\n' }}\n {{- ns_token + '' }}\n {{- ns_token + 'value-1' + ns_token + '' }}\n {{- ns_token + '' }}\n {{- ns_token + '' }}\n {{- ns_token + 'val-a' + ns_token + '' }}\n {{- ns_token + 'val-b' + ns_token + '' }}\n {{- ns_token + '' }}\n {{- ns_token + '' }}\n {{- ns_token + '\\n' }}\n {{- ns_token + '' }}\n {{- ns_token + 'value-1' + ns_token + '' }}\n {{- ns_token + '\\n' }}\n {{- toolcall_end_token }}\n{%- endif -%}\n{{- eos_token ~ '\\n' }}\n\n{#- Render messages -#}\n{%- set last_tool_call = namespace(name=none) -%}\n{%- for message in conversation_messages -%}\n {%- if message.role == 'assistant' -%}\n {{- bos_token ~ 'ai' ~ '\\n' }}\n\n {%- set reasoning_content = '' %}\n {%- set content = visible_text(message.content) %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if think_end_token in content %}\n {%- set reasoning_content = content.split(think_end_token)[0].strip('\\n').split(think_begin_token)[-1].strip('\\n') %}\n {%- set content = content.split(think_end_token)[-1].strip('\\n') %}\n {%- endif %}\n {%- endif %}\n\n {%- if reasoning_content -%}\n {#- Render thinking for every assistant turn (all-turn visible) -#}\n {{- think_begin_token ~ reasoning_content ~ think_end_token }}\n {%- else -%}\n {#- No thinking rendered → prefix with think_end_token -#}\n {{- think_end_token }}\n {%- endif -%}\n\n {%- if content -%}\n {{- content }}\n {%- endif -%}\n {%- if message.tool_calls -%}\n {{- toolcall_begin_token ~ '\\n' }}\n\n {%- for tool_call in message.tool_calls -%}\n {%- if tool_call.function -%}\n {%- set tool_call = tool_call.function -%}\n {%- endif -%}\n{{- ns_token + '' }}\n{%- set _args = tool_call.arguments -%}\n{%- for k, v in _args.items() if v is not none %}\n{{- ns_token + '<' + k + '>' -}}\n{{- to_xml(v, ns_token) -}}\n{{- ns_token + '' }}\n{%- endfor -%}\n{{- ns_token + '' ~ '\\n' }}\n {%- endfor -%}\n\n {{- toolcall_end_token }}\n {%- if message.tool_calls[-1].function -%}\n {%- set last_tool_call.name = message.tool_calls[-1].function.name -%}\n {%- else -%}\n {%- set last_tool_call.name = message.tool_calls[-1].name -%}\n {%- endif -%}\n {%- else -%}\n {%- set last_tool_call.name = none -%}\n {%- endif -%}\n {{- eos_token ~ '\\n' }}\n\n {%- elif message.role == 'tool' -%}\n {%- if last_tool_call.name is none -%}\n {{- raise_exception(\"Message has tool role, but there was no previous assistant message with a tool call!\") }}\n {%- endif -%}\n {%- if loop.first or (conversation_messages[loop.index0 - 1].role != 'tool') -%}\n {{- bos_token ~ 'tool' }}\n {%- endif -%}\n {{- '\\n' }}\n {%- if message.content is string -%}\n {{- message.content }}\n {%- else -%}\n {%- for tr in message.content -%}\n {%- if tr is mapping and tr.type is defined and tr.type == 'image' -%}\n {{- image_token }}\n {%- elif tr is mapping and tr.type is defined and tr.type == 'video' -%}\n {{- video_token }}\n {%- else -%}\n {{- tr.output if tr.output is defined else (tr.text if tr.type == 'text' and tr.text is defined else tr) }}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n {{- '' }}\n {%- if loop.last or (conversation_messages[loop.index0 + 1].role != 'tool') -%}\n {{- eos_token ~ '\\n' -}}\n {%- endif -%}\n\n {%- elif message.role == 'user' -%}\n {{- bos_token ~ 'user' ~ '\\n' }}\n {{- visible_text(message.content) }}\n {{- eos_token ~ '\\n' }}\n {%- endif -%}\n{%- endfor -%}\n\n{#- Generation prompt -#}\n{%- if add_generation_prompt -%}\n{{- bos_token ~ 'ai' ~ '\\n' }}\n{%- if thinking_mode is defined and thinking_mode == \"disabled\" -%}\n {{- think_end_token }}\n{%- elif thinking_mode is defined and thinking_mode == \"adaptive\" -%}\n {#- adaptive: no prefix, let model decide -#}\n{%- elif thinking_mode is defined and thinking_mode == \"enabled\" -%}\n {#- enabled or not defined: default to think -#}\n {{- think_begin_token }}\n{%- else -%}\n {#- adaptive: no prefix, let model decide -#}\n{%- endif -%}\n{%- endif -%}\n", "chat_template_file": "chat_template.jinja" }