agentscope-java icon indicating copy to clipboard operation
agentscope-java copied to clipboard

[Bug]: MiniMax formatters drop tool_choice for ToolChoice.None but keep sending the tool definitions

Open wahllllll opened this issue 1 month ago • 1 comments

Describe the bug

ToolChoice.None is documented as "Prevent the model from calling any tools. The model will respond with text only."

MiniMax does not accept the tool_choice field, so both MiniMax formatters dropped it and sent nothing:

@Override
public void applyToolChoice(OpenAIRequest request, ToolChoice toolChoice) {
    request.setToolChoice(null);
}

That is only half the job. An absent tool_choice means auto to the OpenAI-compatible API, and request.getTools() was left untouched — so the tool definitions still went out and the model was still free to call them. ToolChoice.None was therefore silently a no-op on MiniMax: a request asking for text-only could come back as a tool call.

The same provider limitation is already handled correctly for GLM, in GLMFormatter.applyGLMToolChoice, which removes the tools for None.

To Reproduce

Send a request through the MiniMax formatter with ToolChoice.None set and at least one tool registered, then inspect the outgoing payload: the tool definitions are still present.

Expected behavior

ToolChoice.None means text-only. On a provider that cannot express tool_choice: none, the tools have to be removed from the request — which is what GLM already does.

Error messages

None. The request succeeds; it just is not the request that was asked for.

Environment (please complete the following information):

  • AgentScope-Java Version: 2.1.0-SNAPSHOT (main)
  • Java Version: 17
  • OS: Windows 11

Additional context

Files:

  • agentscope-extensions/agentscope-extensions-model/agentscope-extensions-model-openai/src/main/java/io/agentscope/extensions/model/openai/compat/minimax/MiniMaxFormatter.java
  • .../compat/minimax/MiniMaxMultiAgentFormatter.java — carries its own copy of the override

Only None changes. Auto / Required / Specific keep degrading to the API default and still send no tool_choice, which is the pre-existing behaviour.

Fixed in #3430.

wahllllll avatar Oct 11 '26 08:10 wahllllll

Note: this is already fixed on main by #3430 (merged 2026-10-06) — the issue is filed only so the fix has an issue to trace back to. Please close it if you would rather not track it.

wahllllll avatar Oct 11 '26 08:10 wahllllll