{%- set tools = tools | default(none) -%} {%- set add_generation_prompt = add_generation_prompt | default(false) -%} {%- set reasoning_effort = reasoning_effort | default('medium') -%} {%- set cutoff_date = cutoff_date | default('2026-01-04') -%} {%- set current_date = current_date | default(strftime_now('%Y-%m-%d') if strftime_now is defined else none) -%} {%- set reasoning_effort_map = {'minimal': 1, 'low': 16, 'medium': 64, 'high': 256, 'xhigh': 512} -%} {#- Neutralise control sequences in caller-supplied text so it cannot be tokenized as structure. "<|" is broken because every special token has the form "<|...|>"; the bare media placeholders are broken because the multimodal processor rewrites them positionally and a literal one in text would desynchronise placeholders from the attached media. -#} {%- macro esc(value) -%} {{- value | string | replace('<|', '< |') | replace('', '< image>') | replace('