本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
适应性思维
在 Claude Opus 4.6 中推荐使用延伸思考自适应思维方式。自适应思维可以根据每个请求的复杂性Claude动态决定何时思考以及思考多少,而不是手动设置思考代币预算。与固定思维相比,自适应思维可以可靠地推动更好的表现budget_tokens,我们建议转向自适应思维,以便从 Claude Opus 4.6 中获得最聪明的响应。不需要测试版标题。
支持的模型如下所示:
| 模型 |
模型 ID |
Claude Opus4.6 |
anthropic.claude-opus-4-6-v1
|
克劳德·十四行诗 4.6 |
anthropic.claude-sonnet-4-6
|
thinking.type: "enabled"并budget_tokens在 Claude Opus 4.6 版本中已弃用,并将在未来的模型版本中移除。改为thinking.type: "adaptive"与工作量参数一起使用。
较旧的模型(Claude Sonnet 4.5、Claude Opus 4.5 等)不支持自适应思维,需要thinking.type: "enabled"使用budget_tokens。
适应性思维是如何运作的
在自适应模式下,Claude评估每个请求的复杂性,并决定是否需要思考以及考虑多少。在默认的努力级别 (high) 下,几乎总是Claude会思考。在较低的工作量下,Claude可能会跳过思考更简单的问题。
自适应思维也会自动启用交替思考(测试版)。这意味着Claude可以在工具调用之间进行思考,使其对代理工作流程特别有效。
"adaptive"在您thinking.type的 API 请求中设置为:
- CLI
-
aws bedrock-runtime invoke-model \
--model-id "us.anthropic.claude-opus-4-6-v1" \
--body '{
"anthropic_version": "bedrock-2023-05-31",
"max_tokens": 16000,
"thinking": {
"type": "adaptive"
},
"messages": [
{
"role": "user",
"content": "Three players A, B, C play a game. Each has a jar with 100 balls numbered 1-100. Simultaneously, each draws one ball. A beats B if As number > Bs number (mod 100, treating 100 as 0 for comparison). Similarly for B vs C and C vs A. The overall winner is determined by majority of pairwise wins (ties broken randomly). Is there a mixed strategy Nash equilibrium where each player draws uniformly? If not, characterize the equilibrium."
}
]
}' \
--cli-binary-format raw-in-base64-out \
output.json && cat output.json | jq '.content[] | {type, thinking: .thinking[0:200], text}'
- Python
-
import boto3
import json
bedrock_runtime = boto3.client(
service_name='bedrock-runtime',
region_name='us-east-2'
)
response = bedrock_runtime.invoke_model(
modelId="us.anthropic.claude-opus-4-6-v1",
body=json.dumps({
"anthropic_version": "bedrock-2023-05-31",
"max_tokens": 16000,
"thinking": {
"type": "adaptive"
},
"messages": [{
"role": "user",
"content": "Explain why the sum of two even numbers is always even."
}]
})
)
response_body = json.loads(response["body"].read())
for block in response_body["content"]:
if block["type"] == "thinking":
print(f"\nThinking: {block['thinking']}")
elif block["type"] == "text":
print(f"\nResponse: {block['text']}")
- TypeScript
-
import { BedrockRuntimeClient, InvokeModelCommand } from "@aws-sdk/client-bedrock-runtime";
async function main() {
const client = new BedrockRuntimeClient({});
const command = new InvokeModelCommand({
modelId: "us.anthropic.claude-opus-4-6-v1",
body: JSON.stringify({
anthropic_version: "bedrock-2023-05-31",
max_tokens: 16000,
thinking: {
type: "adaptive"
},
messages: [{
role: "user",
content: "Explain why the sum of two even numbers is always even."
}]
})
});
const response = await client.send(command);
const responseBody = JSON.parse(new TextDecoder().decode(response.body));
for (const block of responseBody.content) {
if (block.type === "thinking") {
console.log(`\nThinking: ${block.thinking}`);
} else if (block.type === "text") {
console.log(`\nResponse: ${block.text}`);
}
}
}
main().catch(console.error);
使用努力参数进行自适应思维
你可以将适应性思维与努力参数相结合,以指导思考的程Claude度。工作量水平可作为思维分配Claude的软指导:
| 工作量级别 |
思维行为 |
max |
Claude始终在不受思维深度限制的情况下思考。 Claude Opus仅限 4.6 — max 在其他型号上使用的请求将返回错误。 |
high(默认值) |
Claude总是在想。为复杂任务提供深度推理。 |
medium |
Claude使用适度的思维。对于非常简单的查询,可能会跳过思考。 |
low |
Claude最大限度地减少思考。跳过对速度最重要的简单任务的思考。 |
提示缓存
使用 thinkin adaptive g 的连续请求会保留提示缓存断点。但是,在adaptive和enabled/disabled思维模式之间切换会破坏消息的缓存断点。无论模式如何更改,系统提示和工具定义都会保持缓存状态。
调整思维行为
Claude如果思考的频率比你想要的要高或少,你可以在系统提示中添加指导:
Extended thinking adds latency and should only be used when it
will meaningfully improve answer quality — typically for problems
that require multi-step reasoning. When in doubt, respond directly.
引导Claude减少思考频率可能会降低从推理中受益的任务的质量。在将基于提示的调整部署到生产环境之前,先衡量对特定工作负载的影响。可以考虑先用较低的工作量进行测试。