fix: reassign xml_tools to tools to make it work with vllm
#9
by
XciD
HF Staff
- opened
- README.md +2 -2
- chat_template.jinja +5 -2
README.md
CHANGED
@@ -211,12 +211,12 @@ python -m sglang.launch_server --model-path HuggingFaceTB/SmolLM3-3B
|
|
211 |
#### vLLM
|
212 |
|
213 |
```bash
|
214 |
-
vllm serve HuggingFaceTB/SmolLM3-3B
|
215 |
```
|
216 |
|
217 |
#### Setting `chat_template_kwargs`
|
218 |
|
219 |
-
You can specify `chat_template_kwargs` such as `enable_thinking`
|
220 |
|
221 |
```bash
|
222 |
curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
|
|
|
211 |
#### vLLM
|
212 |
|
213 |
```bash
|
214 |
+
vllm serve HuggingFaceTB/SmolLM3-3B --enable-auto-tool-choice --tool-call-parser=hermes
|
215 |
```
|
216 |
|
217 |
#### Setting `chat_template_kwargs`
|
218 |
|
219 |
+
You can specify `chat_template_kwargs` such as `enable_thinking` to a deployed model by passing the `chat_template_kwargs` parameter in the API request.
|
220 |
|
221 |
```bash
|
222 |
curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
|
chat_template.jinja
CHANGED
@@ -42,9 +42,12 @@
|
|
42 |
{{- "You are a helpful AI assistant named SmolLM, trained by Hugging Face.\n\n" -}}
|
43 |
{%- endif -%}
|
44 |
|
45 |
-
{%- if xml_tools or python_tools -%}
|
46 |
{{- "### Tools\n\n" -}}
|
47 |
-
{%- if xml_tools -%}
|
|
|
|
|
|
|
48 |
{%- set ns = namespace(xml_tool_string="You may call one or more functions to assist with the user query.\nYou are provided with function signatures within <tools></tools> XML tags:\n\n<tools>\n") -%}
|
49 |
{%- for tool in xml_tools[:] -%} {# The slicing makes sure that xml_tools is a list #}
|
50 |
{%- set ns.xml_tool_string = ns.xml_tool_string ~ (tool | string) ~ "\n" -%}
|
|
|
42 |
{{- "You are a helpful AI assistant named SmolLM, trained by Hugging Face.\n\n" -}}
|
43 |
{%- endif -%}
|
44 |
|
45 |
+
{%- if xml_tools or python_tools or tools -%}
|
46 |
{{- "### Tools\n\n" -}}
|
47 |
+
{%- if xml_tools or tools -%}
|
48 |
+
{%- if tools -%}
|
49 |
+
{%- set xml_tools = tools -%}
|
50 |
+
{%- endif -%}
|
51 |
{%- set ns = namespace(xml_tool_string="You may call one or more functions to assist with the user query.\nYou are provided with function signatures within <tools></tools> XML tags:\n\n<tools>\n") -%}
|
52 |
{%- for tool in xml_tools[:] -%} {# The slicing makes sure that xml_tools is a list #}
|
53 |
{%- set ns.xml_tool_string = ns.xml_tool_string ~ (tool | string) ~ "\n" -%}
|