status_code=400, The parameter `***.type` specified in the request are not valid...
错误信息
status_code=400, The parameter `***.type` specified in the request are not valid: `The parameter `type` specified in the request are not valid: unknown tool type: tool_search.`.
AI 解决方案
🌐 错误翻译
原文:status_code=400, The parameter `***.type` specified in the request are not valid: `The parameter `type` specified in the request are not valid: unknown tool type: tool_search.`
译文:状态码=400,请求中指定的参数`***.type`无效:请求中指定的`type`参数无效:未知的工具类型:tool_search
🎯 原因分析
tool_search,导致参数校验失败type字段的取值不符合API允许的工具类型规范,属于请求参数配置错误💡 解决方案
// 修复后的工具类型配置(示例)
const tools = [
// 替换为平台支持的工具类型,例如function/search等
{
type: "function",
function: {
name: "your_valid_tool",
description: "有效的工具描述",
parameters: { /* 正确的参数结构 */ }
}
}
];
🛡️ 预防措施
type取值范围,避免传入非法值