Skip to content

[Bug]: GPT-OSS Tool Answer Role Object not working #25001

@larbikhalid

Description

@larbikhalid

Your current environment

docker run --runtime nvidia --gpus all \
    -v ~/.cache/huggingface:/root/.cache/huggingface \
    --env "HUGGING_FACE_HUB_TOKEN=$HF_TOKEN" \
    -p 8000:8000 \
    --ipc=host \
    **vllm/vllm-openai:v0.10.2** \
    --model openai/gpt-oss-20b
    --tool-call-parser openai \
    --enable-auto-tool-choice

🐛 Describe the bug

while this body works:

{
    "model": "openai/gpt-oss-20b",
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "text": "what is the weather in Paris",
                    "type": "text"
                }
            ]
        },
        {
            "role": "assistant",
            "tool_calls": [
                {
                    "function": {
                        "arguments": "{\"city\": \"Paris\"}",
                        "name": "get_weather"
                    },
                    "id": "chatcmpl-tool-aaae1ecc31344b9d94f69f52a0a4c52e",
                    "type": "function"
                }
            ]
        },
        {
            "role": "tool",
            "tool_call_id": "chatcmpl-tool-aaae1ecc31344b9d94f69f52a0a4c52e",
            "content": **"18 degrees"**
        }
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "get_weather",
                "description": "get weather using city.",
                "parameters": {
                    "type": "object",
                    "required": []
                }
            }
        }
    ],
    "tool_choice": "auto"
}

The next one does not;

{
    "model": "openai/gpt-oss-20b",
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "text": "what is the weather in Paris",
                    "type": "text"
                }
            ]
        },
        {
            "role": "assistant",
            "tool_calls": [
                {
                    "function": {
                        "arguments": "{\"city\": \"Paris\"}",
                        "name": "get_weather"
                    },
                    "id": "chatcmpl-tool-aaae1ecc31344b9d94f69f52a0a4c52e",
                    "type": "function"
                }
            ]
        },
        {
            "role": "tool",
            "tool_call_id": "chatcmpl-tool-aaae1ecc31344b9d94f69f52a0a4c52e",
            "content": **[
                {
                    "text": "18 degrees",
                    "type": "text"
                }
            ]**
        }
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "get_weather",
                "description": "get weather using city.",
                "parameters": {
                    "type": "object",
                    "required": []
                }
            }
        }
    ],
    "tool_choice": "auto"
}

the output is:

{
    "error": {
        "message": "1 validation error for Message\ncontent.0\n  Input should be a valid dictionary or instance of Content [type=model_type, input_value=[{'text': '18 degrees', 'type': 'text'}], input_type=list]\n    For further information visit https://errors.pydantic.dev/2.11/v/model_type None",
        "type": "BadRequestError",
        "param": null,
        "code": 400
    }
}

according to openai doc and the example in /docs of vllm swagger:
chat-create-messages-tool-message-content

tool message can also be an array

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions