使用玄武 CLI 的 OpenAI 兼容 API 时,工具调用(tool calling / function calling)功能失败,错误信息:
400 "auto" tool choice requires --enable-auto-tool-choice and --tool-call-parser to be set
复现步骤
- 启动模型服务:
xw run qwen3-32b
- 使用cherry studio或openclaw调用 API 端点:
http://localhost:11581/v1/chat/completions
- 发送包含
tool_choice: "auto" 或 functions 参数的请求
- 返回 400 错误
预期行为
工具调用功能应该能够正常工作,与标准 VLLM 加上 --enable-auto-tool-choice --tool-call-parser qwen 参数后的行为一致。
环境信息
- 操作系统:OpenEuler
- 硬件:Ascend 910B
- 玄武 CLI 版本:[
xw version 查看]
- 模型:qwen3-32b
- 推理引擎:vllm-ascend
补充说明
后端需要启用 --enable-auto-tool-choice 和 --tool-call-parser 参数才能支持工具调用。请考虑添加配置选项来启用这些功能,或者在文档中说明如何在玄武 CLI 中配置工具调用。
建议
- 在
xw serve 命令中添加 --enable-auto-tool-choice 和 --tool-call-parser 参数支持
- 或者在配置文件中添加工具调用相关的配置项
- 更新文档,说明如何启用和使用工具调用功能