-
-
Notifications
You must be signed in to change notification settings - Fork 181
Closed
Labels
Description
问题描述
在使用某些站的 AWS Bedrock 的claude-opus-4-5-20251101-thinking模型时,如果对话中包含工具调用(Tool Use),在进行后续对话时会触发 400 ValidationException 错误,并且对话会被中断不会继续重试其他提供商。
原因分析: AWS Bedrock 在开启 Thinking 模式时有严格的格式校验:助手消息(Assistant Message)如果包含 tool_use,则必须在其紧邻的前方包含一个 thinking 块。 目前的报错信息显示 Expected 'thinking' ..., but found 'tool_use',这说明 CCH 在处理或转发对话历史(Conversation History)时,可能过滤掉了上一轮的 thinking 内容,或者未正确保留 thinking 与 tool_use 的配对结构,导致直接发送了裸露的 tool_use 给上游,从而触发校验失败。
错误日志
returned 400: param_error: Invalid param: InvokeModel: operation error Bedrock Runtime: InvokeModel, https response error StatusCode: 400, RequestID: 5b957a73-74d0-48a9-ae59-54f007b44350, ValidationException: ***.***.***.***.type: Expected `thinking` or `redacted_thinking`, but found `tool_use`. When `thinking` is enabled, a final `assistant` message must start with a thinking block (preceeding the lastmost set of `tool_use` and `tool_result` blocks). We recommend you include thinking blocks from previous turns. To avoid this requirement, disable `thinking`. Please consult our documentation at https://***.com/***/***/***/*** (request id: 20251231101940404325615wOUj2Klr) (request id: 20251231101938782403885J0Bmyjrg) | Upstream: {"error":{"type":"param_error","message":"Invalid param: InvokeModel: operation error Bedrock Runtime: InvokeModel, https response error StatusCode: 400, RequestID: 5b957a73-74d0-48a9-ae59-54f007b44350, ValidationException: ***.***.***.***.type: Expected `thinking` or `redacted_thinking`, but found `tool_use`. When `thinking` is enabled, a final `assistant` message must start with a thinking block (preceeding the lastmost set of `tool_use` and `tool_result` blocks). We recommend you include thinking blocks from previous turns. To avoid this requirement, disable `thinking`. Please consult our documentation at https://***.com/***/***/***/*** (request id: 20251231101940404325615wOUj2Klr) (request id: 20251231101938782403885J0Bmyjrg)"},"type":"error"}
期望行为
希望 CCH 在处理 AWS Bedrock 协议的对话历史时,如果检测到启用了 Thinking 模式,能够保留 Assistant 消息中的 thinking 块,并确保其位于 tool_use 之前,以符合 AWS Bedrock 的 API 规范。
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Projects
Status
Done