/MainProcess] 22208184909825/agent-e80a0 agent invoke chat to retry again llm er...
错误信息
[2025-09-03 11:10:25,969: ERROR/MainProcess] 22208184909825/agent-e80a0 agent invoke chat to retry again llm error: Error code: 400 - {'error': {'message': "Invalid schema for function 'self_intent_recognition_0': None is not of type 'array'. (request id: 20250903110948261917640BBDOPt2p)", 'type': 'openai_error', 'param': '', 'code': 'invalid_function_parameters'}}
AI 解决方案
报错分析报告
1.错误翻译
原文:Invalid schema for function 'self_intent_recognition_0': None is not of type 'array'. (request id: 20250903110948261917640BBDOPt2p)
译文:函数“self_intent_recognition_0”的 schema 无效:None 不是“array”类型。(请求ID: 20250903110948261917640BBDOPt2p)
2.原因分析
self_intent_recognition_0的参数 schema 中,某字段预期为array类型,但实际传入了None。 None)。3.解决方案
以Python OpenAI Function Calling 为例,修复参数 schema 和传值:
# 修复前(错误):某字段允许None而非array
# function_schema = {
# "name": "self_intent_recognition_0",
# "parameters": {
# "type": "object",
# "properties": {
# "intents": {"type": "array"}, # 实际传参时给了None
# },
# "required": ["intents"]
# }
# }
# 修复后(正确):确保字段为array,默认空数组
function_schema = {
"name": "self_intent_recognition_0",
"parameters": {
"type": "object",
"properties": {
"intents": {
"type": "array",
"items": {"type": "string"}, # 示例:数组元素类型
"default": [] # 默认值设为空数组,避免None
}
},
"required": ["intents"]
}
}
# 调用时传参(确保非None)
params = {"intents": []} # 或填充实际数组值,如["查询天气", "设置闹钟"]
4. 预防措施
default指定数组字段的默认值为空数组[],禁止None。 ---
注:若需更精准修复,请提供self_intent_recognition_0的完整 schema 定义。