Incomplete tool call arguments in HuggingFaceTB/SmolLM3-3B streaming output
Author: dvn8weil
Pull request: no
Labels: name: bug

### System Info

- `transformers` version: 4.53.3
- Platform: Linux-6.14.0-1014-gcp-x86_64-with-glibc2.39
- Python version: 3.12.3
- Huggingface_hub version: 0.34.4
- Safetensors version: 0.6.2
- Accelerate version: not installed
- Accelerate config: not found
- DeepSpeed version: not installed
- PyTorch version (accelerator?): 2.7.1+cu126 (CUDA)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using distributed or parallel set-up in script?: No
- Using GPU in script?: No
- GPU type: NVIDIA L4

### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

vllm setup : 

```
vllm serve HuggingFaceTB/SmolLM3-3B \
  --enable-auto-tool-choice \
  --tool-call-parser=hermes --reasoning-parser=qwen3
```

request as cURL : 

```
curl --location 'http://0.0.0.0:8000/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer EMPTY' \
--data '{
    "model": "HuggingFaceTB/SmolLM3-3B",
    "messages": [
        {
            "role": "system",
            "content": "You are a concise assistant that helps with tools."
        },
        {
            "role": "user",
            "content": "Tell me about Indian Democracy origin and then Can you add 23 and 51, and multiply 29 and 89"
        }
    ],
    "enable_thinking": false,
    "chat_template_kwargs": {
        "enable_thinking": false
    },
    "stream" : true,
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "get_current_weather",
                "description": "Get the current weather in a given location",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "location": {
                            "type": "string",
                            "description": "The city and state, e.g. San Francisco, CA"
                        },
                        "unit": {
                            "type": "string",
                            "enum": [
                                "celsius",
                                "fahrenheit"
                            ]
                        }
                    },
                    "required": [
                        "location"
                    ]
                }
            }
        },
        {
            "type": "function",
            "function": {
                "name": "add",
                "description": "adds two numbers\n",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "x": {
                            "type": "number",
                            "description": ""
                        },
                        "y": {
                            "type": "number",
                            "description": ""
                        }
                    },
                    "required": [
                        "x",
                        "y"
                    ]
                }
            }
        },
        {
            "type": "function",
            "function": {
                "name": "multiply",
                "description": "multiply two numbers\n",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "x": {
                            "type": "number",
                            "description": ""
                        },
                        "y": {
                            "type": "number",
                            "description": ""
                        }
                    },
                    "required": [
                        "x",
                        "y"
                    ]
                }
            }
        }
    ],
    "tool_choice": "auto"
}'
```

### Expected behavior

Output is : 
```
data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"content":null},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"id":"chatcmpl-tool-acf94c2655364429b96d82af14949d67","type":"function","index":0,"function":{"name":"get_current_weather"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\"location\": \""}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"New"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Delhi"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\","}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"unit"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"c"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"elsius"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"content":"\n"},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"id":"chatcmpl-tool-94268bea54114b139426a9d2c62b6bec","type":"function","index":1,"function":{"name":"add"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"{\"x\":"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":" "}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"51"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"}"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"content":"\n"},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"id":"chatcmpl-tool-6146714702e44bd4afbe37d822332fc9","type":"function","index":2,"function":{"name":"multiply"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":2,"function":{"arguments":"{\"x\":"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":2,"function":{"arguments":" "}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":2,"function":{"arguments":"89"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":2,"function":{"arguments":"}"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"content":""},"logprobs":null,"finish_reason":"tool_calls","stop_reason":null}]}

data: [DONE]

```

The tool calls are incomplete , i.e. for tool calls that require two arguments, only one is provided. For instance, this is the multiple tool call part of the output : 

```

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"id":"chatcmpl-tool-6146714702e44bd4afbe37d822332fc9","type":"function","index":2,"function":{"name":"multiply"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":2,"function":{"arguments":"{\"x\":"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":2,"function":{"arguments":" "}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":2,"function":{"arguments":"89"}}]},"logprobs":null,"finish_reason":null}]}

data: {"id":"chatcmpl-2eaecc77b750452fb0a1f326d07334b5","object":"chat.completion.chunk","created":1758130251,"model":"HuggingFaceTB/SmolLM3-3B","choices":[{"index":0,"delta":{"tool_calls":[{"index":2,"function":{"arguments":"}"}}]},"logprobs":null,"finish_reason":null}]}

```
i.e. the tool call output is `multiply {x: 89}` , when it also needs the `y` parameter value


Comments:
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.