Prompt engineering(提示工程)包括以下几个方面:
Develop test cases:With your task and success criteria defined,the next step is to create a diverse set of test cases that cover the intended use cases for your application.These should include both typical examples and edge cases to ensure your prompts are robust.Having well-defined test cases upfront will enable you to objectively measure the performance of your prompts against your success criteria.开发测试用例:在定义任务和成功标准之后,下一步是创建一组多样化的测试用例,涵盖应用程序的预期用例。这些应包括典型示例和边界情况,以确保您的提示具有鲁棒性。提前定义好的测试用例将使您能够客观地衡量您的提示与成功标准的表现。Engineer the preliminary prompt:Next,craft an initial prompt that outlines the task definition,characteristics of a good response,and any necessary context for Claude.Ideally you should add some examples of canonical inputs and outputs for Claude to follow.This preliminary prompt will serve as the starting point for refinement.设计初步提示:接下来,制定一个初步的提示,概述任务定义、良好响应的特征,以及Claude所需的任何上下文。理想情况下,您应该添加一些规范输入和输出的示例供Claude参考。这个初步提示将作为改进的起点。Test prompt against test cases:Feed your test cases into Claude using the preliminary prompt.Carefully evaluate the model's responses against your expected outputs and success criteria.Use a consistent grading rubric,whether it's human evaluation,comparison to an answer key,or even another instance of Claude’s judgement based on a rubric.The key is to have a systematic way to assess performance.根据测试用例测试提示:使用初步提示将测试用例输入到Claude中。仔细评估模型的响应与您预期的输出和成功标准是否一致。使用一致的评分标准,无论是人工评估、与答案标准的比较,甚至是基于评分标准的Claude判断的另一个实例。关键是要有一种系统性的评估性能的方式。
Claude offers high-level baseline performance out of the box.However,prompt engineering can help you enhance its performance further and fine-tune its responses to better suit your specific use case.These techniques are not necessary for achieving good results with Claude,but you may find them useful in upleveling your inputs&outputs.Claude在开箱即用时提供了高水平的基线性能。然而,及时的工程可以帮助您进一步提升其性能,并对其响应进行微调,以更好地适应您特定的用例。这些技术对于实现Claude的良好结果并不是必要的,但您可能会发现它们对提升输入和输出非常有用。To quickly get up and running with a prompt or get introduced to prompting as a concept,see[intro to prompting](https://docs.anthropic.com/claude/docs/intro-to-prompting).要快速开始使用提示或了解提示作为一个概念,可以参阅提示入门。
Remember,prompt engineering is an iterative process.Don't be discouraged if your initial examples don't yield perfect results–with a bit of tweaking and experimentation,you'll be able to unlock Claude's full potential and achieve exceptional results for your applications.记住,快速工程是一个迭代过程。如果你的初始示例没有产生完美的结果,不要灰心-通过一点调整和实验,你将能够释放Claude的全部潜力,并为你的应用程序取得出色的结果。