common : default content to an empty string (#18485)

* common : default content to an empty string

* common : fix tests that break when content != null
This commit is contained in:
Aldehir Rojas
2025-12-30 12:00:57 -06:00
committed by GitHub
parent ac1d0eb7bf
commit 0f89d2ecf1
3 changed files with 9 additions and 7 deletions
+3 -3
View File
@@ -38,7 +38,7 @@ Example function tool call syntax:
{%- if message['role'] == 'user' -%}
{{- '<User>' + message['content'] + '<end▁of▁sentence>' -}}
{%- endif -%}
{%- if message['role'] == 'assistant' and message['content'] is none -%}
{%- if message['role'] == 'assistant' and not message['content'] -%}
{{- '<Assistant><tool▁calls▁begin>' -}}
{%- set ns.is_first = true -%}
{%- for tc in message['tool_calls'] -%}
@@ -53,7 +53,7 @@ Example function tool call syntax:
{%- endfor -%}
{{- '<tool▁calls▁end><end▁of▁sentence>' -}}
{%- endif -%}
{%- if message['role'] == 'assistant' and message['content'] is not none -%}
{%- if message['role'] == 'assistant' and message['content'] -%}
{{- flush_tool_outputs() -}}
{%- set content = message['content'] -%}
{%- if '</think>' in content -%}
@@ -73,4 +73,4 @@ Example function tool call syntax:
{{- flush_tool_outputs() -}}
{%- if add_generation_prompt and not ns.is_tool_outputs -%}
{{- '<Assistant><think>\n' -}}
{%- endif -%}
{%- endif -%}