Update chat_template.jinja

#13
by mayankagarwal - opened
Files changed (1) hide show
  1. chat_template.jinja +4 -2
chat_template.jinja CHANGED
@@ -75,8 +75,10 @@
75
  {{- "<|im_start|>" + message.role + "\n" -}}
76
  {%- if message.role == "assistant" -%}
77
  {%- generation -%}
78
- {%- if message.thinking is defined and (preserve_thinking or loop.index0 > ns.last_user_index) -%}
79
- {{- "<think>" + message.thinking + "</think>" -}}
 
 
80
  {%- endif -%}
81
  {%- set _cfm_tag = "CONTINUE_FINAL_MESSAGE_TAG " -%}
82
  {%- set _has_cfm = false -%}
 
75
  {{- "<|im_start|>" + message.role + "\n" -}}
76
  {%- if message.role == "assistant" -%}
77
  {%- generation -%}
78
+ {%- set thinking = message.thinking or message.reasoning or message.reasoning_content -%}
79
+ {%- set thinking = thinking if thinking is string else "" -%}
80
+ {%- if thinking and (preserve_thinking or loop.index0 > ns.last_user_index) -%}
81
+ {{- "<think>" + thinking + "</think>" -}}
82
  {%- endif -%}
83
  {%- set _cfm_tag = "CONTINUE_FINAL_MESSAGE_TAG " -%}
84
  {%- set _has_cfm = false -%}