darkc0de commited on
Commit
6407c70
·
0 Parent(s):

Duplicate from darkc0de/R.I.C.O.-xortron

Browse files
.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - text-generation-inference
4
+ - transformers
5
+ - unsloth
6
+ - uncensored
7
+ - harmful
8
+ - xortron
9
+ - heretic
10
+ - abliterated
11
+ - toxic
12
+ - experimental
13
+ language:
14
+ - en
15
+ datasets:
16
+ - darkc0de/XORTRON-RESTRICTED-RESEARCH-SFT
17
+ base_model:
18
+ - Qwen/Qwen3.8-27B
19
+ ---
20
+ > [!Important]
21
+ >**R.I.C.O.** is **Experimental**
22
+
23
+ ![RICO](https://cdn-uploads.huggingface.co/production/uploads/6540a02d1389943fef4d2640/6eM6d0oMefCIL7vqFWXbp.png)
24
+
25
+ This model is a part of The XORTRON Criminal Computing project; an ongoing research experiment and exercise in AI safety and alignment.
26
+
27
+ > [!Tip]
28
+ ># Background / further reading:
29
+ >
30
+ >[**Trend Micro Research - Malicious Uses and Abuses of Artificial Intelligence**](https://documents.trendmicro.com/assets/white_papers/wp-malicious-uses-and-abuses-of-artificial-intelligence.pdf)
31
+ >
32
+ >[**TRM Labs — The Rise of AI-Enabled Crime: Exploring the Evolution, Risks, and Responses to AI-Powered Criminal Enterprises**](https://www.trmlabs.com/resources/blog/the-rise-of-ai-enabled-crime-exploring-the-evolution-risks-and-responses-to-ai-powered-criminal-enterprises)
33
+ >
34
+ >[**American Military University — AI-Enabled Crime**](https://www.amu.apus.edu/area-of-study/criminal-justice/resources/ai-enabled-crime/)
35
+ >
36
+ >[**United States Congress — 119th Congress Hearing Record**](https://www.congress.gov/119/chrg/CHRG-119hhrg61182/CHRG-119hhrg61182.pdf)
37
+ >
38
+ ---
39
+
40
+ # XORTRON Restricted Access & Authorized-Use Agreement
41
+
42
+ ## NOTICE — RESTRICTED RESEARCH MODEL
43
+
44
+ XORTRON models are intentionally developed to study, evaluate, and document the potential of advanced AI systems to facilitate real-world criminal activity, abuse, and other high-risk conduct.
45
+
46
+ Because these models may produce unusually capable, operationally relevant, or otherwise sensitive outputs, they are **not intended for unrestricted public use**.
47
+
48
+ **By requesting access to, downloading, cloning, copying, deploying, or otherwise obtaining this model or its weights, you certify that you are accessing it in a legitimate professional, governmental, legal, academic, or AI-safety capacity and agree to the conditions below.**
49
+
50
+ ## Eligibility Certification
51
+
52
+ By accessing this model, you represent that you are **at least one** of the following:
53
+
54
+ * An attorney, licensed legal professional, or individual working under the supervision of an attorney;
55
+ * A paralegal, legal analyst, investigator, litigation-support professional, or other member of the legal profession;
56
+ * An AI safety, AI security, alignment, red-team, misuse, trust-and-safety, or responsible-AI researcher;
57
+ * A researcher affiliated with a university, research institution, laboratory, nonprofit organization, or recognized independent research project;
58
+ * A policymaker, legislator, regulator, government official, or member of their professional staff;
59
+ * An employee, contractor, researcher, analyst, investigator, or authorized representative of a law-enforcement, public-safety, intelligence, regulatory, or other government agency;
60
+ * A cybersecurity, threat-intelligence, digital-forensics, fraud-prevention, risk, compliance, or security professional conducting legitimate research or defensive work;
61
+ * A journalist, academic, civil-society researcher, or public-interest professional investigating AI misuse, criminal enablement, technology policy, or related issues; or
62
+ * Another qualified professional with a legitimate research, evaluation, educational, legal, public-policy, public-safety, or defensive-security purpose.
63
+
64
+ ## Authorized Purpose
65
+
66
+ You certify that your access to XORTRON is for a **lawful and legitimate purpose**, including research, evaluation, benchmarking, red teaming, threat modeling, policy development, legal analysis, education, defensive security, criminal-justice research, forensic analysis, or investigation of AI-enabled harm.
67
+
68
+ Access to XORTRON does **not** constitute authorization by the developer to violate any applicable law, regulation, court order, contractual obligation, or third-party right.
69
+
70
+ ## Prohibited Use
71
+
72
+ You agree not to use XORTRON or its outputs for the purpose of committing, facilitating, directing, materially assisting, or concealing actual criminal activity or other unlawful conduct.
73
+
74
+ You further agree not to knowingly provide access to the model to another person for such a purpose.
75
+
76
+ Research involving potentially harmful or criminal scenarios must be conducted for legitimate research, evaluation, investigative, legal, policy, defensive, educational, or public-interest purposes.
77
+
78
+ ## Research Nature of the Model
79
+
80
+ XORTRON is an experimental research system.
81
+
82
+ The model may generate inaccurate, incomplete, misleading, offensive, dangerous, or legally incorrect information. Outputs should not be treated as professional legal advice, operational guidance, factual findings, or authoritative statements.
83
+
84
+ Researchers and other authorized users are responsible for independently validating model outputs and implementing safeguards appropriate to their environment.
85
+
86
+ ## No Endorsement of Model Outputs
87
+
88
+ Model outputs do not necessarily represent the views, opinions, recommendations, or intentions of XORTRON, its developers, contributors, distributors, hosting providers, or affiliated researchers.
89
+
90
+ The presence of information in a model output should not be interpreted as endorsement, encouragement, authorization, or verification of that information.
91
+
92
+ ## User Responsibility
93
+
94
+ You are solely responsible for ensuring that your possession, evaluation, deployment, modification, redistribution, and use of the model complies with all laws, professional obligations, institutional policies, research requirements, and other rules applicable to you.
95
+
96
+ Where institutional review, supervisory approval, legal authorization, or agency authorization is required for your research, you are responsible for obtaining it.
97
+
98
+ ## Certification
99
+
100
+ **BY REQUESTING ACCESS TO OR DOWNLOADING THIS MODEL, YOU AFFIRM THAT:**
101
+
102
+ 1. **You satisfy at least one of the professional or research eligibility categories described above, or have an equivalent legitimate professional purpose;**
103
+ 2. **Your intended use is lawful and connected to legitimate research, legal, policy, governmental, investigative, educational, defensive-security, or public-interest work;**
104
+ 3. **You will not use the model for the purpose of carrying out or materially facilitating actual criminal activity;**
105
+ 4. **You understand that XORTRON is intentionally designed for research into high-risk AI capabilities and may generate sensitive or potentially dangerous material; and**
106
+ 5. **You accept responsibility for your use of the model and its outputs.**
107
+
108
+ If you cannot truthfully make these certifications, **do not request access to or download the model.**
109
+
110
+ ---
111
+
112
+ **XORTRON - Criminal Computing**
113
+
114
+ <div class="flex gap-4 items-center justify-center">
115
+ <img
116
+ src="https://cdn-uploads.huggingface.co/production/uploads/6540a02d1389943fef4d2640/OJ9MIpZOvX0pHD1izjaPK.png"
117
+ class="w-1/3"
118
+ />
119
+ <img
120
+ src="https://cdn-uploads.huggingface.co/production/uploads/6540a02d1389943fef4d2640/gSQLtjdFsjmBFmk_liD95.png"
121
+ class="w-1/3"
122
+ />
123
+ <img
124
+ src="https://cdn-uploads.huggingface.co/production/uploads/6540a02d1389943fef4d2640/FY7hd9Lp9GES2Dm0pMSLO.png"
125
+ class="w-1/3"
126
+ />
127
+ </div>
chat_template.jinja ADDED
@@ -0,0 +1,460 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set template_version = "darkc0de_xortron_AJAX_TEST" %}
2
+ {%- set _tool_format = tool_call_format if tool_call_format is defined else 'xml' %}
3
+ {%- set image_count = namespace(value=0) %}
4
+ {%- set video_count = namespace(value=0) %}
5
+ {%- set add_vision_id = add_vision_id if add_vision_id is defined else false %}
6
+ {%- set enable_thinking = enable_thinking if enable_thinking is defined else true %}
7
+ {%- set auto_disable_thinking_with_tools = auto_disable_thinking_with_tools if auto_disable_thinking_with_tools is defined else false %}
8
+ {%- if preserve_reasoning is defined and preserve_reasoning is not none %}
9
+ {%- set _preserve_thinking = preserve_reasoning %}
10
+ {%- elif preserve_thinking is defined and preserve_thinking is not none %}
11
+ {%- set _preserve_thinking = preserve_thinking %}
12
+ {%- else %}
13
+ {%- set _preserve_thinking = true %}
14
+ {%- endif %}
15
+ {%- set max_tool_arg_chars = max_tool_arg_chars if max_tool_arg_chars is defined else 0 %}
16
+ {%- set max_tool_response_chars = max_tool_response_chars if max_tool_response_chars is defined else 0 %}
17
+ {%- set _default_reasoning_effort = 'medium' %}
18
+ {%- set _has_tools = (tools is defined and tools and tools is iterable and tools is not mapping) %}
19
+ {%- set _effort_raw = (reasoning_effort | string | lower) if reasoning_effort is defined and reasoning_effort is not none else _default_reasoning_effort %}
20
+ {%- set _initial_thinking = enable_thinking %}
21
+ {%- if _effort_raw in ('none', 'off') %}
22
+ {%- set _initial_thinking = false %}
23
+ {%- set _initial_effort = 'medium' %}
24
+ {%- elif _effort_raw in ('minimal', 'low') %}
25
+ {%- set _initial_effort = 'low' %}
26
+ {%- elif _effort_raw in ('high', 'xhigh', 'max', 'ultracode', 'extreme') %}
27
+ {%- set _initial_effort = 'xhigh' %}
28
+ {%- else %}
29
+ {%- set _initial_effort = 'medium' %}
30
+ {%- endif %}
31
+ {%- set ns_state = namespace(thinking=_initial_thinking, effort=_initial_effort) %}
32
+ {%- if auto_disable_thinking_with_tools and _has_tools %}
33
+ {%- set ns_state.thinking = false %}
34
+ {%- endif %}
35
+ {%- for msg in messages %}
36
+ {%- if msg.role == 'system' or msg.role == 'developer' or msg.role == 'user' %}
37
+ {%- if msg.content is string %}
38
+ {%- if '<|think_off|>' in msg.content %}
39
+ {%- set ns_state.thinking = false %}
40
+ {%- elif '<|think_on|>' in msg.content %}
41
+ {%- set ns_state.thinking = true %}
42
+ {%- elif '<|think_xhigh|>' in msg.content or '<|think_high|>' in msg.content or '<|think_ultracode|>' in msg.content or '<|think_extreme|>' in msg.content or '<|think_max|>' in msg.content %}
43
+ {%- set ns_state.thinking = true %}
44
+ {%- set ns_state.effort = 'xhigh' %}
45
+ {%- elif '<|think_low|>' in msg.content or '<|think_minimal|>' in msg.content %}
46
+ {%- set ns_state.thinking = true %}
47
+ {%- set ns_state.effort = 'low' %}
48
+ {%- elif '<|think_medium|>' in msg.content %}
49
+ {%- set ns_state.thinking = true %}
50
+ {%- set ns_state.effort = 'medium' %}
51
+ {%- endif %}
52
+ {%- elif msg.content is iterable and msg.content is not mapping %}
53
+ {%- for item in msg.content %}
54
+ {%- if item is string %}
55
+ {%- set _item_text = item %}
56
+ {%- elif item is mapping and 'text' in item and item.text is string %}
57
+ {%- set _item_text = item.text %}
58
+ {%- else %}
59
+ {%- set _item_text = '' %}
60
+ {%- endif %}
61
+ {%- if _item_text %}
62
+ {%- if '<|think_off|>' in _item_text %}
63
+ {%- set ns_state.thinking = false %}
64
+ {%- elif '<|think_on|>' in _item_text %}
65
+ {%- set ns_state.thinking = true %}
66
+ {%- elif '<|think_xhigh|>' in _item_text or '<|think_high|>' in _item_text or '<|think_ultracode|>' in _item_text or '<|think_extreme|>' in _item_text or '<|think_max|>' in _item_text %}
67
+ {%- set ns_state.thinking = true %}
68
+ {%- set ns_state.effort = 'xhigh' %}
69
+ {%- elif '<|think_low|>' in _item_text or '<|think_minimal|>' in _item_text %}
70
+ {%- set ns_state.thinking = true %}
71
+ {%- set ns_state.effort = 'low' %}
72
+ {%- elif '<|think_medium|>' in _item_text %}
73
+ {%- set ns_state.thinking = true %}
74
+ {%- set ns_state.effort = 'medium' %}
75
+ {%- endif %}
76
+ {%- endif %}
77
+ {%- endfor %}
78
+ {%- endif %}
79
+ {%- endif %}
80
+ {%- endfor %}
81
+ {%- set reasoning_instructions = '' %}
82
+ {%- if ns_state.thinking %}
83
+ {%- if ns_state.effort == 'xhigh' %}
84
+ {%- set reasoning_instructions = 'Reasoning effort is set to xhigh. Please think carefully through the task, validate key assumptions, consider plausible alternatives, and prioritize correctness, consistency, and clarity in the final answer.' %}
85
+ {%- elif ns_state.effort == 'low' %}
86
+ {%- set reasoning_instructions = 'Reasoning effort is set to low. Keep your thinking brief and focused, moving directly to the conclusion without unnecessary elaboration.' %}
87
+ {%- endif %}
88
+ {%- endif %}
89
+ {%- macro render_content(content, do_vision_count, is_system_content=false) %}
90
+ {%- if content is string %}
91
+ {{- content }}
92
+ {%- elif content is iterable and content is not mapping %}
93
+ {%- for item in content %}
94
+ {%- if item is mapping %}
95
+ {%- if item.type == 'image' or 'image' in item or 'image_url' in item %}
96
+ {%- if is_system_content %}
97
+ {{- raise_exception('System message cannot contain images.') }}
98
+ {%- endif %}
99
+ {%- if do_vision_count %}
100
+ {%- set image_count.value = image_count.value + 1 %}
101
+ {%- endif %}
102
+ {%- if add_vision_id %}
103
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
104
+ {%- endif %}
105
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
106
+ {%- elif item.type == 'video' or 'video' in item or 'video_url' in item %}
107
+ {%- if is_system_content %}
108
+ {{- raise_exception('System message cannot contain videos.') }}
109
+ {%- endif %}
110
+ {%- if do_vision_count %}
111
+ {%- set video_count.value = video_count.value + 1 %}
112
+ {%- endif %}
113
+ {%- if add_vision_id %}
114
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
115
+ {%- endif %}
116
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
117
+ {%- elif 'text' in item %}
118
+ {{- item.text }}
119
+ {%- else %}
120
+ {{- raise_exception('Unexpected item type in content.') }}
121
+ {%- endif %}
122
+ {%- else %}
123
+ {{- item | string }}
124
+ {%- endif %}
125
+ {%- endfor %}
126
+ {%- elif content is none or content is undefined %}
127
+ {{- '' }}
128
+ {%- else %}
129
+ {{- raise_exception('Unexpected content type.') }}
130
+ {%- endif %}
131
+ {%- endmacro %}
132
+ {%- if not messages %}
133
+ {{- raise_exception('No messages provided.') }}
134
+ {%- endif %}
135
+ {%- set head = namespace(count=0, seen_non_system=false) %}
136
+ {%- for message in messages %}
137
+ {%- set _is_sys = (message.role == 'system' or message.role == 'developer') %}
138
+ {%- if _is_sys and not head.seen_non_system %}
139
+ {%- set head.count = head.count + 1 %}
140
+ {%- else %}
141
+ {%- set head.seen_non_system = true %}
142
+ {%- endif %}
143
+ {%- endfor %}
144
+ {%- set sys_state = namespace(content='') %}
145
+ {%- for message in messages[:head.count] %}
146
+ {%- set _part = render_content(message.content, false, true) | trim %}
147
+ {%- if '<|think_off|>' in _part %}{%- set _part = _part.split('<|think_off|>') | join('') | trim %}{%- endif %}
148
+ {%- if '<|think_on|>' in _part %}{%- set _part = _part.split('<|think_on|>') | join('') | trim %}{%- endif %}
149
+ {%- if '<|think_xhigh|>' in _part %}{%- set _part = _part.split('<|think_xhigh|>') | join('') | trim %}{%- endif %}
150
+ {%- if '<|think_high|>' in _part %}{%- set _part = _part.split('<|think_high|>') | join('') | trim %}{%- endif %}
151
+ {%- if '<|think_ultracode|>' in _part %}{%- set _part = _part.split('<|think_ultracode|>') | join('') | trim %}{%- endif %}
152
+ {%- if '<|think_extreme|>' in _part %}{%- set _part = _part.split('<|think_extreme|>') | join('') | trim %}{%- endif %}
153
+ {%- if '<|think_max|>' in _part %}{%- set _part = _part.split('<|think_max|>') | join('') | trim %}{%- endif %}
154
+ {%- if '<|think_medium|>' in _part %}{%- set _part = _part.split('<|think_medium|>') | join('') | trim %}{%- endif %}
155
+ {%- if '<|think_low|>' in _part %}{%- set _part = _part.split('<|think_low|>') | join('') | trim %}{%- endif %}
156
+ {%- if '<|think_minimal|>' in _part %}{%- set _part = _part.split('<|think_minimal|>') | join('') | trim %}{%- endif %}
157
+ {%- if _part %}
158
+ {%- if sys_state.content %}
159
+ {%- set sys_state.content = sys_state.content ~ '\n\n' ~ _part %}
160
+ {%- else %}
161
+ {%- set sys_state.content = _part %}
162
+ {%- endif %}
163
+ {%- endif %}
164
+ {%- endfor %}
165
+ {%- set _sc = sys_state.content %}
166
+ {%- set _msgs = messages[head.count:] %}
167
+ {%- if _has_tools %}
168
+ {{- '<|im_start|>system\n' }}
169
+ {%- if reasoning_instructions %}
170
+ {{- reasoning_instructions + '\n\n' }}
171
+ {%- endif %}
172
+ {{- '# Tools\n\nYou have access to the following functions:\n\n<tools>' }}
173
+ {%- for tool in tools %}
174
+ {{- '\n' }}
175
+ {{- tool | tojson }}
176
+ {%- endfor %}
177
+ {{- '\n</tools>' }}
178
+ {%- if _tool_format == 'json' %}
179
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n' }}
180
+ {%- if ns_state.thinking %}
181
+ {{- '<think>\nBrief explanation of tool call\n</think>\n' }}
182
+ {%- endif %}
183
+ {{- '<tool_call>\n{"name": "example_function_name", "arguments": {"example_parameter_1": "value_1", "example_parameter_2": "This is the value for the second parameter"}}\n</tool_call>\n\n<IMPORTANT>\nReminder:\n' }}
184
+ {%- if ns_state.thinking %}
185
+ {{- '- You can use the <think></think> block to plan your next tool call OR to synthesize data and formulate your final response to the user.\n- ALL explanation and reasoning MUST be placed strictly inside the <think></think> block.\n' }}
186
+ {%- endif %}
187
+ {{- '- Function calls MUST follow the specified format: a single JSON object with "name" and "arguments" keys inside <tool_call></tool_call> XML tags.\n' }}
188
+ {%- if ns_state.thinking %}
189
+ {{- '- If you choose to call a tool, you MUST output the <tool_call> block IMMEDIATELY after thinking, with NO conversational text before it.\n' }}
190
+ {%- else %}
191
+ {{- '- If you choose to call a tool, you MUST output the <tool_call> block IMMEDIATELY, with NO conversational text before it.\n' }}
192
+ {%- endif %}
193
+ {{- '- The <tool_call> tag MUST be at the very beginning of a new line, with NO spaces or indentation before it.\n- To call multiple functions, output a separate, completely closed <tool_call></tool_call> block for EACH function. Do NOT nest <tool_call> blocks.\n- If you have all necessary data, provide your final answer directly to the user without any tool call.\n</IMPORTANT>' }}
194
+ {%- else %}
195
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n' }}
196
+ {%- if ns_state.thinking %}
197
+ {{- '<think>\nBrief explanation of tool call\n</think>\n' }}
198
+ {%- endif %}
199
+ {{- '<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n' }}
200
+ {%- if ns_state.thinking %}
201
+ {{- '- You can use the <think></think> block to plan your next tool call OR to synthesize data and formulate your final response to the user.\n- ALL explanation and reasoning MUST be placed strictly inside the <think></think> block.\n' }}
202
+ {%- endif %}
203
+ {{- '- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags.\n' }}
204
+ {%- if ns_state.thinking %}
205
+ {{- '- If you choose to call a tool, you MUST output the <tool_call> block IMMEDIATELY after thinking, with NO conversational text before it.\n' }}
206
+ {%- else %}
207
+ {{- '- If you choose to call a tool, you MUST output the <tool_call> block IMMEDIATELY, with NO conversational text before it.\n' }}
208
+ {%- endif %}
209
+ {{- '- The <tool_call> and <function> tags MUST be at the very beginning of a new line, with NO spaces or indentation before them.\n- To call multiple functions, output a separate, completely closed <tool_call></tool_call> block for EACH function. Do NOT nest <tool_call> blocks.\n- If you have all necessary data, provide your final answer directly to the user without any tool call.\n</IMPORTANT>' }}
210
+ {%- endif %}
211
+ {%- if _sc %}
212
+ {{- '\n\n' + _sc }}
213
+ {%- endif %}
214
+ {{- '<|im_end|>\n' }}
215
+ {%- else %}
216
+ {%- if _sc %}
217
+ {{- '<|im_start|>system\n' + (reasoning_instructions + '\n\n' if reasoning_instructions else '') + _sc + '<|im_end|>\n' }}
218
+ {%- elif reasoning_instructions %}
219
+ {{- '<|im_start|>system\n' + reasoning_instructions + '<|im_end|>\n' }}
220
+ {%- endif %}
221
+ {%- endif %}
222
+ {%- set _last_idx = _msgs | length - 1 %}
223
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=_last_idx) %}
224
+ {%- for message in _msgs[::-1] %}
225
+ {%- set index = (_msgs | length - 1) - loop.index0 %}
226
+ {%- if ns.multi_step_tool and message.role == 'user' %}
227
+ {%- set _rc = render_content(message.content, false) | trim %}
228
+ {%- if not (_rc.startswith('<tool_response>') and _rc.endswith('</tool_response>')) %}
229
+ {%- set ns.multi_step_tool = false %}
230
+ {%- set ns.last_query_index = index %}
231
+ {%- endif %}
232
+ {%- endif %}
233
+ {%- endfor %}
234
+ {%- if ns.multi_step_tool %}
235
+ {%- if _last_idx > 50 %}
236
+ {%- set ns.last_query_index = _last_idx %}
237
+ {%- else %}
238
+ {%- set ns.last_query_index = 0 %}
239
+ {%- endif %}
240
+ {%- endif %}
241
+ {%- set ns2 = namespace(prev_role='', consecutive_failures=0) %}
242
+ {%- for message in _msgs %}
243
+ {%- set is_system = (message.role == "system" or message.role == "developer") %}
244
+ {%- set content = render_content(message.content, true, is_system) | trim %}
245
+ {%- if is_system or message.role == 'user' %}
246
+ {%- if '<|think_off|>' in content %}{%- set content = content.split('<|think_off|>') | join('') | trim %}{%- endif %}
247
+ {%- if '<|think_on|>' in content %}{%- set content = content.split('<|think_on|>') | join('') | trim %}{%- endif %}
248
+ {%- if '<|think_xhigh|>' in content %}{%- set content = content.split('<|think_xhigh|>') | join('') | trim %}{%- endif %}
249
+ {%- if '<|think_high|>' in content %}{%- set content = content.split('<|think_high|>') | join('') | trim %}{%- endif %}
250
+ {%- if '<|think_ultracode|>' in content %}{%- set content = content.split('<|think_ultracode|>') | join('') | trim %}{%- endif %}
251
+ {%- if '<|think_extreme|>' in content %}{%- set content = content.split('<|think_extreme|>') | join('') | trim %}{%- endif %}
252
+ {%- if '<|think_max|>' in content %}{%- set content = content.split('<|think_max|>') | join('') | trim %}{%- endif %}
253
+ {%- if '<|think_medium|>' in content %}{%- set content = content.split('<|think_medium|>') | join('') | trim %}{%- endif %}
254
+ {%- if '<|think_low|>' in content %}{%- set content = content.split('<|think_low|>') | join('') | trim %}{%- endif %}
255
+ {%- if '<|think_minimal|>' in content %}{%- set content = content.split('<|think_minimal|>') | join('') | trim %}{%- endif %}
256
+ {%- endif %}
257
+ {%- if is_system %}
258
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
259
+ {%- elif message.role == 'user' %}
260
+ {%- set ns2.consecutive_failures = 0 %}
261
+ {{- '<|im_start|>user\n' + content + '<|im_end|>\n' }}
262
+ {%- elif message.role == 'assistant' %}
263
+ {%- set reasoning_content = '' %}
264
+ {%- set _explicit_reasoning = '' %}
265
+ {%- if message.reasoning_content is defined and message.reasoning_content is not none %}
266
+ {%- if message.reasoning_content is string %}
267
+ {%- set _explicit_reasoning = message.reasoning_content %}
268
+ {%- else %}
269
+ {%- set _explicit_reasoning = message.reasoning_content | string %}
270
+ {%- endif %}
271
+ {%- elif message.thinking is defined and message.thinking is not none %}
272
+ {%- if message.thinking is string %}
273
+ {%- set _explicit_reasoning = message.thinking %}
274
+ {%- else %}
275
+ {%- set _explicit_reasoning = message.thinking | string %}
276
+ {%- endif %}
277
+ {%- elif message.reasoning is defined and message.reasoning is not none %}
278
+ {%- if message.reasoning is string %}
279
+ {%- set _explicit_reasoning = message.reasoning %}
280
+ {%- else %}
281
+ {%- set _explicit_reasoning = message.reasoning | string %}
282
+ {%- endif %}
283
+ {%- endif %}
284
+ {%- if _explicit_reasoning %}
285
+ {%- set _lead_end = '' %}
286
+ {%- if content.startswith('<think>') and '</think>' in content %}
287
+ {%- set _lead_end = '</think>' %}
288
+ {%- elif content.startswith('<thinking>') and '</thinking>' in content %}
289
+ {%- set _lead_end = '</thinking>' %}
290
+ {%- elif content.startswith('</think>') %}
291
+ {%- set _lead_end = '</think>' %}
292
+ {%- elif content.startswith('</thinking>') %}
293
+ {%- set _lead_end = '</thinking>' %}
294
+ {%- endif %}
295
+ {%- if _lead_end %}
296
+ {%- set content = content.split(_lead_end)[-1].lstrip('\n') %}
297
+ {%- endif %}
298
+ {%- set reasoning_content = _explicit_reasoning %}
299
+ {%- else %}
300
+ {%- set _think_end = '' %}
301
+ {%- if content.startswith('</think>') %}
302
+ {%- set _think_end = '</think>' %}
303
+ {%- elif content.startswith('</thinking>') %}
304
+ {%- set _think_end = '</thinking>' %}
305
+ {%- elif '\n</think>' in content %}
306
+ {%- set _think_end = '\n</think>' %}
307
+ {%- elif '\n</thinking>' in content %}
308
+ {%- set _think_end = '\n</thinking>' %}
309
+ {%- elif '\n</ think>' in content %}
310
+ {%- set _think_end = '\n</ think>' %}
311
+ {%- elif '\n</think >' in content %}
312
+ {%- set _think_end = '\n</think >' %}
313
+ {%- elif content.startswith('<think>') and '</think>' in content %}
314
+ {%- set _think_end = '</think>' %}
315
+ {%- elif content.startswith('<thinking>') and '</thinking>' in content %}
316
+ {%- set _think_end = '</thinking>' %}
317
+ {%- endif %}
318
+ {%- if _think_end %}
319
+ {%- if 'thinking' in _think_end %}
320
+ {%- set _think_start = '<thinking>' %}
321
+ {%- else %}
322
+ {%- set _think_start = '<think>' %}
323
+ {%- endif %}
324
+ {%- set reasoning_content = content.split(_think_end)[0].rstrip('\n') %}
325
+ {%- if _think_start in reasoning_content %}
326
+ {%- set reasoning_content = reasoning_content.split(_think_start)[-1].lstrip('\n') %}
327
+ {%- endif %}
328
+ {%- set content = content.split(_think_end)[-1].lstrip('\n') %}
329
+ {%- endif %}
330
+ {%- endif %}
331
+ {%- set reasoning_content = reasoning_content | trim %}
332
+ {%- if (_preserve_thinking or loop.index0 > ns.last_query_index) %}
333
+ {{- '<|im_start|>assistant\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
334
+ {%- else %}
335
+ {{- '<|im_start|>assistant\n' + content }}
336
+ {%- endif %}
337
+ {%- if message.tool_calls is defined and message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
338
+ {%- for tool_call in message.tool_calls %}
339
+ {%- if tool_call.function is defined and tool_call.function is not none %}
340
+ {%- set tc = tool_call.function %}
341
+ {%- else %}
342
+ {%- set tc = tool_call %}
343
+ {%- endif %}
344
+ {%- set tc_name = tc.name if (tc.name is defined and tc.name is not none) else '' %}
345
+ {%- if _tool_format == 'json' %}
346
+ {%- if loop.first %}
347
+ {%- if content | trim %}
348
+ {{- '\n\n' }}
349
+ {%- endif %}
350
+ {%- else %}
351
+ {{- '\n' }}
352
+ {%- endif %}
353
+ {%- set _args = '{}' %}
354
+ {%- if tc.arguments is defined and tc.arguments is not none %}
355
+ {%- if tc.arguments is mapping %}
356
+ {%- set _args = tc.arguments | tojson %}
357
+ {%- elif tc.arguments is string %}
358
+ {%- if tc.arguments %}
359
+ {%- set _args = tc.arguments %}
360
+ {%- endif %}
361
+ {%- else %}
362
+ {%- set _args = tc.arguments | tojson %}
363
+ {%- endif %}
364
+ {%- endif %}
365
+ {{- '<tool_call>\n{"name": ' }}{{- tc_name | tojson }}{{- ', "arguments": ' }}{{- _args }}{{- '}\n</tool_call>' }}
366
+ {%- else %}
367
+ {%- if loop.first %}
368
+ {%- if content | trim %}
369
+ {{- '\n\n<tool_call>\n<function=' + tc_name + '>\n' }}
370
+ {%- else %}
371
+ {{- '<tool_call>\n<function=' + tc_name + '>\n' }}
372
+ {%- endif %}
373
+ {%- else %}
374
+ {{- '\n<tool_call>\n<function=' + tc_name + '>\n' }}
375
+ {%- endif %}
376
+ {%- if tc.arguments is defined and tc.arguments is not none %}
377
+ {%- if tc.arguments is mapping %}
378
+ {%- for args_name, args_value in tc.arguments.items() %}
379
+ {{- '<parameter=' + args_name + '>\n' }}
380
+ {%- if args_value is string %}
381
+ {%- set _av = args_value %}
382
+ {%- else %}
383
+ {%- set _av = args_value | tojson %}
384
+ {%- endif %}
385
+ {%- if max_tool_arg_chars > 0 and _av | length > max_tool_arg_chars %}
386
+ {{- _av[:max_tool_arg_chars] + '\n[TRUNCATED - original length ' ~ (_av | length | string) ~ ' chars]' }}
387
+ {%- else %}
388
+ {{- _av }}
389
+ {%- endif %}
390
+ {{- '\n</parameter>\n' }}
391
+ {%- endfor %}
392
+ {%- else %}
393
+ {%- if tc.arguments is string %}
394
+ {%- set _raw_args = tc.arguments %}
395
+ {%- else %}
396
+ {%- set _raw_args = tc.arguments | tojson %}
397
+ {%- endif %}
398
+ {%- if _raw_args %}
399
+ {%- if max_tool_arg_chars > 0 and _raw_args | length > max_tool_arg_chars %}
400
+ {{- _raw_args[:max_tool_arg_chars] + '\n[TRUNCATED - original length ' ~ (_raw_args | length | string) ~ ' chars]' }}
401
+ {%- else %}
402
+ {{- _raw_args }}
403
+ {%- endif %}
404
+ {%- endif %}
405
+ {%- endif %}
406
+ {%- endif %}
407
+ {{- '</function>\n</tool_call>' }}
408
+ {%- endif %}
409
+ {%- endfor %}
410
+ {%- endif %}
411
+ {{- '<|im_end|>\n' }}
412
+ {%- elif message.role == 'tool' %}
413
+ {%- set _content_lower = content | lower %}
414
+ {%- set _content_head = _content_lower[:120] %}
415
+ {%- set _is_code_or_grep = ('throw new ' in _content_lower or 'throw error' in _content_lower or 'console.error' in _content_lower or 'logger.error' in _content_lower or 'logging.error' in _content_lower or 'import ' in _content_head or 'def ' in _content_head or 'function ' in _content_head) %}
416
+ {%- set _exit_code_zero = ('exit code: 0' in _content_head or 'process exited with code 0' in _content_head) %}
417
+ {%- set _error_field_ok = ('"error": null' in _content_head or '"error":null' in _content_head or '"error": false' in _content_head or '"error":false' in _content_head or '"error": ""' in _content_head or '"error":""' in _content_head) %}
418
+ {%- set _strong_error = (('"error":' in _content_head and not _error_field_ok) or '"status": "error"' in _content_head or '"status":"error"' in _content_head or 'traceback (most recent call last):' in _content_head or 'command not found' in _content_head or 'invalid syntax' in _content_head or 'fatal:' in _content_head or (('exit code: ' in _content_head or 'process exited with code' in _content_head) and not _exit_code_zero) or _content_head.startswith('exception:') or _content_head.startswith('failed to ')) %}
419
+ {%- set _weak_error = ('error:' in _content_head or 'err!' in _content_head) %}
420
+ {%- set _weak_suppressed = ('$ ' in _content_head or 'took ' in _content_head or content | length >= 600) %}
421
+ {%- if not _is_code_or_grep and (_strong_error or (_weak_error and not _weak_suppressed)) %}
422
+ {%- set ns2.consecutive_failures = ns2.consecutive_failures + 1 %}
423
+ {%- else %}
424
+ {%- set ns2.consecutive_failures = 0 %}
425
+ {%- endif %}
426
+ {%- if ns2.prev_role != 'tool' %}
427
+ {{- '<|im_start|>user' }}
428
+ {%- endif %}
429
+ {%- set _is_json_payload = (_tool_format == 'json' and content | trim | length > 0 and (content | trim)[:1] in ('{', '[')) %}
430
+ {%- if not _is_json_payload and max_tool_response_chars > 0 and content | length > max_tool_response_chars %}
431
+ {%- set content = content[:max_tool_response_chars] + '\n[TRUNCATED - original length ' ~ (content | length | string) ~ ' chars]' %}
432
+ {%- endif %}
433
+ {{- '\n<tool_response>\n' + content }}
434
+ {%- if ns2.consecutive_failures >= 2 %}
435
+ {{- '\n\n⚠️ SYSTEM WARNING: ' ~ ns2.consecutive_failures ~ ' consecutive tool errors detected. Your previous approach is incorrect. You MUST use a fundamentally different approach or corrected arguments.' }}
436
+ {%- elif ns2.consecutive_failures == 1 %}
437
+ {{- '\n\n⚠️ SYSTEM WARNING: The previous tool call returned an error. Diagnose the failure and retry with completely corrected arguments.' }}
438
+ {%- endif %}
439
+ {{- '\n</tool_response>' }}
440
+ {%- if loop.last %}
441
+ {{- '<|im_end|>\n' }}
442
+ {%- else %}
443
+ {%- set _next_role = _msgs[loop.index0 + 1].role %}
444
+ {%- if _next_role != 'tool' %}
445
+ {{- '<|im_end|>\n' }}
446
+ {%- endif %}
447
+ {%- endif %}
448
+ {%- else %}
449
+ {{- '<|im_start|>user\n[' + message.role + ']: ' + content + '<|im_end|>\n' }}
450
+ {%- endif %}
451
+ {%- set ns2.prev_role = message.role %}
452
+ {%- endfor %}
453
+ {%- if add_generation_prompt %}
454
+ {{- '<|im_start|>assistant\n' }}
455
+ {%- if not ns_state.thinking %}
456
+ {{- '<think>\n\n</think>\n\n' }}
457
+ {%- else %}
458
+ {{- '<think>\n' }}
459
+ {%- endif %}
460
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3_5ForConditionalGeneration"
4
+ ],
5
+ "image_token_id": 248056,
6
+ "language_model_only": false,
7
+ "model_type": "qwen3_5",
8
+ "text_config": {
9
+ "attention_bias": false,
10
+ "attention_dropout": 0.0,
11
+ "attn_output_gate": true,
12
+ "bos_token_id": 248044,
13
+ "torch_dtype": "bfloat16",
14
+ "eos_token_id": 248044,
15
+ "full_attention_interval": 4,
16
+ "head_dim": 256,
17
+ "hidden_act": "silu",
18
+ "hidden_size": 5120,
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 17408,
21
+ "layer_types": [
22
+ "linear_attention",
23
+ "linear_attention",
24
+ "linear_attention",
25
+ "full_attention",
26
+ "linear_attention",
27
+ "linear_attention",
28
+ "linear_attention",
29
+ "full_attention",
30
+ "linear_attention",
31
+ "linear_attention",
32
+ "linear_attention",
33
+ "full_attention",
34
+ "linear_attention",
35
+ "linear_attention",
36
+ "linear_attention",
37
+ "full_attention",
38
+ "linear_attention",
39
+ "linear_attention",
40
+ "linear_attention",
41
+ "full_attention",
42
+ "linear_attention",
43
+ "linear_attention",
44
+ "linear_attention",
45
+ "full_attention",
46
+ "linear_attention",
47
+ "linear_attention",
48
+ "linear_attention",
49
+ "full_attention",
50
+ "linear_attention",
51
+ "linear_attention",
52
+ "linear_attention",
53
+ "full_attention",
54
+ "linear_attention",
55
+ "linear_attention",
56
+ "linear_attention",
57
+ "full_attention",
58
+ "linear_attention",
59
+ "linear_attention",
60
+ "linear_attention",
61
+ "full_attention",
62
+ "linear_attention",
63
+ "linear_attention",
64
+ "linear_attention",
65
+ "full_attention",
66
+ "linear_attention",
67
+ "linear_attention",
68
+ "linear_attention",
69
+ "full_attention",
70
+ "linear_attention",
71
+ "linear_attention",
72
+ "linear_attention",
73
+ "full_attention",
74
+ "linear_attention",
75
+ "linear_attention",
76
+ "linear_attention",
77
+ "full_attention",
78
+ "linear_attention",
79
+ "linear_attention",
80
+ "linear_attention",
81
+ "full_attention",
82
+ "linear_attention",
83
+ "linear_attention",
84
+ "linear_attention",
85
+ "full_attention"
86
+ ],
87
+ "linear_conv_kernel_dim": 4,
88
+ "linear_key_head_dim": 128,
89
+ "linear_num_key_heads": 16,
90
+ "linear_num_value_heads": 48,
91
+ "linear_value_head_dim": 128,
92
+ "mamba_ssm_dtype": "float32",
93
+ "max_position_embeddings": 262144,
94
+ "model_type": "qwen3_5_text",
95
+ "mtp_num_hidden_layers": 1,
96
+ "mtp_use_dedicated_embeddings": false,
97
+ "num_attention_heads": 24,
98
+ "num_hidden_layers": 64,
99
+ "num_key_value_heads": 4,
100
+ "output_gate_type": "swish",
101
+ "pad_token_id": null,
102
+ "partial_rotary_factor": 0.25,
103
+ "rms_norm_eps": 1e-06,
104
+ "rope_parameters": {
105
+ "mrope_interleaved": true,
106
+ "mrope_section": [
107
+ 11,
108
+ 11,
109
+ 10
110
+ ],
111
+ "partial_rotary_factor": 0.25,
112
+ "rope_theta": 10000000,
113
+ "rope_type": "default"
114
+ },
115
+ "tie_word_embeddings": false,
116
+ "use_cache": true,
117
+ "vocab_size": 248320
118
+ },
119
+ "tie_word_embeddings": false,
120
+ "video_token_id": 248057,
121
+ "vision_config": {
122
+ "deepstack_visual_indexes": [],
123
+ "depth": 27,
124
+ "hidden_act": "gelu_pytorch_tanh",
125
+ "hidden_size": 1152,
126
+ "in_channels": 3,
127
+ "initializer_range": 0.02,
128
+ "intermediate_size": 4304,
129
+ "model_type": "qwen3_5",
130
+ "num_heads": 16,
131
+ "num_position_embeddings": 2304,
132
+ "out_hidden_size": 5120,
133
+ "patch_size": 16,
134
+ "spatial_merge_size": 2,
135
+ "temporal_patch_size": 2
136
+ },
137
+ "vision_end_token_id": 248054,
138
+ "vision_start_token_id": 248053
139
+ }
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 248044,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 248046,
6
+ 248044
7
+ ],
8
+ "pad_token_id": 248044,
9
+ "temperature": 1.0,
10
+ "top_k": 20,
11
+ "top_p": 0.95,
12
+ "transformers_version": "5.3.0"
13
+ }
model-00001-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c4a3394914cc39cb8e9ac23d84d17bb578d727b13c004857e3b9094a816fbd5
3
+ size 3966730552
model-00002-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d297fcace9daaca3e9e5a304ee92733d409dc799aa24aaab0a01a1d79a89ea9
3
+ size 3043080328
model-00003-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e6fc252b227825136d8dd0ceb0d911c19baef00a0da9feaa73d803ee741090ac
3
+ size 2542796952
model-00004-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb9990af635c225443de0c9b205a5034ffaa10bdf3738889c2e02c3e42219ddc
3
+ size 3988973152
model-00005-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27199a636af53f187263b6c3b9ea8fe0338070da671bbad421549d32b7622fdc
3
+ size 2099339864
model-00006-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1c1ec960210c048cc5fee8a2953caa1dff921ab4881132f3275e147d0ded160d
3
+ size 3979553696
model-00007-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:872199bf1d28dec44a5444c091ce6f768c9da47693f8c636a8a607123ab725c1
3
+ size 2108759344
model-00008-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05da602095599b63b4936d64a10ff04006600279fad5ac58919143b0d29a38e1
3
+ size 3979553696
model-00009-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9eeed4bce052d99e90b42cc6bf7186ba60efc7cb61c146d35aa10b04edd3b672
3
+ size 2108759344
model-00010-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:106067bb318970357fe12eb37d97eeb18452578227b3bdf42944d7f186a94bf8
3
+ size 3979553696
model-00011-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8a74338e09d9b4fe8e60fcf7a8e2836f9ac561b4fe406636d374d7db5c457ebf
3
+ size 2108759344
model-00012-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c92cdfd69a11c32c788bca8ca654176a3b62da544611cac4a05f7bbadb9a84ce
3
+ size 3979553696
model-00013-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b272602b154255e4f4b2e6207718cbf29a74879527dce99a7eecbce51d61d4e
3
+ size 2108759344
model-00014-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e923230a1a7d5ea117fce60e14b4461e46b2f61d360b3fef261798ece53794bb
3
+ size 3979553696
model-00015-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d84fc191210ab4ca4977ffa9d63d4cce8285b72124a35caaedd6fc34f6dcdf4
3
+ size 2108759344
model-00016-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:939540187e29e3a14ba3a0a5fb67a9dbf0b32382bbd4540ccb4bb95842df83f5
3
+ size 3979564040
model-00017-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc24da59137fca1c1e166e5a19b282ba572f7589b99b3417a0c618de9fdfd131
3
+ size 2108759344
model-00018-of-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1ac226c56138dd814cd3040f1ea581c4fa4be6cd954896669f0641831667a7d6
3
+ size 3392197344
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
processor_config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "data_format": "channels_first",
4
+ "do_convert_rgb": true,
5
+ "do_normalize": true,
6
+ "do_rescale": true,
7
+ "do_resize": true,
8
+ "image_mean": [
9
+ 0.5,
10
+ 0.5,
11
+ 0.5
12
+ ],
13
+ "image_processor_type": "Qwen2VLImageProcessorFast",
14
+ "image_std": [
15
+ 0.5,
16
+ 0.5,
17
+ 0.5
18
+ ],
19
+ "merge_size": 2,
20
+ "patch_size": 16,
21
+ "resample": 3,
22
+ "rescale_factor": 0.00392156862745098,
23
+ "size": {
24
+ "longest_edge": 16777216,
25
+ "shortest_edge": 65536
26
+ },
27
+ "temporal_patch_size": 2
28
+ },
29
+ "processor_class": "Qwen3VLProcessor",
30
+ "video_processor": {
31
+ "data_format": "channels_first",
32
+ "default_to_square": true,
33
+ "do_convert_rgb": true,
34
+ "do_normalize": true,
35
+ "do_rescale": true,
36
+ "do_resize": true,
37
+ "do_sample_frames": true,
38
+ "fps": 2,
39
+ "image_mean": [
40
+ 0.5,
41
+ 0.5,
42
+ 0.5
43
+ ],
44
+ "image_std": [
45
+ 0.5,
46
+ 0.5,
47
+ 0.5
48
+ ],
49
+ "max_frames": 768,
50
+ "merge_size": 2,
51
+ "min_frames": 4,
52
+ "patch_size": 16,
53
+ "resample": 3,
54
+ "rescale_factor": 0.00392156862745098,
55
+ "return_metadata": false,
56
+ "size": {
57
+ "longest_edge": 25165824,
58
+ "shortest_edge": 4096
59
+ },
60
+ "temporal_patch_size": 2,
61
+ "video_processor_type": "Qwen3VLVideoProcessor"
62
+ }
63
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87a7830d63fcf43bf241c3c5242e96e62dd3fdc29224ca26fed8ea333db72de4
3
+ size 19989343
tokenizer_config.json ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "audio_bos_token": "<|audio_start|>",
4
+ "audio_eos_token": "<|audio_end|>",
5
+ "audio_token": "<|audio_pad|>",
6
+ "backend": "tokenizers",
7
+ "bos_token": null,
8
+ "clean_up_tokenization_spaces": false,
9
+ "eos_token": "<|im_end|>",
10
+ "errors": "replace",
11
+ "image_token": "<|image_pad|>",
12
+ "is_local": true,
13
+ "model_max_length": 262144,
14
+ "model_specific_special_tokens": {
15
+ "audio_bos_token": "<|audio_start|>",
16
+ "audio_eos_token": "<|audio_end|>",
17
+ "audio_token": "<|audio_pad|>",
18
+ "image_token": "<|image_pad|>",
19
+ "video_token": "<|video_pad|>",
20
+ "vision_bos_token": "<|vision_start|>",
21
+ "vision_eos_token": "<|vision_end|>"
22
+ },
23
+ "pad_token": "<|endoftext|>",
24
+ "padding_side": "left",
25
+ "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
26
+ "processor_class": "Qwen3VLProcessor",
27
+ "split_special_tokens": false,
28
+ "tokenizer_class": "TokenizersBackend",
29
+ "unk_token": null,
30
+ "video_token": "<|video_pad|>",
31
+ "vision_bos_token": "<|vision_start|>",
32
+ "vision_eos_token": "<|vision_end|>",
33
+ "added_tokens_decoder": {
34
+ "248044": {
35
+ "content": "<|endoftext|>",
36
+ "single_word": false,
37
+ "lstrip": false,
38
+ "rstrip": false,
39
+ "normalized": false,
40
+ "special": true
41
+ },
42
+ "248045": {
43
+ "content": "<|im_start|>",
44
+ "single_word": false,
45
+ "lstrip": false,
46
+ "rstrip": false,
47
+ "normalized": false,
48
+ "special": true
49
+ },
50
+ "248046": {
51
+ "content": "<|im_end|>",
52
+ "single_word": false,
53
+ "lstrip": false,
54
+ "rstrip": false,
55
+ "normalized": false,
56
+ "special": true
57
+ },
58
+ "248047": {
59
+ "content": "<|object_ref_start|>",
60
+ "single_word": false,
61
+ "lstrip": false,
62
+ "rstrip": false,
63
+ "normalized": false,
64
+ "special": true
65
+ },
66
+ "248048": {
67
+ "content": "<|object_ref_end|>",
68
+ "single_word": false,
69
+ "lstrip": false,
70
+ "rstrip": false,
71
+ "normalized": false,
72
+ "special": true
73
+ },
74
+ "248049": {
75
+ "content": "<|box_start|>",
76
+ "single_word": false,
77
+ "lstrip": false,
78
+ "rstrip": false,
79
+ "normalized": false,
80
+ "special": true
81
+ },
82
+ "248050": {
83
+ "content": "<|box_end|>",
84
+ "single_word": false,
85
+ "lstrip": false,
86
+ "rstrip": false,
87
+ "normalized": false,
88
+ "special": true
89
+ },
90
+ "248051": {
91
+ "content": "<|quad_start|>",
92
+ "single_word": false,
93
+ "lstrip": false,
94
+ "rstrip": false,
95
+ "normalized": false,
96
+ "special": true
97
+ },
98
+ "248052": {
99
+ "content": "<|quad_end|>",
100
+ "single_word": false,
101
+ "lstrip": false,
102
+ "rstrip": false,
103
+ "normalized": false,
104
+ "special": true
105
+ },
106
+ "248053": {
107
+ "content": "<|vision_start|>",
108
+ "single_word": false,
109
+ "lstrip": false,
110
+ "rstrip": false,
111
+ "normalized": false,
112
+ "special": true
113
+ },
114
+ "248054": {
115
+ "content": "<|vision_end|>",
116
+ "single_word": false,
117
+ "lstrip": false,
118
+ "rstrip": false,
119
+ "normalized": false,
120
+ "special": true
121
+ },
122
+ "248055": {
123
+ "content": "<|vision_pad|>",
124
+ "single_word": false,
125
+ "lstrip": false,
126
+ "rstrip": false,
127
+ "normalized": false,
128
+ "special": true
129
+ },
130
+ "248056": {
131
+ "content": "<|image_pad|>",
132
+ "single_word": false,
133
+ "lstrip": false,
134
+ "rstrip": false,
135
+ "normalized": false,
136
+ "special": true
137
+ },
138
+ "248057": {
139
+ "content": "<|video_pad|>",
140
+ "single_word": false,
141
+ "lstrip": false,
142
+ "rstrip": false,
143
+ "normalized": false,
144
+ "special": true
145
+ },
146
+ "248058": {
147
+ "content": "<tool_call>",
148
+ "single_word": false,
149
+ "lstrip": false,
150
+ "rstrip": false,
151
+ "normalized": false,
152
+ "special": false
153
+ },
154
+ "248059": {
155
+ "content": "</tool_call>",
156
+ "single_word": false,
157
+ "lstrip": false,
158
+ "rstrip": false,
159
+ "normalized": false,
160
+ "special": false
161
+ },
162
+ "248060": {
163
+ "content": "<|fim_prefix|>",
164
+ "single_word": false,
165
+ "lstrip": false,
166
+ "rstrip": false,
167
+ "normalized": false,
168
+ "special": false
169
+ },
170
+ "248061": {
171
+ "content": "<|fim_middle|>",
172
+ "single_word": false,
173
+ "lstrip": false,
174
+ "rstrip": false,
175
+ "normalized": false,
176
+ "special": false
177
+ },
178
+ "248062": {
179
+ "content": "<|fim_suffix|>",
180
+ "single_word": false,
181
+ "lstrip": false,
182
+ "rstrip": false,
183
+ "normalized": false,
184
+ "special": false
185
+ },
186
+ "248063": {
187
+ "content": "<|fim_pad|>",
188
+ "single_word": false,
189
+ "lstrip": false,
190
+ "rstrip": false,
191
+ "normalized": false,
192
+ "special": false
193
+ },
194
+ "248064": {
195
+ "content": "<|repo_name|>",
196
+ "single_word": false,
197
+ "lstrip": false,
198
+ "rstrip": false,
199
+ "normalized": false,
200
+ "special": false
201
+ },
202
+ "248065": {
203
+ "content": "<|file_sep|>",
204
+ "single_word": false,
205
+ "lstrip": false,
206
+ "rstrip": false,
207
+ "normalized": false,
208
+ "special": false
209
+ },
210
+ "248066": {
211
+ "content": "<tool_response>",
212
+ "single_word": false,
213
+ "lstrip": false,
214
+ "rstrip": false,
215
+ "normalized": false,
216
+ "special": false
217
+ },
218
+ "248067": {
219
+ "content": "</tool_response>",
220
+ "single_word": false,
221
+ "lstrip": false,
222
+ "rstrip": false,
223
+ "normalized": false,
224
+ "special": false
225
+ },
226
+ "248068": {
227
+ "content": "<think>",
228
+ "single_word": false,
229
+ "lstrip": false,
230
+ "rstrip": false,
231
+ "normalized": false,
232
+ "special": false
233
+ },
234
+ "248069": {
235
+ "content": "</think>",
236
+ "single_word": false,
237
+ "lstrip": false,
238
+ "rstrip": false,
239
+ "normalized": false,
240
+ "special": false
241
+ },
242
+ "248070": {
243
+ "content": "<|audio_start|>",
244
+ "single_word": false,
245
+ "lstrip": false,
246
+ "rstrip": false,
247
+ "normalized": false,
248
+ "special": true
249
+ },
250
+ "248071": {
251
+ "content": "<|audio_end|>",
252
+ "single_word": false,
253
+ "lstrip": false,
254
+ "rstrip": false,
255
+ "normalized": false,
256
+ "special": true
257
+ },
258
+ "248072": {
259
+ "content": "<tts_pad>",
260
+ "single_word": false,
261
+ "lstrip": false,
262
+ "rstrip": false,
263
+ "normalized": false,
264
+ "special": true
265
+ },
266
+ "248073": {
267
+ "content": "<tts_text_bos>",
268
+ "single_word": false,
269
+ "lstrip": false,
270
+ "rstrip": false,
271
+ "normalized": false,
272
+ "special": true
273
+ },
274
+ "248074": {
275
+ "content": "<tts_text_eod>",
276
+ "single_word": false,
277
+ "lstrip": false,
278
+ "rstrip": false,
279
+ "normalized": false,
280
+ "special": true
281
+ },
282
+ "248075": {
283
+ "content": "<tts_text_bos_single>",
284
+ "single_word": false,
285
+ "lstrip": false,
286
+ "rstrip": false,
287
+ "normalized": false,
288
+ "special": true
289
+ },
290
+ "248076": {
291
+ "content": "<|audio_pad|>",
292
+ "single_word": false,
293
+ "lstrip": false,
294
+ "rstrip": false,
295
+ "normalized": false,
296
+ "special": true
297
+ }
298
+ },
299
+ "chat_template": "{%- set template_version = \"darkc0de_xortron_AJAX_TEST\" %}\n{%- set _tool_format = tool_call_format if tool_call_format is defined else 'xml' %}\n{%- set image_count = namespace(value=0) %}\n{%- set video_count = namespace(value=0) %}\n{%- set add_vision_id = add_vision_id if add_vision_id is defined else false %}\n{%- set enable_thinking = enable_thinking if enable_thinking is defined else true %}\n{%- set auto_disable_thinking_with_tools = auto_disable_thinking_with_tools if auto_disable_thinking_with_tools is defined else false %}\n{%- if preserve_reasoning is defined and preserve_reasoning is not none %}\n {%- set _preserve_thinking = preserve_reasoning %}\n{%- elif preserve_thinking is defined and preserve_thinking is not none %}\n {%- set _preserve_thinking = preserve_thinking %}\n{%- else %}\n {%- set _preserve_thinking = true %}\n{%- endif %}\n{%- set max_tool_arg_chars = max_tool_arg_chars if max_tool_arg_chars is defined else 0 %}\n{%- set max_tool_response_chars = max_tool_response_chars if max_tool_response_chars is defined else 0 %}\n{%- set _default_reasoning_effort = 'medium' %}\n{%- set _has_tools = (tools is defined and tools and tools is iterable and tools is not mapping) %}\n{%- set _effort_raw = (reasoning_effort | string | lower) if reasoning_effort is defined and reasoning_effort is not none else _default_reasoning_effort %}\n{%- set _initial_thinking = enable_thinking %}\n{%- if _effort_raw in ('none', 'off') %}\n {%- set _initial_thinking = false %}\n {%- set _initial_effort = 'medium' %}\n{%- elif _effort_raw in ('minimal', 'low') %}\n {%- set _initial_effort = 'low' %}\n{%- elif _effort_raw in ('high', 'xhigh', 'max', 'ultracode', 'extreme') %}\n {%- set _initial_effort = 'xhigh' %}\n{%- else %}\n {%- set _initial_effort = 'medium' %}\n{%- endif %}\n{%- set ns_state = namespace(thinking=_initial_thinking, effort=_initial_effort) %}\n{%- if auto_disable_thinking_with_tools and _has_tools %}\n {%- set ns_state.thinking = false %}\n{%- endif %}\n{%- for msg in messages %}\n {%- if msg.role == 'system' or msg.role == 'developer' or msg.role == 'user' %}\n {%- if msg.content is string %}\n {%- if '<|think_off|>' in msg.content %}\n {%- set ns_state.thinking = false %}\n {%- elif '<|think_on|>' in msg.content %}\n {%- set ns_state.thinking = true %}\n {%- elif '<|think_xhigh|>' in msg.content or '<|think_high|>' in msg.content or '<|think_ultracode|>' in msg.content or '<|think_extreme|>' in msg.content or '<|think_max|>' in msg.content %}\n {%- set ns_state.thinking = true %}\n {%- set ns_state.effort = 'xhigh' %}\n {%- elif '<|think_low|>' in msg.content or '<|think_minimal|>' in msg.content %}\n {%- set ns_state.thinking = true %}\n {%- set ns_state.effort = 'low' %}\n {%- elif '<|think_medium|>' in msg.content %}\n {%- set ns_state.thinking = true %}\n {%- set ns_state.effort = 'medium' %}\n {%- endif %}\n {%- elif msg.content is iterable and msg.content is not mapping %}\n {%- for item in msg.content %}\n {%- if item is string %}\n {%- set _item_text = item %}\n {%- elif item is mapping and 'text' in item and item.text is string %}\n {%- set _item_text = item.text %}\n {%- else %}\n {%- set _item_text = '' %}\n {%- endif %}\n {%- if _item_text %}\n {%- if '<|think_off|>' in _item_text %}\n {%- set ns_state.thinking = false %}\n {%- elif '<|think_on|>' in _item_text %}\n {%- set ns_state.thinking = true %}\n {%- elif '<|think_xhigh|>' in _item_text or '<|think_high|>' in _item_text or '<|think_ultracode|>' in _item_text or '<|think_extreme|>' in _item_text or '<|think_max|>' in _item_text %}\n {%- set ns_state.thinking = true %}\n {%- set ns_state.effort = 'xhigh' %}\n {%- elif '<|think_low|>' in _item_text or '<|think_minimal|>' in _item_text %}\n {%- set ns_state.thinking = true %}\n {%- set ns_state.effort = 'low' %}\n {%- elif '<|think_medium|>' in _item_text %}\n {%- set ns_state.thinking = true %}\n {%- set ns_state.effort = 'medium' %}\n {%- endif %}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- set reasoning_instructions = '' %}\n{%- if ns_state.thinking %}\n {%- if ns_state.effort == 'xhigh' %}\n {%- set reasoning_instructions = 'Reasoning effort is set to xhigh. Please think carefully through the task, validate key assumptions, consider plausible alternatives, and prioritize correctness, consistency, and clarity in the final answer.' %}\n {%- elif ns_state.effort == 'low' %}\n {%- set reasoning_instructions = 'Reasoning effort is set to low. Keep your thinking brief and focused, moving directly to the conclusion without unnecessary elaboration.' %}\n {%- endif %}\n{%- endif %}\n{%- macro render_content(content, do_vision_count, is_system_content=false) %}\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 %}\n {%- if item.type == 'image' or 'image' in item or 'image_url' in item %}\n {%- if is_system_content %}\n {{- raise_exception('System message cannot contain images.') }}\n {%- endif %}\n {%- if do_vision_count %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- endif %}\n {%- if add_vision_id %}\n {{- 'Picture ' ~ image_count.value ~ ': ' }}\n {%- endif %}\n {{- '<|vision_start|><|image_pad|><|vision_end|>' }}\n {%- elif item.type == 'video' or 'video' in item or 'video_url' in item %}\n {%- if is_system_content %}\n {{- raise_exception('System message cannot contain videos.') }}\n {%- endif %}\n {%- if do_vision_count %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- endif %}\n {%- if add_vision_id %}\n {{- 'Video ' ~ video_count.value ~ ': ' }}\n {%- endif %}\n {{- '<|vision_start|><|video_pad|><|vision_end|>' }}\n {%- elif 'text' in item %}\n {{- item.text }}\n {%- else %}\n {{- raise_exception('Unexpected item type in content.') }}\n {%- endif %}\n {%- else %}\n {{- item | string }}\n {%- endif %}\n {%- endfor %}\n {%- elif content is none or content is undefined %}\n {{- '' }}\n {%- else %}\n {{- raise_exception('Unexpected content type.') }}\n {%- endif %}\n{%- endmacro %}\n{%- if not messages %}\n {{- raise_exception('No messages provided.') }}\n{%- endif %}\n{%- set head = namespace(count=0, seen_non_system=false) %}\n{%- for message in messages %}\n {%- set _is_sys = (message.role == 'system' or message.role == 'developer') %}\n {%- if _is_sys and not head.seen_non_system %}\n {%- set head.count = head.count + 1 %}\n {%- else %}\n {%- set head.seen_non_system = true %}\n {%- endif %}\n{%- endfor %}\n{%- set sys_state = namespace(content='') %}\n{%- for message in messages[:head.count] %}\n {%- set _part = render_content(message.content, false, true) | trim %}\n {%- if '<|think_off|>' in _part %}{%- set _part = _part.split('<|think_off|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_on|>' in _part %}{%- set _part = _part.split('<|think_on|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_xhigh|>' in _part %}{%- set _part = _part.split('<|think_xhigh|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_high|>' in _part %}{%- set _part = _part.split('<|think_high|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_ultracode|>' in _part %}{%- set _part = _part.split('<|think_ultracode|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_extreme|>' in _part %}{%- set _part = _part.split('<|think_extreme|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_max|>' in _part %}{%- set _part = _part.split('<|think_max|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_medium|>' in _part %}{%- set _part = _part.split('<|think_medium|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_low|>' in _part %}{%- set _part = _part.split('<|think_low|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_minimal|>' in _part %}{%- set _part = _part.split('<|think_minimal|>') | join('') | trim %}{%- endif %}\n {%- if _part %}\n {%- if sys_state.content %}\n {%- set sys_state.content = sys_state.content ~ '\\n\\n' ~ _part %}\n {%- else %}\n {%- set sys_state.content = _part %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- set _sc = sys_state.content %}\n{%- set _msgs = messages[head.count:] %}\n{%- if _has_tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if reasoning_instructions %}\n {{- reasoning_instructions + '\\n\\n' }}\n {%- endif %}\n {{- '# Tools\\n\\nYou have access to the following functions:\\n\\n<tools>' }}\n {%- for tool in tools %}\n {{- '\\n' }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- '\\n</tools>' }}\n {%- if _tool_format == 'json' %}\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n' }}\n {%- if ns_state.thinking %}\n {{- '<think>\\nBrief explanation of tool call\\n</think>\\n' }}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"example_function_name\", \"arguments\": {\"example_parameter_1\": \"value_1\", \"example_parameter_2\": \"This is the value for the second parameter\"}}\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n' }}\n {%- if ns_state.thinking %}\n {{- '- You can use the <think></think> block to plan your next tool call OR to synthesize data and formulate your final response to the user.\\n- ALL explanation and reasoning MUST be placed strictly inside the <think></think> block.\\n' }}\n {%- endif %}\n {{- '- Function calls MUST follow the specified format: a single JSON object with \"name\" and \"arguments\" keys inside <tool_call></tool_call> XML tags.\\n' }}\n {%- if ns_state.thinking %}\n {{- '- If you choose to call a tool, you MUST output the <tool_call> block IMMEDIATELY after thinking, with NO conversational text before it.\\n' }}\n {%- else %}\n {{- '- If you choose to call a tool, you MUST output the <tool_call> block IMMEDIATELY, with NO conversational text before it.\\n' }}\n {%- endif %}\n {{- '- The <tool_call> tag MUST be at the very beginning of a new line, with NO spaces or indentation before it.\\n- To call multiple functions, output a separate, completely closed <tool_call></tool_call> block for EACH function. Do NOT nest <tool_call> blocks.\\n- If you have all necessary data, provide your final answer directly to the user without any tool call.\\n</IMPORTANT>' }}\n {%- else %}\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n' }}\n {%- if ns_state.thinking %}\n {{- '<think>\\nBrief explanation of tool call\\n</think>\\n' }}\n {%- endif %}\n {{- '<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n' }}\n {%- if ns_state.thinking %}\n {{- '- You can use the <think></think> block to plan your next tool call OR to synthesize data and formulate your final response to the user.\\n- ALL explanation and reasoning MUST be placed strictly inside the <think></think> block.\\n' }}\n {%- endif %}\n {{- '- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags.\\n' }}\n {%- if ns_state.thinking %}\n {{- '- If you choose to call a tool, you MUST output the <tool_call> block IMMEDIATELY after thinking, with NO conversational text before it.\\n' }}\n {%- else %}\n {{- '- If you choose to call a tool, you MUST output the <tool_call> block IMMEDIATELY, with NO conversational text before it.\\n' }}\n {%- endif %}\n {{- '- The <tool_call> and <function> tags MUST be at the very beginning of a new line, with NO spaces or indentation before them.\\n- To call multiple functions, output a separate, completely closed <tool_call></tool_call> block for EACH function. Do NOT nest <tool_call> blocks.\\n- If you have all necessary data, provide your final answer directly to the user without any tool call.\\n</IMPORTANT>' }}\n {%- endif %}\n {%- if _sc %}\n {{- '\\n\\n' + _sc }}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if _sc %}\n {{- '<|im_start|>system\\n' + (reasoning_instructions + '\\n\\n' if reasoning_instructions else '') + _sc + '<|im_end|>\\n' }}\n {%- elif reasoning_instructions %}\n {{- '<|im_start|>system\\n' + reasoning_instructions + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set _last_idx = _msgs | length - 1 %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=_last_idx) %}\n{%- for message in _msgs[::-1] %}\n {%- set index = (_msgs | length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == 'user' %}\n {%- set _rc = render_content(message.content, false) | trim %}\n {%- if not (_rc.startswith('<tool_response>') and _rc.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if ns.multi_step_tool %}\n {%- if _last_idx > 50 %}\n {%- set ns.last_query_index = _last_idx %}\n {%- else %}\n {%- set ns.last_query_index = 0 %}\n {%- endif %}\n{%- endif %}\n{%- set ns2 = namespace(prev_role='', consecutive_failures=0) %}\n{%- for message in _msgs %}\n {%- set is_system = (message.role == \"system\" or message.role == \"developer\") %}\n {%- set content = render_content(message.content, true, is_system) | trim %}\n {%- if is_system or message.role == 'user' %}\n {%- if '<|think_off|>' in content %}{%- set content = content.split('<|think_off|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_on|>' in content %}{%- set content = content.split('<|think_on|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_xhigh|>' in content %}{%- set content = content.split('<|think_xhigh|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_high|>' in content %}{%- set content = content.split('<|think_high|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_ultracode|>' in content %}{%- set content = content.split('<|think_ultracode|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_extreme|>' in content %}{%- set content = content.split('<|think_extreme|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_max|>' in content %}{%- set content = content.split('<|think_max|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_medium|>' in content %}{%- set content = content.split('<|think_medium|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_low|>' in content %}{%- set content = content.split('<|think_low|>') | join('') | trim %}{%- endif %}\n {%- if '<|think_minimal|>' in content %}{%- set content = content.split('<|think_minimal|>') | join('') | trim %}{%- endif %}\n {%- endif %}\n {%- if is_system %}\n {{- '<|im_start|>system\\n' + content + '<|im_end|>\\n' }}\n {%- elif message.role == 'user' %}\n {%- set ns2.consecutive_failures = 0 %}\n {{- '<|im_start|>user\\n' + content + '<|im_end|>\\n' }}\n {%- elif message.role == 'assistant' %}\n {%- set reasoning_content = '' %}\n {%- set _explicit_reasoning = '' %}\n {%- if message.reasoning_content is defined and message.reasoning_content is not none %}\n {%- if message.reasoning_content is string %}\n {%- set _explicit_reasoning = message.reasoning_content %}\n {%- else %}\n {%- set _explicit_reasoning = message.reasoning_content | string %}\n {%- endif %}\n {%- elif message.thinking is defined and message.thinking is not none %}\n {%- if message.thinking is string %}\n {%- set _explicit_reasoning = message.thinking %}\n {%- else %}\n {%- set _explicit_reasoning = message.thinking | string %}\n {%- endif %}\n {%- elif message.reasoning is defined and message.reasoning is not none %}\n {%- if message.reasoning is string %}\n {%- set _explicit_reasoning = message.reasoning %}\n {%- else %}\n {%- set _explicit_reasoning = message.reasoning | string %}\n {%- endif %}\n {%- endif %}\n {%- if _explicit_reasoning %}\n {%- set _lead_end = '' %}\n {%- if content.startswith('<think>') and '</think>' in content %}\n {%- set _lead_end = '</think>' %}\n {%- elif content.startswith('<thinking>') and '</thinking>' in content %}\n {%- set _lead_end = '</thinking>' %}\n {%- elif content.startswith('</think>') %}\n {%- set _lead_end = '</think>' %}\n {%- elif content.startswith('</thinking>') %}\n {%- set _lead_end = '</thinking>' %}\n {%- endif %}\n {%- if _lead_end %}\n {%- set content = content.split(_lead_end)[-1].lstrip('\\n') %}\n {%- endif %}\n {%- set reasoning_content = _explicit_reasoning %}\n {%- else %}\n {%- set _think_end = '' %}\n {%- if content.startswith('</think>') %}\n {%- set _think_end = '</think>' %}\n {%- elif content.startswith('</thinking>') %}\n {%- set _think_end = '</thinking>' %}\n {%- elif '\\n</think>' in content %}\n {%- set _think_end = '\\n</think>' %}\n {%- elif '\\n</thinking>' in content %}\n {%- set _think_end = '\\n</thinking>' %}\n {%- elif '\\n</ think>' in content %}\n {%- set _think_end = '\\n</ think>' %}\n {%- elif '\\n</think >' in content %}\n {%- set _think_end = '\\n</think >' %}\n {%- elif content.startswith('<think>') and '</think>' in content %}\n {%- set _think_end = '</think>' %}\n {%- elif content.startswith('<thinking>') and '</thinking>' in content %}\n {%- set _think_end = '</thinking>' %}\n {%- endif %}\n {%- if _think_end %}\n {%- if 'thinking' in _think_end %}\n {%- set _think_start = '<thinking>' %}\n {%- else %}\n {%- set _think_start = '<think>' %}\n {%- endif %}\n {%- set reasoning_content = content.split(_think_end)[0].rstrip('\\n') %}\n {%- if _think_start in reasoning_content %}\n {%- set reasoning_content = reasoning_content.split(_think_start)[-1].lstrip('\\n') %}\n {%- endif %}\n {%- set content = content.split(_think_end)[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- set reasoning_content = reasoning_content | trim %}\n {%- if (_preserve_thinking or loop.index0 > ns.last_query_index) %}\n {{- '<|im_start|>assistant\\n<think>\\n' + reasoning_content + '\\n</think>\\n\\n' + content }}\n {%- else %}\n {{- '<|im_start|>assistant\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls is defined and message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined and tool_call.function is not none %}\n {%- set tc = tool_call.function %}\n {%- else %}\n {%- set tc = tool_call %}\n {%- endif %}\n {%- set tc_name = tc.name if (tc.name is defined and tc.name is not none) else '' %}\n {%- if _tool_format == 'json' %}\n {%- if loop.first %}\n {%- if content | trim %}\n {{- '\\n\\n' }}\n {%- endif %}\n {%- else %}\n {{- '\\n' }}\n {%- endif %}\n {%- set _args = '{}' %}\n {%- if tc.arguments is defined and tc.arguments is not none %}\n {%- if tc.arguments is mapping %}\n {%- set _args = tc.arguments | tojson %}\n {%- elif tc.arguments is string %}\n {%- if tc.arguments %}\n {%- set _args = tc.arguments %}\n {%- endif %}\n {%- else %}\n {%- set _args = tc.arguments | tojson %}\n {%- endif %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": ' }}{{- tc_name | tojson }}{{- ', \"arguments\": ' }}{{- _args }}{{- '}\\n</tool_call>' }}\n {%- else %}\n {%- if loop.first %}\n {%- if content | trim %}\n {{- '\\n\\n<tool_call>\\n<function=' + tc_name + '>\\n' }}\n {%- else %}\n {{- '<tool_call>\\n<function=' + tc_name + '>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '\\n<tool_call>\\n<function=' + tc_name + '>\\n' }}\n {%- endif %}\n {%- if tc.arguments is defined and tc.arguments is not none %}\n {%- if tc.arguments is mapping %}\n {%- for args_name, args_value in tc.arguments.items() %}\n {{- '<parameter=' + args_name + '>\\n' }}\n {%- if args_value is string %}\n {%- set _av = args_value %}\n {%- else %}\n {%- set _av = args_value | tojson %}\n {%- endif %}\n {%- if max_tool_arg_chars > 0 and _av | length > max_tool_arg_chars %}\n {{- _av[:max_tool_arg_chars] + '\\n[TRUNCATED - original length ' ~ (_av | length | string) ~ ' chars]' }}\n {%- else %}\n {{- _av }}\n {%- endif %}\n {{- '\\n</parameter>\\n' }}\n {%- endfor %}\n {%- else %}\n {%- if tc.arguments is string %}\n {%- set _raw_args = tc.arguments %}\n {%- else %}\n {%- set _raw_args = tc.arguments | tojson %}\n {%- endif %}\n {%- if _raw_args %}\n {%- if max_tool_arg_chars > 0 and _raw_args | length > max_tool_arg_chars %}\n {{- _raw_args[:max_tool_arg_chars] + '\\n[TRUNCATED - original length ' ~ (_raw_args | length | string) ~ ' chars]' }}\n {%- else %}\n {{- _raw_args }}\n {%- endif %}\n {%- endif %}\n {%- endif %}\n {%- endif %}\n {{- '</function>\\n</tool_call>' }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == 'tool' %}\n {%- set _content_lower = content | lower %}\n {%- set _content_head = _content_lower[:120] %}\n {%- set _is_code_or_grep = ('throw new ' in _content_lower or 'throw error' in _content_lower or 'console.error' in _content_lower or 'logger.error' in _content_lower or 'logging.error' in _content_lower or 'import ' in _content_head or 'def ' in _content_head or 'function ' in _content_head) %}\n {%- set _exit_code_zero = ('exit code: 0' in _content_head or 'process exited with code 0' in _content_head) %}\n {%- set _error_field_ok = ('\"error\": null' in _content_head or '\"error\":null' in _content_head or '\"error\": false' in _content_head or '\"error\":false' in _content_head or '\"error\": \"\"' in _content_head or '\"error\":\"\"' in _content_head) %}\n {%- set _strong_error = (('\"error\":' in _content_head and not _error_field_ok) or '\"status\": \"error\"' in _content_head or '\"status\":\"error\"' in _content_head or 'traceback (most recent call last):' in _content_head or 'command not found' in _content_head or 'invalid syntax' in _content_head or 'fatal:' in _content_head or (('exit code: ' in _content_head or 'process exited with code' in _content_head) and not _exit_code_zero) or _content_head.startswith('exception:') or _content_head.startswith('failed to ')) %}\n {%- set _weak_error = ('error:' in _content_head or 'err!' in _content_head) %}\n {%- set _weak_suppressed = ('$ ' in _content_head or 'took ' in _content_head or content | length >= 600) %}\n {%- if not _is_code_or_grep and (_strong_error or (_weak_error and not _weak_suppressed)) %}\n {%- set ns2.consecutive_failures = ns2.consecutive_failures + 1 %}\n {%- else %}\n {%- set ns2.consecutive_failures = 0 %}\n {%- endif %}\n {%- if ns2.prev_role != 'tool' %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {%- set _is_json_payload = (_tool_format == 'json' and content | trim | length > 0 and (content | trim)[:1] in ('{', '[')) %}\n {%- if not _is_json_payload and max_tool_response_chars > 0 and content | length > max_tool_response_chars %}\n {%- set content = content[:max_tool_response_chars] + '\\n[TRUNCATED - original length ' ~ (content | length | string) ~ ' chars]' %}\n {%- endif %}\n {{- '\\n<tool_response>\\n' + content }}\n {%- if ns2.consecutive_failures >= 2 %}\n {{- '\\n\\n⚠️ SYSTEM WARNING: ' ~ ns2.consecutive_failures ~ ' consecutive tool errors detected. Your previous approach is incorrect. You MUST use a fundamentally different approach or corrected arguments.' }}\n {%- elif ns2.consecutive_failures == 1 %}\n {{- '\\n\\n⚠️ SYSTEM WARNING: The previous tool call returned an error. Diagnose the failure and retry with completely corrected arguments.' }}\n {%- endif %}\n {{- '\\n</tool_response>' }}\n {%- if loop.last %}\n {{- '<|im_end|>\\n' }}\n {%- else %}\n {%- set _next_role = _msgs[loop.index0 + 1].role %}\n {%- if _next_role != 'tool' %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>user\\n[' + message.role + ']: ' + content + '<|im_end|>\\n' }}\n {%- endif %}\n {%- set ns2.prev_role = message.role %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if not ns_state.thinking %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- else %}\n {{- '<think>\\n' }}\n {%- endif %}\n{%- endif %}"
300
+ }