[Bugfix] set system_message in phi4mini chat template (#23309)
Signed-off-by: zhuangqh <zhuangqhc@gmail.com>
This commit is contained in:
@ -1,10 +1,14 @@
|
|||||||
{%- if messages %}
|
{%- if messages and messages[0]['role'] == 'system' %}
|
||||||
{%- if system_message or tools %}
|
{%- set system_message = messages[0]['content']|trim %}
|
||||||
<|system|>
|
{%- set messages = messages[1:] %}
|
||||||
|
{%- else %}
|
||||||
{%- if system_message %}
|
{%- set system_message = "You are a helpful assistant." %}
|
||||||
{{ system_message }}
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- if messages %}
|
||||||
|
<|system|>
|
||||||
|
{{ system_message }}
|
||||||
|
{%- if tools %}
|
||||||
In addition to plain text responses, you can chose to call one or more of the provided functions.
|
In addition to plain text responses, you can chose to call one or more of the provided functions.
|
||||||
|
|
||||||
Use the following rule to decide when to call a function:
|
Use the following rule to decide when to call a function:
|
||||||
@ -19,13 +23,11 @@ If you decide to call functions:
|
|||||||
* make sure you pick the right functions that match the user intent
|
* make sure you pick the right functions that match the user intent
|
||||||
|
|
||||||
|
|
||||||
{%- if tools %}
|
|
||||||
{%- for t in tools %}
|
{%- for t in tools %}
|
||||||
{{- t | tojson(indent=4) }}
|
{{- t | tojson(indent=4) }}
|
||||||
{{- "\n\n" }}
|
{{- "\n\n" }}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
{%- endif %}<|end|>
|
{%- endif %}<|end|>
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- for message in messages %}
|
{%- for message in messages %}
|
||||||
{%- if message.role != "system" %}
|
{%- if message.role != "system" %}
|
||||||
|
Reference in New Issue
Block a user