": { "type": "<nil>", "message": "InvokeModel: operation error Bedrock Runtime: ...
🚨 错误信息
{
"error": {
"type": "<nil>",
"message": "InvokeModel: operation error Bedrock Runtime: InvokeModel, https response error StatusCode: 400, RequestID: bea06859-9de4-43d8-84d0-c99a678c5fa2, ValidationException: tools.0: Input tag 'web_search_20250305' 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: 20260203220616407633679NvkrE70A)"
},
"type": "error"
}
🤖 AI解决方案
错误分析报告
1. 错误翻译
原文:ValidationException: tools.0: Input tag 'web_search_20250305' found using 'type' does not match any of the expected tags: 'bash_20250124', 'custom', 'text_editor_20250124', 'text_editor_20250429', 'text_editor_20250728'
译文:验证异常:tools.0:使用'type'找到的输入标签'web_search_20250305'与任何预期的标签不匹配:'bash_20250124'、'custom'、'text_editor_20250124'、'text_editor_20250429'、'text_editor_20250728'
2. 原因分析
这是一个AWS Bedrock服务调用时发生的参数验证错误:
web_search_20250305 在当前Bedrock模型的工具列表中不被支持tools参数中,第一个工具(索引0)的type字段3. 解决方案
方案A:如果不需要web_search工具
json
{
"tools": [
{
"type": "text_editor_20250728", // 使用最新支持的文本编辑器工具
// ... 其他工具配置
}
]
}
方案B:如果需要搜索功能
json
{
"tools": [
{
"type": "custom", // 使用自定义工具类型
"name": "web_search",
"description": "网络搜索工具",
"inputSchema": {
// 自定义输入模式
}
}
]
}
方案C:检查可用工具列表
python
import boto3bedrock = boto3.client('bedrock-runtime')
先调用模型描述API获取支持的tool类型
或者查看Bedrock文档获取特定模型的支持工具列表
4.️ 预防措施
最佳实践建议:
_20250305),确保使用的工具版本与模型版本兼容开发工具推荐:
aws bedrock list-foundation-models 查看可用模型---
注意:此错误表明Bedrock模型工具集已更新,web_search_20250305可能已被弃用或需要特定模型版本支持。建议查阅最新的AWS Bedrock文档获取准确信息。