[GH-ISSUE #874] 【问题】关于无参数 tool 的 jsonSchema 兼容问题 #518

Closed
opened 2026-10-26 21:22:37 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @noear on GitHub (May 18, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-V3/issues/874

我们是一个 ai 应用开发框架的项目(solon-ai)。在适配无参数 tool 的 jsonSchema 时,碰到了一个兼容问题:

  • 使用 paramters:{} 表示无参时,DeepSeek-V3 会出错(接口地址: https://api.deepseek.com/chat/completions )。提示没有 type=object 的申明。但在已测的几个国内与国外模型,都是ok的。 //看 openai 的接口文档,是这种方式

  • 当使用 paramters:{type:object, properties:{}} 表示无参时。DeepSeek-V3 是ok的,已测的几个国内模型也是ok的,但是国外的几个模型出错了(比如: gpt-4o , claude_3.5)

附一个(无参数的)工具示例:

public class Case10Tools {
    @ToolMapping(description = "杭州的假日景点介绍")
    public String spotIntro() {
        return "西湖,良渚遗址";
    }
}

附出错信息:

{"message":"Invalid schema for function 'spotIntro': schema must be a JSON Schema of 'type: \"object\"', got 'type: null'.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}

只有本地 tool 时,是可以通过方言的方式进行适配。。。但在 mcp 环境下,就不能适配了。。。生成的 jsonSchema,最后不知道是给哪个模型用的。


希望 DeepSeek-V3 能支持 paramters:{} 这种无参申明。。。。我也会去 gpt-4o , claude_3.5 那儿反馈下,希望能支持 paramters:{type:object, properties:{}}

Originally created by @noear on GitHub (May 18, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-V3/issues/874 我们是一个 ai 应用开发框架的项目(solon-ai)。在适配无参数 tool 的 jsonSchema 时,碰到了一个兼容问题: * 使用 `paramters:{}` 表示无参时,DeepSeek-V3 会出错(接口地址: https://api.deepseek.com/chat/completions )。提示没有 type=object 的申明。但在已测的几个国内与国外模型,都是ok的。 //看 openai 的接口文档,是这种方式 * 当使用 `paramters:{type:object, properties:{}}` 表示无参时。DeepSeek-V3 是ok的,已测的几个国内模型也是ok的,但是国外的几个模型出错了(比如: gpt-4o , claude_3.5) 附一个(无参数的)工具示例: ```java public class Case10Tools { @ToolMapping(description = "杭州的假日景点介绍") public String spotIntro() { return "西湖,良渚遗址"; } } ``` 附出错信息: ``` {"message":"Invalid schema for function 'spotIntro': schema must be a JSON Schema of 'type: \"object\"', got 'type: null'.","type":"invalid_request_error","param":null,"code":"invalid_request_error"} ``` --- 只有本地 tool 时,是可以通过方言的方式进行适配。。。<mark>但在 mcp 环境下</mark>,就不能适配了。。。生成的 jsonSchema,最后不知道是给哪个模型用的。 --- 希望 DeepSeek-V3 能支持 `paramters:{}` 这种无参申明。。。。我也会去 gpt-4o , claude_3.5 那儿反馈下,希望能支持 `paramters:{type:object, properties:{}}`
Author
Owner

@songhanghang commented on GitHub (May 18, 2025):

+1 +2 +3

<!-- gh-comment-id:2888945967 --> @songhanghang commented on GitHub (May 18, 2025): +1 +2 +3
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepSeek-V3#518
No description provided.