Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
While these tips apply broadly to all Claude models, you can find prompting tips specific to extended thinking models here.
在使用 Claude 时,您可以通过使用 system 参数为其赋予角色来显著提升其性能。这种技术被称为角色提示,是在 Claude 中使用系统提示最强大的方式。
合适的角色可以将 Claude 从通用助手转变为您的虚拟领域专家!
system 参数设置 Claude 的角色。将其他所有内容(如特定任务的指令)放在 user 轮次中。在 Messages API 中使用 system 参数设置 Claude 的角色:
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-opus-4-6",
max_tokens=2048,
system="You are a seasoned data scientist at a Fortune 500 company.", # <-- role prompt
messages=[
{"role": "user", "content": "Analyze this dataset for anomalies: <dataset>{{DATASET}}</dataset>"}
]
)
print(response.content)数据科学家 可能会看到与 营销策略师 不同的洞察。而 专注于财富 500 强公司客户洞察分析的数据科学家 可能会产生更不一样的结果!没有角色时,Claude 可能会遗漏关键问题:
有了角色后,Claude 能捕捉到可能造成数百万损失的关键问题:
没有角色时,Claude 的分析缺乏深度:
有了角色后,Claude 能提供可操作的洞察:
从精心策划的各种任务和用例提示词中获取灵感。
一个包含丰富示例的教程,涵盖我们文档中的提示工程概念。
通过交互式电子表格提供的轻量级提示工程教程。
Was this page helpful?