| { | |
| "add_bos_token": false, | |
| "add_eos_token": false, | |
| "bos_token": "<|begin_of_text|>", | |
| "eos_token": "<|end_of_text|>", | |
| "pad_token": "<|padding|>", | |
| "unk_token": "<|unknown|>", | |
| "model_max_length": 2048, | |
| "clean_up_tokenization_spaces": false, | |
| "tokenizer_class": "PreTrainedTokenizerFast", | |
| "chat_template": "{%- set ns = namespace(xml_tools=none, tools_emitted=false) -%}\n{%- if xml_tools is defined and xml_tools -%}\n{%- set ns.xml_tools = xml_tools -%}\n{%- elif tools is defined and tools -%}\n{%- set ns.xml_tools = tools -%}\n{%- endif -%}\n{%- set tools_preamble = 'You may call one or more functions to assist with the user query.\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\\n' -%}\n{%- set tools_epilogue = '</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>' -%}\n{%- for message in messages -%}\n{%- if loop.first -%}{{- bos_token -}}{%- endif -%}\n{%- if loop.first and ns.xml_tools and message['role'] != 'system' -%}\n{{- '<|im_start|>system\\n' + tools_preamble -}}\n{%- for tool in ns.xml_tools -%}\n{%- if tool is string -%}{{- (tool | replace('<tools>', '') | replace('</tools>', '') | trim) + '\\n' -}}\n{%- else -%}{{- tool | tojson + '\\n' -}}\n{%- endif -%}\n{%- endfor -%}\n{{- tools_epilogue + '<|im_end|>\\n' -}}\n{%- set ns.tools_emitted = true -%}\n{%- endif -%}\n{%- set raw_role = message['role'] -%}\n{%- set role = 'user' if raw_role == 'tool' or raw_role == 'function' else raw_role -%}\n{%- set content_text = namespace(value='') -%}\n{%- if message['content'] is string -%}\n{%- set content_text.value = message['content'] -%}\n{%- elif message['content'] is iterable -%}\n{%- for item in message['content'] -%}\n{%- if item['type'] == 'text' -%}{%- set content_text.value = content_text.value + item['text'] -%}{%- endif -%}\n{%- endfor -%}\n{%- endif -%}\n{%- set is_tool = raw_role == 'tool' or raw_role == 'function' -%}\n{%- set prev_is_tool = loop.previtem is defined and (loop.previtem['role'] == 'tool' or loop.previtem['role'] == 'function') -%}\n{%- set next_is_tool = loop.nextitem is defined and (loop.nextitem['role'] == 'tool' or loop.nextitem['role'] == 'function') -%}\n{%- if raw_role == 'system' and not (content_text.value | trim) and not (ns.xml_tools and not ns.tools_emitted) -%}\n{%- else -%}\n{%- if is_tool and prev_is_tool -%}\n{{- '\\n' -}}\n{%- else -%}\n{{- '<|im_start|>' + role + '\\n' -}}\n{%- endif -%}\n{%- if raw_role == 'assistant' and enable_thinking is defined -%}\n{{- ('<|think|>\\n' if enable_thinking else '<|no_think|>\\n') -}}\n{%- endif -%}\n{%- if is_tool -%}\n{{- '<|tool_response|>\\n' + (content_text.value | replace('<tool_response>', '') | replace('</tool_response>', '') | trim) -}}\n{%- elif raw_role == 'system' -%}\n{{- content_text.value | replace('/system_override', '') | replace('/no_think', '') | replace('/think', '') | trim -}}\n{%- else -%}\n{{- content_text.value -}}\n{%- endif -%}\n{%- if raw_role == 'system' and ns.xml_tools and not ns.tools_emitted and '<tools>' not in content_text.value -%}\n{%- if content_text.value | trim -%}{{- '\\n\\n' -}}{%- endif -%}\n{{- tools_preamble -}}\n{%- for tool in ns.xml_tools -%}\n{%- if tool is string -%}{{- (tool | replace('<tools>', '') | replace('</tools>', '') | trim) + '\\n' -}}\n{%- else -%}{{- tool | tojson + '\\n' -}}\n{%- endif -%}\n{%- endfor -%}\n{{- tools_epilogue -}}\n{%- set ns.tools_emitted = true -%}\n{%- endif -%}\n{%- if raw_role == 'assistant' and message['tool_calls'] is defined and message['tool_calls'] -%}\n{%- if '<tool_call>' not in content_text.value -%}\n{%- for tool_call in message['tool_calls'] -%}\n{%- set fn = tool_call['function'] if tool_call['function'] is defined else tool_call -%}\n{%- if loop.first and not (content_text.value | trim) -%}\n{{- '<tool_call>\\n{\"name\": \"' + fn['name'] + '\", \"arguments\": ' -}}\n{%- else -%}\n{{- '\\n<tool_call>\\n{\"name\": \"' + fn['name'] + '\", \"arguments\": ' -}}\n{%- endif -%}\n{%- if fn['arguments'] is string -%}{{- fn['arguments'] -}}\n{%- else -%}{{- fn['arguments'] | tojson -}}\n{%- endif -%}\n{{- '}\\n</tool_call>' -}}\n{%- endfor -%}\n{%- endif -%}\n{%- endif -%}\n{%- if not (is_tool and next_is_tool) -%}\n{{- '<|im_end|>\\n' -}}\n{%- endif -%}\n{%- endif -%}\n{%- endfor -%}\n{%- if add_generation_prompt -%}\n{{- '<|im_start|>assistant\\n' -}}\n{%- if enable_thinking is defined -%}{{- ('<|think|>\\n' if enable_thinking else '<|no_think|>\\n') -}}{%- endif -%}\n{%- endif -%}", | |
| "extra_special_tokens": [ | |
| "<|im_start|>", | |
| "<|im_end|>", | |
| "<|tool_call|>", | |
| "<|tool_response|>", | |
| "<think>", | |
| "</think>", | |
| "<|fim_prefix|>", | |
| "<|fim_middle|>", | |
| "<|fim_suffix|>", | |
| "<|fim_pad|>", | |
| "<|no_think|>", | |
| "<|think|>", | |
| "<|reserved_002|>", | |
| "<|reserved_003|>", | |
| "<|reserved_004|>", | |
| "<|reserved_005|>", | |
| "<|reserved_006|>", | |
| "<|reserved_007|>", | |
| "<|reserved_008|>", | |
| "<|reserved_009|>", | |
| "<|reserved_010|>", | |
| "<|reserved_011|>", | |
| "<|reserved_012|>", | |
| "<|reserved_013|>", | |
| "<|reserved_014|>", | |
| "<|reserved_015|>", | |
| "<|reserved_016|>", | |
| "<|reserved_017|>", | |
| "<|reserved_018|>", | |
| "<|reserved_019|>", | |
| "<|reserved_020|>", | |
| "<|reserved_021|>", | |
| "<|reserved_022|>", | |
| "<|reserved_023|>", | |
| "<|reserved_024|>", | |
| "<|reserved_025|>", | |
| "<|reserved_026|>", | |
| "<|reserved_027|>", | |
| "<|reserved_028|>", | |
| "<|reserved_029|>", | |
| "<|reserved_030|>", | |
| "<|reserved_031|>", | |
| "<|reserved_032|>", | |
| "<|reserved_033|>", | |
| "<|reserved_034|>", | |
| "<|reserved_035|>", | |
| "<|reserved_036|>", | |
| "<|reserved_037|>", | |
| "<|reserved_038|>", | |
| "<|reserved_039|>", | |
| "<|reserved_040|>", | |
| "<|reserved_041|>", | |
| "<|reserved_042|>", | |
| "<|reserved_043|>", | |
| "<|reserved_044|>", | |
| "<|reserved_045|>", | |
| "<|reserved_046|>", | |
| "<|reserved_047|>", | |
| "<|reserved_048|>", | |
| "<|reserved_049|>" | |
| ] | |
| } | |