guarin HF Staff commited on
Commit
707ff60
·
verified ·
1 Parent(s): bdf8cbd

Update chat template

Browse files
Files changed (1) hide show
  1. chat_template.jinja +6 -3
chat_template.jinja CHANGED
@@ -1,9 +1,12 @@
1
  {%- set tools = tools | default(none) -%}
2
  {%- set add_generation_prompt = add_generation_prompt | default(false) -%}
3
- {%- set reasoning_effort = reasoning_effort | default('medium') -%}
4
  {%- set cutoff_date = cutoff_date | default('2026-01-04') -%}
5
  {%- set current_date = current_date | default(strftime_now('%Y-%m-%d') if strftime_now is defined else none) -%}
6
- {%- set reasoning_effort_map = {'minimal': 1, 'low': 16, 'medium': 64, 'high': 256, 'xhigh': 512} -%}
 
 
 
7
 
8
  {#- Neutralise control sequences in caller-supplied text so it cannot be
9
  tokenized as structure. "<|" is broken because every special token has the
@@ -142,7 +145,7 @@
142
  {%- if tools -%}
143
  {%- set sys.parts = sys.parts + [render_tool_defs(tools) | trim] -%}
144
  {%- endif -%}
145
- {%- if reasoning_effort in reasoning_effort_map and 'reasoning strength:' not in ((ns.instructions if ns.instructions else '') | lower) -%}
146
  {%- set sys.parts = sys.parts + ['Reasoning strength: ' ~ reasoning_effort_map[reasoning_effort] ~ '.'] -%}
147
  {%- endif -%}
148
  {%- set sys.parts = sys.parts + [render_valid_recipients(tools) | trim] -%}
 
1
  {%- set tools = tools | default(none) -%}
2
  {%- set add_generation_prompt = add_generation_prompt | default(false) -%}
3
+ {%- set reasoning_effort = reasoning_effort | default('xhigh', true) -%}
4
  {%- set cutoff_date = cutoff_date | default('2026-01-04') -%}
5
  {%- set current_date = current_date | default(strftime_now('%Y-%m-%d') if strftime_now is defined else none) -%}
6
+ {%- set reasoning_effort_map = {'low': 8, 'medium': 32, 'high': 256, 'xhigh': 512} -%}
7
+ {%- if not (reasoning_effort is string and reasoning_effort in reasoning_effort_map) -%}
8
+ {{- raise_exception('Unsupported reasoning_effort: ' ~ reasoning_effort ~ '. Expected one of: low, medium, high, xhigh.') -}}
9
+ {%- endif -%}
10
 
11
  {#- Neutralise control sequences in caller-supplied text so it cannot be
12
  tokenized as structure. "<|" is broken because every special token has the
 
145
  {%- if tools -%}
146
  {%- set sys.parts = sys.parts + [render_tool_defs(tools) | trim] -%}
147
  {%- endif -%}
148
+ {%- if 'reasoning strength:' not in ((ns.instructions if ns.instructions else '') | lower) -%}
149
  {%- set sys.parts = sys.parts + ['Reasoning strength: ' ~ reasoning_effort_map[reasoning_effort] ~ '.'] -%}
150
  {%- endif -%}
151
  {%- set sys.parts = sys.parts + [render_valid_recipients(tools) | trim] -%}