status_code=400, Failed to deserialize the JSON body into the target type: messa...
错误信息
status_code=400, Failed to deserialize the JSON body into the target type: messages[0].role: unknown variant `developer`, expected one of `system`, `user`, `assistant`, `tool`, `latest_reminder` at line 1 column 60
AI 解决方案
1. 🌐 错误翻译
原文:status_code=400, Failed to deserialize the JSON body into the target type: messages[0].role: unknown variant `developer`, expected one of `system`, `user`, `assistant`, `tool`, `latest_reminder` at line 1 column 60
译文:状态码=400,无法将JSON正文反序列化为目标类型:messages[0].role:未知变体`developer`,预期值为`system`、`user`、`assistant`、`tool`、`latest_reminder`之一,位于第1行第60列
2. 🎯 原因分析
messages[0].role字段使用了无效值developer,接口仅支持枚举值system、user、assistant、tool、latest_reminder。role字段赋值错误。3. 💡 解决方案
修改
messages[0].role字段值,替换为接口允许的枚举值(例如user),以下是修复后的JSON示例:{
"messages": [
{
"role": "user",
"content": "请帮我生成一段Python代码"
}
]
}