Skip to content

minimax-m2 outputs <tool_calls> instead of <minimax:tool_call> #14

@qandrew

Description

@qandrew

你好 Minimax developers,

When I try to use minimax for a function call in vLLM, it outputs <tool_calls> tokens instead of <minimax:tool_call> tokens, which is what the minimax_m2 parser expects: https://github.com/vllm-project/vllm/blob/main/vllm/entrypoints/openai/tool_parsers/minimax_m2_tool_parser.py#L37.

Is this expected behavior? If I use --tool-call-parser minimax then I can parse properly. I see vLLM recommends using the minimax_m2 parser however: https://docs.vllm.ai/projects/recipes/en/latest/MiniMax/MiniMax-M2.html

Thanks in advance!

server

vllm serve MiniMaxAI/MiniMax-M2     --tensor-parallel-size 4     --tool-call-parser minimax_m2     --reasoning-parser minimax_m2_append_think     --enable-auto-tool-choice     --chat-template examples/tool_chat_template_minimax_m1.jinja     --port 8000

client

[[email protected] /data/users/axia/gitrepos/vllm (func_call_2_minimax)]$ curl http://localhost:8000/v1/responses \
  -H "Content-Type: application/json" \
  -N \
  -d '{
    "model": "MiniMaxAI/MiniMax-M2",
    "input": [
      {
        "role": "user",
        "content": "What is the horoscope for Leo today?"
      }
    ],
    "tools": [
      {
        "type": "custom",
        "name": "get_horoscope",
        "description": "Get today’s horoscope for an astrological sign.",
        "parameters": {
          "type": "object",
          "properties": {
            "sign": {
              "type": "string",
              "description": "Astrological sign, e.g. Aries, Taurus, Gemini, etc."
            }
          },
          "required": ["sign"]
        }
      }
    ],
    "temperature": 0.7,
    "max_output_tokens": 256
  }'

response

{
    "id": "resp_7ac22ac8a43e4d619435faf74ea3f3e2",
    "created_at": 1761772334,
    "incomplete_details": null,
    "instructions": null,
    "metadata": null,
    "model": "MiniMaxAI/MiniMax-M2",
    "object": "response",
    "output": [
        {
            "id": "msg_c9dac216687f4847bbd75fa7daf567a2",
            "content": [
                {
                    "annotations": [],
                    "text": "<think><think>\nAlright, the user is asking for the horoscope for Leo today. This is a straightforward request that I can fulfill using the tools available to me.\n\nLooking at my tools, I have access to a \"get_horoscope\" tool that can provide today's horoscope for an astrological sign. This is exactly what I need for this request.\n\nThe tool requires a parameter called \"sign\" which should be the astrological sign the user is interested in. In this case, the user specifically asked for Leo, so I'll need to pass \"Leo\" as the sign parameter.\n\nThe format for the tool call is to use the <tool_calls></tool_calls> XML tags and provide a JSON object with the tool name and arguments. For this case, I'll need:\n- name: \"get_horoscope\"\n- arguments: {\"sign\": \"Leo\"}\n\nThis should retrieve today's horoscope for Leo, which is what the user is asking for. I don't need to provide any additional information or clarification since the request is clear and specific.\n\nOnce I make this tool call, the system will return the horoscope information for Leo today, which I can then present to the user. Since this is a simple factual query that can be answered directly by the tool, I don't need to provide any additional context or explanation beyond what the tool returns.\n\nI'll go ahead and make the tool call to get the horoscope for Leo today.\n</think>\n\n<tool_calls>\n{\"name\": \"get_horoscope\", \"arguments\": {\"sign\": \"Leo\"}}\n</tool_calls>",
                    "type": "output_text",
                    "logprobs": null
                }
            ],
            "role": "assistant",
            "status": "completed",
            "type": "message"
        }
    ],
    "parallel_tool_calls": true,
    "temperature": 0.7,
    "tool_choice": "auto",
    "tools": [
        {
            "name": "get_horoscope",
            "type": "custom",
            "description": "Get today’s horoscope for an astrological sign.",
            "format": null,
            "parameters": {
                "type": "object",
                "properties": {
                    "sign": {
                        "type": "string",
                        "description": "Astrological sign, e.g. Aries, Taurus, Gemini, etc."
                    }
                },
                "required": [
                    "sign"
                ]
            }
        }
    ],
    "top_p": 0.95,
    "background": false,
    "max_output_tokens": 1000,
    "max_tool_calls": null,
    "previous_response_id": null,
    "prompt": null,
    "reasoning": null,
    "service_tier": "auto",
    "status": "completed",
    "text": null,
    "top_logprobs": null,
    "truncation": "disabled",
    "usage": {
        "input_tokens": 246,
        "input_tokens_details": {
            "cached_tokens": 240,
            "input_tokens_per_turn": [],
            "cached_tokens_per_turn": []
        },
        "output_tokens": 316,
        "output_tokens_details": {
            "reasoning_tokens": 0,
            "tool_output_tokens": 0,
            "output_tokens_per_turn": [],
            "tool_output_tokens_per_turn": []
        },
        "total_tokens": 562
    },
    "user": null,
    "input_messages": null,
    "output_messages": null
}

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