Bedrock Runtime: InvokeModel, https response error StatusCode: 400, RequestID: d...
🚨 错误信息
InvokeModel: operation error Bedrock Runtime: InvokeModel, https response error StatusCode: 400, RequestID: d86acb01-0221-4f80-9a44-9cb84190bfde, ValidationException: tools.0: Input tag 'function' found using 'type' does not match any of the expected tags: 'bash_20250124', 'custom', 'text_editor_20250124', 'text_editor_20250429', 'text_editor_20250728' (request id: 20251209222318520719231jTxxfBSw) (request id: 20251209222308497447090nUzSwJYj) (request id: 202512092223084301757991cnaSvhr) (request id: 20251209222211553314405u3WPQL73)
🤖 AI解决方案
错误翻译
原文:ValidationException: tools.0: Input tag 'function' found using 'type' does not match any of the expected tags: 'bash_20250124', 'custom', 'text_editor_20250124', 'text_editor_20250429', 'text_editor_20250728'
译文:验证异常:使用'type'找到的输入标签'function'与任何预期标签都不匹配:'bash_20250124'、'custom'、'text_editor_20250124'、'text_editor_20250429'、'text_editor_20250728'
原因分析
这是一个AWS Bedrock API调用时的工具类型验证错误。在请求中指定了工具类型为'function',但Bedrock Runtime只支持特定的工具类型,包括各种版本的文本编辑器和bash工具。
解决方案
json
{
"tools": [
{
"toolSpec": {
"name": "你想要使用的工具名称",
"description": "工具描述",
"inputSchema": {
"json": {
"type": "object",
"properties": {
// 具体属性定义
},
"required": ["必需参数"]
}
}
}
}
]
}
具体修复步骤:
tools配置-
text_editor_20250124-
text_editor_20250429 -
text_editor_20250728-
bash_20250124-
custom