{ "backend": "tokenizers", "begin_of_text": "<|begin_of_text|>", "clean_up_tokenization_spaces": false, "content_image": "<|content_image|>", "content_invoke_tool_json": "<|content_invoke_tool_json|>", "content_invoke_tool_text": "<|content_invoke_tool_text|>", "content_model_end_sampling": "<|content_model_end_sampling|>", "content_text": "<|content_text|>", "content_thinking": "<|content_thinking|>", "content_tool_error": "<|content_tool_error|>", "content_xml": "<|content_xml|>", "end_message": "<|end_message|>", "endoftext": "<|endoftext|>", "eos_token": "<|content_model_end_sampling|>", "fix_mistral_regex": false, "is_local": true, "local_files_only": true, "message_model": "<|message_model|>", "message_system": "<|message_system|>", "message_tool": "<|message_tool|>", "message_user": "<|message_user|>", "model_max_length": 1048576, "model_specific_special_tokens": { "begin_of_text": "<|begin_of_text|>", "content_image": "<|content_image|>", "content_invoke_tool_json": "<|content_invoke_tool_json|>", "content_invoke_tool_text": "<|content_invoke_tool_text|>", "content_model_end_sampling": "<|content_model_end_sampling|>", "content_text": "<|content_text|>", "content_thinking": "<|content_thinking|>", "content_tool_error": "<|content_tool_error|>", "content_xml": "<|content_xml|>", "end_message": "<|end_message|>", "endoftext": "<|endoftext|>", "message_model": "<|message_model|>", "message_system": "<|message_system|>", "message_tool": "<|message_tool|>", "message_user": "<|message_user|>" }, "pad_token": "<|endoftext|>", "processor_class": "Inkling2Processor", "response_template": { "defaults": { "role": "assistant" }, "fields": { "content": { "close": "<|end_message|>", "content": "text", "content_args": { "strip": false }, "join": "", "open_pattern": "(?:<\\|message_model\\|>[^<]*)?<\\|content_(?:text|tool_error|invoke_tool_text)\\|>", "repeats": true }, "reasoning_content": { "close": "<|end_message|>", "content": "text", "content_args": { "strip": false }, "join": "", "open_pattern": "(?:<\\|message_model\\|>[^<]*)?<\\|content_thinking\\|>", "repeats": true }, "tool_calls": { "close": "<|end_message|>", "content": "json", "open_pattern": "(?:<\\|message_model\\|>[^<]*)?<\\|content_invoke_tool_json\\|>", "repeats": true, "transform": { "function": { "arguments": "{content.args}", "name": "{content.name}" }, "type": "function" } } }, "start_anchor_pattern": "<\\|end_message\\|>|<\\|content_model_end_sampling\\|>" }, "tokenizer_class": "TokenizersBackend", "chat_template": "{%- set effort_map = {\"none\": 0.0, \"minimal\": 0.1, \"low\": 0.2, \"medium\": 0.7, \"high\": 0.9, \"xhigh\": 0.99, \"max\": 0.99} -%}\n{%- set role_token = {\"user\": \"<|message_user|>\", \"assistant\": \"<|message_model|>\", \"system\": \"<|message_system|>\", \"tool\": \"<|message_tool|>\"} -%}\n\n{%- macro emit_thinking_effort() -%}\n {%- set eff = reasoning_effort if reasoning_effort is defined and reasoning_effort is not none else 0.9 -%}\n {%- if eff is string -%}\n {%- set key = eff | trim -%}\n {%- if key not in effort_map -%}\n {{- raise_exception(\"Unknown reasoning_effort: \" ~ eff) -}}\n {%- endif -%}\n {%- set num = effort_map[key] -%}\n {%- else -%}\n {%- set num = eff | float -%}\n {%- endif -%}\n {%- if num < 0.0 or num > 0.99 -%}\n {{- raise_exception(\"reasoning_effort must be in [0.0, 0.99]\") -}}\n {%- endif -%}\n {{- \"<|message_system|><|content_text|>Thinking effort level: \" -}}\n {%- if num == 0.0 -%}0{%- else -%}{{ num }}{%- endif -%}\n {{- \"<|end_message|>\" -}}\n{%- endmacro -%}\n\n{%- if tools -%}\n {%- set tool_state = namespace(specs=[]) -%}\n {%- for tool in tools -%}\n {%- set fn = tool.function if tool.function is defined else tool -%}\n {%- set spec = {\n \"description\": (fn.description if fn.description is defined and fn.description else \"\"),\n \"name\": fn.name,\n \"parameters\": (fn.parameters if fn.parameters is defined and fn.parameters else {}),\n \"type\": (tool.type if tool.type is defined and tool.type else \"function\"),\n } -%}\n {%- set tool_state.specs = tool_state.specs + [spec] -%}\n {%- endfor -%}\n {{- \"<|message_system|>tool_declare<|content_xml|>\" -}}\n {{- tool_state.specs | tojson(sort_keys=true, separators=(\",\", \":\")) -}}\n {{- \"<|end_message|>\" -}}\n{%- endif -%}\n\n{%- set state = namespace(effort_emitted=false) -%}\n{%- for message in messages -%}\n {%- if message.role not in role_token -%}\n {{- raise_exception(\"Unknown message role: \" ~ message.role) -}}\n {%- endif -%}\n {%- if not state.effort_emitted and message.role != \"system\" -%}\n {{- emit_thinking_effort() -}}\n {%- set state.effort_emitted = true -%}\n {%- endif -%}\n\n {%- set header = namespace(text=role_token[message.role]) -%}\n {%- if message.role == \"tool\" -%}\n {%- if message.name is defined and message.name -%}\n {%- set header.text = header.text ~ message.name -%}\n {%- elif message.tool_call_id is defined and message.tool_call_id -%}\n {%- for prev in messages -%}\n {%- if prev.role == \"assistant\" and prev.tool_calls -%}\n {%- for tc in prev.tool_calls -%}\n {%- if tc.id is defined and tc.id == message.tool_call_id and tc.function.name is defined -%}\n {%- set header.text = header.text ~ tc.function.name -%}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n {%- elif message.role == \"assistant\" and message.name is defined and message.name -%}\n {%- set header.text = header.text ~ message.name -%}\n {%- endif -%}\n {%- set rtok = header.text -%}\n {%- set rendered -%}\n\n {%- if message.role == \"assistant\" and message.reasoning_content is defined and message.reasoning_content -%}\n {{- rtok ~ \"<|content_thinking|>\" ~ message.reasoning_content ~ \"<|end_message|>\" -}}\n {%- endif -%}\n\n {%- if message.content is string and (message.content or not (message.role == \"assistant\" and (message.tool_calls or message.reasoning_content))) -%}\n {{- rtok ~ \"<|content_text|>\" ~ message.content ~ \"<|end_message|>\" -}}\n {%- elif message.content -%}\n {%- for part in message.content -%}\n {%- if part is string -%}\n {{- rtok ~ \"<|content_text|>\" ~ part ~ \"<|end_message|>\" -}}\n {%- elif part.type is not defined or part.type in (\"text\", \"input_text\") -%}\n {%- set text_part = (part.text if part.text is defined and part.text is string else \"\") -%}\n {{- rtok ~ \"<|content_text|>\" ~ text_part ~ \"<|end_message|>\" -}}\n {%- elif part.type in (\"image\", \"input_image\", \"image_url\") -%}\n {%- if message.role not in (\"user\", \"tool\") -%}\n {{- raise_exception(\"Image content is only supported for user and tool messages\") -}}\n {%- endif -%}\n {{- rtok ~ \"<|content_image|><|unused_200054|><|end_message|>\" -}}\n {%- elif part.type in (\"audio\", \"input_audio\", \"audio_url\") -%}\n {{- raise_exception(\"Inkling 2 does not accept audio input\") -}}\n {%- else -%}\n {{- raise_exception(\"Unsupported content part type: \" ~ part.type) -}}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n\n {%- if message.role == \"assistant\" and message.tool_calls -%}\n {%- for tc in message.tool_calls -%}\n {%- set fn = tc.function -%}\n {%- if fn.name is not defined or fn.name is not string -%}\n {{- raise_exception(\"tool call function name must be a string\") -}}\n {%- endif -%}\n {%- if message.name is defined and message.name and message.name != fn.name -%}\n {{- raise_exception(\"assistant name \" ~ message.name ~ \" does not match its tool call \" ~ fn.name) -}}\n {%- endif -%}\n {%- set args = fn.arguments if fn.arguments is defined and fn.arguments else {} -%}\n {%- if args is string -%}\n {{- raise_exception(\"tool call arguments must be a parsed object, not a JSON string; canonicalize upstream\") -}}\n {%- endif -%}\n {%- if args is not mapping -%}\n {{- raise_exception(\"tool call arguments must be an object\") -}}\n {%- endif -%}\n {{- \"<|message_model|>\" ~ fn.name ~ \"<|content_invoke_tool_json|>\" -}}\n {{- '{\"name\":' ~ (fn.name | tojson(sort_keys=true, separators=(\",\", \":\"))) ~ ',\"args\":' -}}\n {{- \"{\" -}}\n {%- for key, value in args | dictsort(case_sensitive=true) -%}\n {{- (key | tojson) ~ \":\" ~ (value | tojson(separators=(\",\", \":\"))) -}}\n {%- if not loop.last -%},{%- endif -%}\n {%- endfor -%}\n {{- \"}}<|end_message|>\" -}}\n {%- endfor -%}\n {%- endif -%}\n\n {%- if message.role == \"assistant\" -%}\n {{- \"<|content_model_end_sampling|>\" -}}\n {%- endif -%}\n {%- endset -%}\n {%- if message.role == \"assistant\" -%}\n {%- generation -%}{{- rendered -}}{%- endgeneration -%}\n {%- else -%}\n {{- rendered -}}\n {%- endif -%}\n{%- endfor -%}\n\n{%- if not state.effort_emitted -%}\n {{- emit_thinking_effort() -}}\n{%- endif -%}\n" }