From 1816e8a829630b075286a43e2e4d6404f3fb46b8 Mon Sep 17 00:00:00 2001 From: keiten arch Date: Sun, 22 Feb 2026 19:43:22 +0900 Subject: [PATCH] fix(provider): disable native tool calling for MiniMax MiniMax API does not support OpenAI-style native tool definitions (`tools` parameter in chat completions). Sending them causes a 500 Internal Server Error with "unknown error (1000)" on every request. Add a `native_tool_calling` field to `OpenAiCompatibleProvider` so each constructor can declare its tool-calling capability independently. MiniMax (via `new_merge_system_into_user`) now sets this to `false`, causing the agent loop to inject tool instructions into the system prompt as text instead of sending native JSON tool definitions. Closes #1387 Co-Authored-By: Claude Opus 4.6 (cherry picked from commit 2b92a774fbef9636f2e968609845bc9a5192285b) --- src/providers/compatible.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/providers/compatible.rs b/src/providers/compatible.rs index f0f403c0c..605716ea1 100644 --- a/src/providers/compatible.rs +++ b/src/providers/compatible.rs @@ -33,8 +33,8 @@ pub struct OpenAiCompatibleProvider { /// to the first `user` message, then drop the system messages. /// Required for providers that reject `role: system` (e.g. MiniMax). merge_system_into_user: bool, - /// Whether this provider supports OpenAI-style native tool definitions - /// in API payloads. + /// Whether this provider supports OpenAI-style native tool calling. + /// When false, tools are injected into the system prompt as text. native_tool_calling: bool, } @@ -2394,16 +2394,19 @@ mod tests { } #[test] - fn merge_system_constructor_disables_native_tool_calling() { + fn minimax_provider_disables_native_tool_calling() { let p = OpenAiCompatibleProvider::new_merge_system_into_user( "MiniMax", - "https://api.minimaxi.com/v1", + "https://api.minimax.chat/v1", Some("k"), AuthStyle::Bearer, ); let caps = ::capabilities(&p); - assert!(!caps.native_tool_calling); - assert!(!p.supports_native_tools()); + assert!( + !caps.native_tool_calling, + "MiniMax should use prompt-guided tool calling, not native" + ); + assert!(!caps.vision); } #[test]