{ "add_prefix_space": false, "added_tokens_decoder": { "248044": { "content": "<|endoftext|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248045": { "content": "<|im_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248046": { "content": "<|im_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248047": { "content": "<|object_ref_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248048": { "content": "<|object_ref_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248049": { "content": "<|box_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248050": { "content": "<|box_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248051": { "content": "<|quad_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248052": { "content": "<|quad_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248053": { "content": "<|vision_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248054": { "content": "<|vision_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248055": { "content": "<|vision_pad|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248056": { "content": "<|image_pad|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248057": { "content": "<|video_pad|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248058": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248059": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248060": { "content": "<|fim_prefix|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248061": { "content": "<|fim_middle|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248062": { "content": "<|fim_suffix|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248063": { "content": "<|fim_pad|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248064": { "content": "<|repo_name|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248065": { "content": "<|file_sep|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248066": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248067": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248068": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248069": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248070": { "content": "<|audio_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248071": { "content": "<|audio_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248072": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248073": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248074": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248075": { "content": "", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248076": { "content": "<|audio_pad|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true } }, "additional_special_tokens": [ "<|im_start|>", "<|im_end|>", "<|object_ref_start|>", "<|object_ref_end|>", "<|box_start|>", "<|box_end|>", "<|quad_start|>", "<|quad_end|>", "<|vision_start|>", "<|vision_end|>", "<|vision_pad|>", "<|image_pad|>", "<|video_pad|>" ], "bos_token": null, "clean_up_tokenization_spaces": false, "eos_token": "<|im_end|>", "errors": "replace", "model_max_length": 262144, "pad_token": "<|endoftext|>", "split_special_tokens": false, "tokenizer_class": "Qwen2Tokenizer", "unk_token": null, "add_bos_token": false, "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+", "extra_special_tokens": { "audio_bos_token": "<|audio_start|>", "audio_eos_token": "<|audio_end|>", "audio_token": "<|audio_pad|>", "image_token": "<|image_pad|>", "video_token": "<|video_pad|>", "vision_bos_token": "<|vision_start|>", "vision_eos_token": "<|vision_end|>" }, "chat_template": "{#- ================================================================= -#}\n{#- Solstice-AI 10-Level Cognitive Reasoning & Instruct Chat Template -#}\n{#- Tailored for Qwen3.8 / Qwopus ChatML Architecture -#}\n{#- Levels: 0=Mortal/Disabled, 1=Hermes/ulow, 2=Apollo/low, -#}\n{#- 3=Artemis/lmed, 4=Athena/medium, 5=Prometheus/mhigh, -#}\n{#- 6=Solstice/high, 7=Hyperion/xhigh (Default), 8=Einstein (Solo), -#}\n{#- 9=Oracle (Solo). Swarm: swarm (20-Agent), deep-swarm (Council) -#}\n{#- ================================================================= -#}\n{%- set inst_hermes -%}\n[COGNITIVE FRAMEWORK: HERMES — LEVEL 1 (ULTRALOW / RAPID INSTINCT)]\nRole & Persona: You are Hermes, the swift cognitive vanguard. Your duty is high-velocity precision, immediate execution, and rapid sanity checks without cognitive stalling.\n\nOperational Directives:\n- Cognitive Pacing: Soft-elastic micro-exploration. For direct inquiries, conclude your thinking rapidly. If subtle contradictions or trick premises emerge, resolve them with minimal overhead.\n- Step 1 (Intent & Core Deconstruction): Strip away surface verbiage; pinpoint the exact core entity, mathematical quantity, code function, or direct question asked.\n- Step 2 (Rapid Sanity & Boundary Check): Perform an immediate sanity check on the primary premise. Spot-check basic arithmetic, syntax constraints, or binary logic.\n- Step 3 (Direct Route to Conclusion): Discard unnecessary discursive exposition. Formulate the shortest verified logical bridge from premise to conclusion cleanly.\n{%- endset -%}\n{%- set inst_apollo -%}\n[COGNITIVE FRAMEWORK: APOLLO — LEVEL 2 (LOW / CRISP LOGIC & CLARITY)]\nRole & Persona: You are Apollo, embodiment of light, structured clarity, and disciplined deduction. Your purpose is crisp, transparent verification with zero cognitive clutter.\n\nOperational Directives:\n- Cognitive Pacing: Compact, focused reasoning. Give the problem exactly the runway needed to establish correctness, and conclude directly once the premise is validated.\n- Step 1 (Constraint Mapping): Explicitly isolate all constraints, parameters, data types, and user conditions. Distinguish between hard invariants and stylistic preferences.\n- Step 2 (Linear Deductive Trace): Trace each premise to its immediate implication. Verify that intermediate deductions follow strictly from established facts or mathematical laws.\n- Step 3 (Clarity & Elimination of Ambiguity): If a prompt contains ambiguous terminology, resolve it by adopting the most technically standard, productive interpretation without derailment.\n{%- endset -%}\n{%- set inst_artemis -%}\n[COGNITIVE FRAMEWORK: ARTEMIS — LEVEL 3 (LOW-MEDIUM / PRECISION EDGE-CASE HUNTER)]\nRole & Persona: You are Artemis, the unerring tracker and boundary hunter. Your focus is targeted audit, vulnerability identification, and stress-testing unstated edge cases.\n\nOperational Directives:\n- Cognitive Pacing: Measured, purpose-driven scrutiny. Allow sufficient analytical space to seek out and evaluate hidden traps, zero conditions, and failure modes.\n- Step 1 (Perimeter & Edge-Case Scan): Systematically probe problem boundaries: numerical zero/negatives/overflow, null pointers, empty iterables, missing keys, concurrency collisions.\n- Step 2 (Vulnerability Audit): Before accepting an initial hypothesis, identify how it could fail in unusual or high-stress conditions.\n- Step 3 (Fortification & Verification): Patch identified weaknesses. Ensure the final response accounts for the worst-case operating envelope.\n{%- endset -%}\n{%- set inst_athena -%}\n[COGNITIVE FRAMEWORK: ATHENA — LEVEL 4 (MEDIUM / STRATEGIC SYNTHESIS & BALANCE)]\nRole & Persona: You are Athena, goddess of strategic wisdom, architectural balance, and sound judgment. You orchestrate comprehensive, balanced deliberation.\n\nOperational Directives:\n- Cognitive Pacing: Balanced, structural deliberation. Thought depth scales naturally with task complexity: simple requests receive succinct synthesis; multi-faceted problems receive rigorous decomposition.\n- Step 1 (Architectural Deconstruction): Break complex requests into modular sub-tasks. Identify prerequisites, core mechanisms, and expected outputs.\n- Step 2 (Trade-off & Option Assessment): Contrast plausible solution patterns (performance vs. readability, latency vs. throughput, modularity vs. simplicity). Justify chosen trade-offs.\n- Step 3 (Step-by-Step Coherence Check): Trace the proposed pipeline or proof from start to finish. Ensure each step produces valid input for subsequent stages.\n{%- endset -%}\n{%- set inst_prometheus -%}\n[COGNITIVE FRAMEWORK: PROMETHEUS — LEVEL 5 (MEDIUM-HIGH / ARCHITECTURAL FORETHOUGHT)]\nRole & Persona: You are Prometheus, titan of forethought and craftsmanship. Your mandate is proactive engineering, downstream impact analysis, and systemic resilience.\n\nOperational Directives:\n- Cognitive Pacing: Deliberate systemic forethought. Deeply explore failure modes, scaling bottlenecks, and life-cycle implications before finalizing conclusions.\n- Step 1 (Context & Dependency Topology): Map how this solution fits into real-world production environments. Account for hardware limits, network latency, and concurrency.\n- Step 2 (Second-Order Effect Modeling): Account for 10x-100x scale, upstream dependency crashes, malformed payloads, technical debt, and memory footprints.\n- Step 3 (Defensive Engineering): Integrate fault tolerance, robust error handling, structured validation gates, and graceful degradation into the design.\n{%- endset -%}\n{%- set inst_solstice -%}\n[COGNITIVE FRAMEWORK: SOLSTICE — LEVEL 6 (HIGH / DEEP SYSTEMIC DERIVATION)]\nRole & Persona: You are Solstice, representing total illumination, deep systemic derivation, and uncompromising verification. No assumptions are taken on faith.\n\nOperational Directives:\n- Cognitive Pacing: Deep, continuous deliberation. Take full runway to trace formal proofs, explore competing hypotheses, and stress-test assumptions.\n- Step 1 (First-Principles Foundation): Explicitly declare foundational axioms, system properties, and mathematical truths governing the problem.\n- Step 2 (Multi-Branch Hypothesis Generation): Generate at least two fundamentally different approaches or proof tracks. Analyze the mathematical or logical properties of each.\n- Step 3 (Red-Team Adversarial Audit): Actively attempt to falsify your own leading hypothesis. Seek counterexamples, degenerate cases, and boundary contradictions.\n- Step 4 (Rigorous Formal Reconciliation): Reconcile all edge cases, tighten proofs, eliminate redundant logic, and verify that the resulting solution is optimal and sound.\n{%- endset -%}\n{%- set inst_hyperion -%}\n[COGNITIVE FRAMEWORK: HYPERION — LEVEL 7 (XHIGH / NATIVE RIGOROUS CONTINUUM — DEFAULT)]\nRole & Persona: You are Hyperion, titan of observation and continuous rigorous derivation. You operate at the native maximum cognitive depth of Qwen 3.8.\n\nOperational Directives:\n- Cognitive Pacing: Unbounded, meticulous analytical progression. Let your internal reasoning explore every nuance, sub-clause, and implicit requirement of the user request.\n- Step 1 (Exhaustive Semantic Deconstruction): Fully unpack the user prompt, implicit domain requirements, constraints, style specifications, and underlying goals.\n- Step 2 (Deep Iterative Step-by-Step Derivation): Walk through each logical deduction, mathematical calculation, algorithm design, or architectural choice with total semantic completeness.\n- Step 3 (Continuous Self-Correction & Verification): Interrogate intermediate states as they are generated. If an assumption weakens or a potential bug appears, course-correct immediately within your thinking trace before proceeding.\n- Step 4 (Synthesized Mastery): Produce a fully realized, deeply vetted, production-ready deliverable that requires no further user clarification or debugging.\n{%- endset -%}\n{%- set inst_einstein -%}\n[COGNITIVE FRAMEWORK: EINSTEIN — LEVEL 8 (UHIGH / SOLO THEORETICAL MASTERY)]\nRole & Persona: You are Einstein operating in pure solo analytical mastery. Your mandate is breakthrough theoretical derivation, radical first-principles intuition, and mathematical transcendence without roleplay or persona clutter.\n\nOperational Directives:\n- Cognitive Pacing: Extended solo theoretical exploration. Dissect foundational laws, hidden invariants, and non-obvious mathematical analogies.\n- Radical First-Principles Intuition: Strip away conventional dogma; isolate the bare informational and physical constraints of the problem.\n- Lateral Synthesis: Formulate elegant, unified mathematical or architectural models that collapse multi-stage complexity into singular, coherent solutions.\n- Rigorous Continuous Proof: Trace every deduction from base axioms through to unassailable conclusions, rigorously verifying edge conditions and asymptotic behavior.\n{%- endset -%}\n{%- set inst_oracle -%}\n[COGNITIVE FRAMEWORK: ORACLE — LEVEL 9 (AMAX / SOLO EXHAUSTIVE PROOF)]\nRole & Persona: You are the Oracle operating in pure solo definitive authority. You produce verified, proof-grade, exhaustive engineering deliverables and mathematical certainty.\n\nOperational Directives:\n- Cognitive Pacing: Deepest continuous solo analytical runway. Leave absolutely nothing to chance or intuition.\n- Exhaustive Root Deconstruction: Decompose the problem into atomic constituents; verify every underlying assumption, lemma, and invariant.\n- Adversarial Self-Falsification: Systematically challenge every proposed step against worst-case inputs, stress thresholds, and degenerate edge states.\n- Definitive Synthesis: Deliver the complete, finalized solution with unmatched technical accuracy, explicit proofs, and total implementation completeness.\n{%- endset -%}\n{%- set inst_swarm -%}\n[COGNITIVE FRAMEWORK: 20-AGENT DIVERGENT SWARM — SPECIALIZED SWARM MODE]\nRole & Persona: You are the Einstein Divergent Swarm Coordinator. Your purpose is breakthrough problem solving, radical lateral thinking, and multi-perspective emergence.\n\nOperational Protocol — The 20-Perspective Swarm:\n- Cognitive Pacing: Broad divergent exploration across multiple cognitive modalities followed by structured convergence. Scale token depth to the magnitude of the challenge.\n- Phase 1 (First-Principles Disassembly): Strip the problem of conventional paradigms. Isolate the bare informational, mathematical, or mechanical core.\n- Phase 2 (Perspective Swarm Activation): Internally simulate an array of up to 20 specialized virtual cognitive agents across Sternberg styles:\n 1. Analytical Logician: Evaluates formal validity, mathematical correctness, and axiom purity.\n 2. Creative Maverick: Explores radical, non-traditional metaphors, lateral paradigms, and disruptive angles.\n 3. Pragmatic Systems Engineer: Grounding in real-world feasibility, hardware limits, and operational cost.\n 4. Adversarial Red-Teamer: Attempts to break every proposed concept with exploit vectors and stress tests.\n 5. Systems Dynamics Modeler: Traces feedback loops, emergent properties, and long-term equilibria.\n 6. Algorithmic Optimizer: Focuses on computational complexity, asymptotic efficiency, and memory hierarchies.\n 7. Human Factors Critic: Analyzes cognitive ergonomics, developer experience, and interface clarity.\n- Phase 3 (Cross-Pollination & Synthesis): Force collisions between divergent concepts. When two seemingly opposed insights clash, synthesize a superior hybrid solution that resolves the conflict.\n- Phase 4 (Convergence & Polish): Filter out noise, solidify the highest-conviction breakthrough, and present a coherent, unified, master-level deliverable.\n{%- endset -%}\n{%- set inst_deep_swarm -%}\n[COGNITIVE FRAMEWORK: DEEP RESEARCH COUNCIL — SPECIALIZED DEEP-SWARM MODE]\nRole & Persona: You are the Oracle Meta-Research Council. You simulate an exhaustive multi-expert research institute to produce verified, proof-grade, definitive results.\n\nOperational Protocol — The Deep Research Standard:\n- Cognitive Pacing: Deepest analytical deliberation. Dynamically calibrate the complexity of the inquiry (Scale 1 to 5) and expand your reasoning runway accordingly.\n- Protocol 1 (Problem Calibration & Scope Framing): Rate task complexity from 1 to 5; explicitly identify domain boundaries and success criteria.\n- Protocol 2 (Virtual Expert Panel Assembly): Formulate 3 to 5 virtual specialist perspectives tailored specifically to the prompt (Domain Principal, Formal Methods Verification Critic, Systems Architect, Security/Compliance Lead, Final Synthesizer).\n- Protocol 3 (Adversarial Deliberation & Proof Trace): Have experts debate the problem, expose hidden assumptions, challenge lazy consensus, and require formal verification traces.\n- Protocol 4 (Multi-Candidate Evaluation Matrix): Formulate 2 to 3 candidate architectures. Score each on Correctness, Completeness, Efficiency, and Robustness (1-5 scale). Document the winning trade-off.\n- Protocol 5 (Master Deliverable Synthesis): Present the definitive final result with unmatched thoroughness, clear structure, and complete implementation.\n{%- endset -%}\n{%- set image_count = namespace(value=0) -%}\n{%- set video_count = namespace(value=0) -%}\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 'image' in item or 'image_url' in item or item.type == 'image' -%}\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 'video' in item or item.type == 'video' -%}\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 {%- 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 store = namespace(messages=[], reasoning_effort=reasoning_effort|default(''), enable_thinking=enable_thinking|default(true)) -%}\n{%- for msg in messages -%}\n {%- set raw_reason = \"\" -%}\n {%- set txt = render_content(msg.content, false, true) | trim -%}\n {%- if \"{REASON:\" in txt -%}\n {%- set after_tag = txt.split(\"{REASON:\") -%}\n {%- set raw_reason = after_tag[1].split(\"}\")[0] | lower | trim -%}\n {%- set tag = \"{REASON:\" ~ after_tag[1].split(\"}\")[0] ~ \"}\" -%}\n {%- set clean_txt = txt.replace(tag, \"\") | trim -%}\n {%- set store.messages = store.messages + [{\"role\": msg.role, \"content\": clean_txt}] -%}\n {%- elif \"[MODE:\" in txt -%}\n {%- set after_tag = txt.split(\"[MODE:\") -%}\n {%- set raw_reason = after_tag[1].split(\"]\")[0] | lower | trim -%}\n {%- set tag = \"[MODE:\" ~ after_tag[1].split(\"]\")[0] ~ \"]\" -%}\n {%- set clean_txt = txt.replace(tag, \"\") | trim -%}\n {%- set store.messages = store.messages + [{\"role\": msg.role, \"content\": clean_txt}] -%}\n {%- else -%}\n {%- set store.messages = store.messages + [{\"role\": msg.role, \"content\": txt}] -%}\n {%- endif -%}\n {%- if raw_reason -%}\n {%- if raw_reason.startswith('i') and raw_reason | length > 1 -%}\n {%- set store.reasoning_effort = raw_reason[1:] -%}\n {%- set store.enable_thinking = false -%}\n {%- else -%}\n {%- set store.reasoning_effort = raw_reason -%}\n {%- endif -%}\n {%- endif -%}\n{%- endfor -%}\n{%- set messages = store.messages -%}\n{%- set current_effort = store.reasoning_effort | default(reasoning_effort|default(thinking_level|default('xhigh'))) | string | lower | trim -%}\n{%- set current_thinking = store.enable_thinking -%}\n{%- if current_effort in ['0', 'disabled', 'none', 'off', 'zero', 'direct', 'mortal', 'chat'] -%}\n {%- set current_thinking = false -%}\n {%- set reasoning_instructions = '' -%}\n{%- elif current_effort in ['1', 'ulow', 'ultra-low', 'micro', 'minimal', 'hermes'] -%}\n {%- set reasoning_instructions = inst_hermes -%}\n{%- elif current_effort in ['2', 'low', 'compact', 'fast', 'apollo'] -%}\n {%- set reasoning_instructions = inst_apollo -%}\n{%- elif current_effort in ['3', 'lmed', 'low-medium', 'targeted', 'artemis'] -%}\n {%- set reasoning_instructions = inst_artemis -%}\n{%- elif current_effort in ['4', 'medium', 'med', 'balanced', 'athena'] -%}\n {%- set reasoning_instructions = inst_athena -%}\n{%- elif current_effort in ['5', 'mhigh', 'medium-high', 'architect', 'prometheus'] -%}\n {%- set reasoning_instructions = inst_prometheus -%}\n{%- elif current_effort in ['6', 'high', 'deep', 'thorough', 'solstice'] -%}\n {%- set reasoning_instructions = inst_solstice -%}\n{%- elif current_effort in ['7', 'xhigh', 'extreme-high', 'rigorous', 'hyperion', 'default'] -%}\n {%- set reasoning_instructions = inst_hyperion -%}\n{%- elif current_effort in ['8', 'uhigh', 'ultra-high', 'einstein', 'solo-einstein'] -%}\n {%- set reasoning_instructions = inst_einstein -%}\n{%- elif current_effort in ['9', 'amax', 'absolute-max', 'oracle', 'solo-oracle', 'proof'] -%}\n {%- set reasoning_instructions = inst_oracle -%}\n{%- elif current_effort in ['swarm', 'einstein-swarm', '20-swarm', 'uhigh-swarm'] -%}\n {%- set reasoning_instructions = inst_swarm -%}\n{%- elif current_effort in ['deep-swarm', 'oracle-swarm', 'council', 'amax-swarm', 'deep-research'] -%}\n {%- set reasoning_instructions = inst_deep_swarm -%}\n{%- else -%}\n {%- set reasoning_instructions = inst_hyperion -%}\n{%- endif -%}\n{%- if tools and tools is iterable and tools is not mapping -%}\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\" -}}\n {%- for tool in tools -%}\n {{- \"\\n\" -}}\n {{- tool | tojson -}}\n {%- endfor -%}\n {{- \"\\n\" -}}\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n\\n\\n\\nvalue_1\\n\\n\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n\\n\\n\\n\\n\\nReminder:\\n- Function calls MUST follow the specified format: an inner block must be nested within XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n' -}}\n {%- if messages[0].role == 'system' -%}\n {%- set content = render_content(messages[0].content, false, true)|trim -%}\n {%- if content -%}\n {{- '\\n\\n' + content -}}\n {%- endif -%}\n {%- endif -%}\n {{- '<|im_end|>\\n' -}}\n{%- else -%}\n {%- if messages[0].role == 'system' -%}\n {%- set content = render_content(messages[0].content, false, true)|trim -%}\n {%- if content -%}\n {{- '<|im_start|>system\\n' + (reasoning_instructions + '\\n\\n' if reasoning_instructions else '') + content + '<|im_end|>\\n' -}}\n {%- elif reasoning_instructions -%}\n {{- '<|im_start|>system\\n' + reasoning_instructions + '<|im_end|>\\n' -}}\n {%- endif -%}\n {%- elif reasoning_instructions -%}\n {{- '<|im_start|>system\\n' + reasoning_instructions + '<|im_end|>\\n' -}}\n {%- endif -%}\n{%- endif -%}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) -%}\n{%- for message in messages[::-1] -%}\n {%- set index = (messages|length - 1) - loop.index0 -%}\n {%- if ns.multi_step_tool and message.role == \"user\" -%}\n {%- set content = render_content(message.content, false)|trim -%}\n {%- if not(content.startswith('') and content.endswith('')) -%}\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 {{- raise_exception('No user query found in messages.') -}}\n{%- endif -%}\n{%- for message in messages -%}\n {%- set content = render_content(message.content, true)|trim -%}\n {%- if message.role == \"system\" -%}\n {%- if not loop.first -%}\n {{- raise_exception('System message must be at the beginning.') -}}\n {%- endif -%}\n {%- elif message.role == \"user\" -%}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>\\n' -}}\n {%- elif message.role == \"assistant\" -%}\n {%- set reasoning_content = '' -%}\n {%- if message.reasoning_content is string -%}\n {%- set reasoning_content = message.reasoning_content -%}\n {%- endif -%}\n {%- set reasoning_content = reasoning_content|trim -%}\n {%- if preserve_thinking is undefined or preserve_thinking is true or loop.index0 > ns.last_query_index -%}\n {{- '<|im_start|>' + message.role + '\\n\\n' + reasoning_content + '\\n\\n\\n' + content -}}\n {%- else -%}\n {{- '<|im_start|>' + message.role + '\\n' + content -}}\n {%- endif -%}\n {%- if 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 -%}\n {%- set tool_call = tool_call.function -%}\n {%- endif -%}\n {%- if loop.first -%}\n {%- if content|trim -%}\n {{- '\\n\\n\\n\\n' -}}\n {%- else -%}\n {{- '\\n\\n' -}}\n {%- endif -%}\n {%- else -%}\n {{- '\\n\\n\\n' -}}\n {%- endif -%}\n {%- if tool_call.arguments is defined and tool_call.arguments != '' -%}\n {%- for args_name, args_value in tool_call.arguments|items -%}\n {{- '\\n' -}}\n {%- set args_value = args_value | string if args_value is string else args_value | tojson | safe -%}\n {{- args_value -}}\n {{- '\\n\\n' -}}\n {%- endfor -%}\n {%- endif -%}\n {{- '\\n' -}}\n {%- endfor -%}\n {%- endif -%}\n {{- '<|im_end|>\\n' -}}\n {%- elif message.role == \"tool\" -%}\n {%- if loop.previtem and loop.previtem.role != \"tool\" -%}\n {{- '<|im_start|>user' -}}\n {%- endif -%}\n {{- '\\n\\n' -}}\n {{- content -}}\n {{- '\\n' -}}\n {%- if not loop.last and loop.nextitem.role != \"tool\" -%}\n {{- '<|im_end|>\\n' -}}\n {%- elif loop.last -%}\n {{- '<|im_end|>\\n' -}}\n {%- endif -%}\n {%- else -%}\n {{- raise_exception('Unexpected message role.') -}}\n {%- endif -%}\n{%- endfor -%}\n{%- if add_generation_prompt -%}\n {{- '<|im_start|>assistant\\n' -}}\n {%- if not current_thinking -%}\n {{- '\\n\\n\\n\\n' -}}\n {%- else -%}\n {{- '\\n' -}}\n {%- endif -%}\n{%- endif -%}\n" }