Invalid JSON payload received. Unknown name "type" at tools[0].function declarat...

2025年11月19日 15:57 状态: processing

🚨 错误信息

Invalid JSON payload received. Unknown name "type" at tools[0].function declarations[15].***,properties[5].***,***,properties[2].***.***.p roperties[1].***,items': Proto field is not repeating, cannot start list. invalid JSON payload received. Unknown name "type" at tools[0].function declarations[15].***.properties[211.***,***.properties[2].***,*** items': Proto field is not repeating, cannot start list. Invalid JSON payload received.Unknown name "type" at tools[0l.function declarations[16].***.properties[5].******,properties[2].***.***.p roperties[1].***,items': Proto field is not repeating, cannot start list. Invalid JSON payload received. Unknown name "type" at tools[0].function declarations[16].***.properties[211.***,***.properties[2].***.*** items': Proto field is not repeating, cannot start list 请求错误,请检查请求参数是否正确。如果修改了模型设置,请重置到默认设置

🤖 AI解决方案

错误翻译



原文:Invalid JSON payload received. Unknown name "type" at tools[0].function declarations[15...], Proto field is not repeating, cannot start list
译文:接收到无效的JSON负载。在tools[0].function declarations[15...]位置出现未知名称"type",Proto字段不可重复,无法启动列表

原因分析


这是一个函数声明JSON schema配置错误,主要问题有:
  • 在函数声明的schema中使用了无效的"type"字段名

  • 尝试将非重复字段配置为列表格式

  • JSON结构不符合proto协议要求
  • 解决方案


    检查并修正函数声明的JSON schema结构:

    json
    {
    "tools": [{
    "function_declarations": [{
    // 移除无效的"type"字段
    "name": "function_name",
    "description": "函数描述",
    "parameters": {
    "type": "OBJECT", // 这里保持标准的type定义
    "properties": {
    // 确保字段类型正确,数组字段需要定义为重复类型
    "your_field": {
    "type": "ARRAY", // 正确的数组类型定义
    "items": {
    "type": "STRING" // 数组元素类型
    }
    }
    }
    }
    }]
    }]
    }

    ️ 预防措施


  • 使用JSON Schema验证工具:在部署前使用在线JSON验证器检查schema结构

  • 遵循标准proto协议规范:确保所有字段定义符合protobuf格式要求

  • 逐步测试:逐个函数声明进行测试验证,避免批量配置错误
  • 建议重置模型设置到默认配置,然后逐步重新配置函数声明。