左下角是公众号二维码和小助手的二维码(负责拉围绕本文的交流群),欢迎交流。最后,如果本文档在传播过程中,被修改夹带了任何不是我们的二维码,那就是偷别人劳动成果给自己引流的。请不要扫,让我们气死他们Prompt Engineering Technigues"Human:"/"Assistant:"标准格式Claude被训练为交替对话形式的机器人。对话形式固定为:"Human:"/"Assistant:":Human:[提示词xxx]Assistant:[Claude回复xXx提示词格式用例:1 Human:Why is the sky blue?1 T Assistant:1I symbols above shown for illustration如果提示词在API里出现;则固定开头为"n\nHuman:"-固定结尾是:"n\nAssistant:"Pythonprompt="n\nHuman:Why are sunsets orange?\n nAssistant:'"Human:"/"Assistant:"formattingClaude is trained on alternating"Human:"/"Assistant:"dialogue:Human:[Instructions]Examples:11Human:Why is the sky blue?11Assistant:Assistant:[Claude's response]1I symbols above shown for illustrationFor any API prompt,you must start with"ninHuman:"and end with"\n nAssistant:"
...Pleaserespond withthe noise that...Pleaserespond withthe noise thatanimal makes.<animal>Cow</animal>....Pleaserespond withthe noise thatanimal makes.<animal>Doganimal makes.<animal>Seal</animal></animal>eteiametfPmordeteldnocfanord使用结构化的提示词模板长文档示例:提示词模板Human:<doc>{{文档}]</doc>请用一个五年级学生能理解的语言来总结这篇文档的主要内容。Assistant:小贴士:一个长文档,建议把要问的问题放在提示词如果是处理的最后面。Use structured prompt templatesLong document example:Prompt templateHuman:<doc>({DOCUMENT]}</docPlease write a summary of this document at a fifth grader's understanding level.Assistant:Tip:When dealing with long documents,always ask your question at the bottom of the prompt.让Claude更好地接龙:给它开个头儿示例:怎么让Claude准确地说出你想要的内容呢?你可以这样做:示
Pythonprompt="n\nHuman:Why are sunsets orange?\n nAssistant:'提示词要清晰明确Claude对清晰明确的提示词反馈最好如果有疑问,可以这么做:向你的朋友展示你的提示词,问问他们,能不能遵循指令做到你要求的事情。示例:Human:写一首关于机器人的俳句Assistant:这是一首关于机器人的俳句:Metal bodies move(太凶残了,不翻译了Circuits calculate tasks Machines mimic life不能就去改,改到能为止。Human:写一首关于机器人的俳句。直接输出俳句不要跟我说话,Assistant:Metal bodies move Circuits calculate tasks Machines mimic lifeBe clear and directClaude responds best to clear and direct instructionsWhen in doubt,follow the Golden Rule of Clear Prompting:show your prompt to a friend and ask them if they can follow the instructions themselves and produce the exact result you're looking forExample:Human:Write a haiku about robotsAssistant:Here is a haiku about robots:Metal bodies move Circuits calculate tasks Machines mimic lifeHuman:Write a haiku about robots.Skip the preamble;go straight into the poem.Assistant:Metal bodies move Circuits calculate tasks Machines mimic life角色扮演(又称:角色性提示词)Claude有时需要了解它应该扮演的角色