Skip to content

Does qwen2.5-coder support function calling? #180

Description

@Muuut

According to the documentation, I use VLLM to build a openai compatible server for qwen2.5-coder-7b-instruct.

That is my code

messages = [
    {
        "role": "user",
        "content": "Calculate how many r's are in the word 'strawberry'"
    }
]

# Define the tools
tools = [{
    "type": "function",
    "function": {
        "name": "execute_python",
        "description": "Execute python code in a Jupyter notebook cell and return result",
        "parameters": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "string",
                    "description": "The python code to execute in a single cell"
                }
            },
            "required": ["code"]
        }
    }
}]

# Generate text with OpenAI
response = client.chat.completions.create(
    model="qwen2.5-7B-coder",
    messages=messages,
    tools=tools,
)

However, I got this:
屏幕截图 2024-11-26 124247
The finish_reason is "stop" instead of "tool_calls", and the tool_calls is empty.
So I wonder whether qwen2.5-coder series support function calling?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions