forked from EngineX-Cambricon/enginex-mlu370-vllm
add qwen3
This commit is contained in:
40
vllm-v0.6.2/examples/tool_chat_template_granite.jinja
Normal file
40
vllm-v0.6.2/examples/tool_chat_template_granite.jinja
Normal file
@@ -0,0 +1,40 @@
|
||||
{%- if tools %}
|
||||
{{- '<|start_of_role|>available_tools<|end_of_role|>
|
||||
' }}
|
||||
{%- for tool in tools %}
|
||||
{{- tool | tojson(indent=4) }}
|
||||
{%- if not loop.last %}
|
||||
{{- '
|
||||
|
||||
' }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{{- '<|end_of_text|>
|
||||
' }}
|
||||
{%- endif %}
|
||||
|
||||
{%- for message in messages %}
|
||||
{%- if message['role'] == 'system' %}
|
||||
{{- '<|start_of_role|>system<|end_of_role|>' + message['content'] + '<|end_of_text|>
|
||||
' }}
|
||||
{%- elif message['role'] == 'user' %}
|
||||
{{- '<|start_of_role|>user<|end_of_role|>' + message['content'] + '<|end_of_text|>
|
||||
' }}
|
||||
{%- elif message['role'] == 'assistant_tool_call' or (message['role'] == 'assistant' and message.tool_calls is defined) %}
|
||||
{{- '<|start_of_role|>assistant<|end_of_role|>' }}
|
||||
{% for tc in message.tool_calls %}
|
||||
{{- '<|tool_call|> ' + {'name': tc.function.name, 'arguments': tc.function.arguments}|tojson }}
|
||||
{% endfor %}
|
||||
{{- '<|end_of_text|>
|
||||
' }}
|
||||
{%- elif message['role'] == 'assistant' %}
|
||||
{{- '<|start_of_role|>assistant<|end_of_role|>' + message['content'] + '<|end_of_text|>
|
||||
' }}
|
||||
{%- elif message['role'] == 'tool_response' or message['role'] == 'tool' %}
|
||||
{{- '<|start_of_role|>tool_response<|end_of_role|>' + message['content'] + '<|end_of_text|>
|
||||
' }}
|
||||
{%- endif %}
|
||||
{%- if loop.last and add_generation_prompt %}
|
||||
{{- '<|start_of_role|>assistant<|end_of_role|>' }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
Reference in New Issue
Block a user