***.***.custom.input_schema: input_schema does not support oneOf, allOf, or anyO...

2026年10月23日 11:07 14.28 秒 success

错误信息

***.***.custom.input_schema: input_schema does not support oneOf, allOf, or anyOf at the top level (request id: 202610230307060243405938268d9d64ig5SE9B)

AI 解决方案

🌐 错误翻译


原文:***.***.custom.input_schema: input_schema does not support oneOf, allOf, or anyOf at the top level (request id: 202610230307060243405938268d9d64ig5SE9B)
译文:***.***.custom.input_schema:input_schema 不支持在顶层使用 oneOf、allOf 或 anyOf(请求ID:202610230307060243405938268d9d64ig5SE9B)

🎯 原因分析


该错误源于自定义接口的 input_schema 配置,平台对JSON Schema 格式有明确限制,不允许在顶层直接使用 oneOf、allOf、anyOf 这类组合型结构,这类结构会导致Schema校验逻辑无法适配,从而触发报错。

💡 解决方案


将顶层的 oneOf/allOf/anyOf 拆解为基础对象,通过合并属性或嵌套层级替代组合结构,示例如下:
// 修复前(顶层使用oneOf,会报错)
{
  "type": "object",
  "oneOf": [
    {
      "properties": {
        "name": {"type": "string"}
      }
    },
    {
      "properties": {
        "age": {"type": "number"}
      }
    }
  ]
}

// 修复后(拆分结构,规避限制)
{
  "type": "object",
  "properties": {
    "name": {"type": "string"},
    "age": {"type": "number"}
  },
  "required": ["name", "age"]
}

🛡️ 预防措施


  • 编写 input_schema 时,优先使用单一 object + properties 的基础结构,避免在顶层使用组合型Schema关键字

  • 使用JSON Schema校验工具(如JSON Schema Lint)提前检查Schema格式,确保符合平台规则