Chatgpt 简明教程
ChatGPT – Prompts
我们在讨论用户如何与 ChatGPT 和其他 Open AI 模型交互时使用了“提示”一词。在本章中,我们将讨论“提示工程”对于提高模型准确性的重要性。
We used the word "prompt" while discussing how users interact with ChatGPT and other Open AI models. In this chapter, we will discuss the significance of "prompt engineering" to enhance model’s accuracy.
提示的设计和制作方式通过以下方式影响模型的输出:
The way prompts are designed and crafted influence the output of the model in the following ways −
-
A well-designed prompt can guide the model to produce relevant and precise output.
-
Whereas a poorly designed prompt may result in irrelevant or confusing output.
这只是关于如何在 ChatGPT 中使用不同类型的提示来获取你需要的确切信息的基本章节。我们希望你参考我们的教程 Prompts Engineering ,在那里你将找到关于此主题的详尽细节。
This is just a basic chapter on how you can use different types of prompts in ChatGPT to get the exact information you are looking for. We would like you to refer our tutorial Prompts Engineering where you will find extensive detail on this topic.
Prompts and Their Significance
生成式 AI 模型可以根据用户要求创建各种东西,如诗歌、故事、图像和代码。但是,为了获得我们想要的输出,我们必须向这些模型提供正确的指令,即提示。
Generative AI models can create various things like poems, stories, images, and code as per user request. However, to get the output we want, we have to give these models the right instructions, known as prompts.
提示,主要指自然语言中的文本片段,就像生成式 AI 模型输出的指南一样,影响着其语调、风格和整体质量。事实上,提示是用户可以指导这些模型生成的输出的唯一方式。
Prompts, which mainly refer to a segment of text in natural language, are like the guide for the generative AI model’s output, affecting its tone, style, and overall quality. In fact, prompts are the only way a user can direct the output generated by these models.
Types of Prompts for ChatGPT
在 ChatGPT 中使用的提示类别充当指导或指令,提供给 GPT 以引导和控制特定类型的响应和会话。让我们探讨常用的提示并了解它们有益的方式。
The categories of prompts used in ChatGPT act as guidelines or instructions provided to GPT to steer and control specific kinds of responses and conversations. Let’s explore the commonly used prompts and understand the ways they can be beneficial.
Instructional Prompts
指令式提示是命令,其中包含关于响应中包括的期望格式或信息的特定指令,直接命令模型。
Instructional prompts are commands that direct the model with specific instructions on the desired format or information to include in the response.
我们看一个下面的示例:
Let’s see an example below −
Roleplay Prompts
角色扮演提示是命令,将输入框定成模型是一个角色或具有特定角色,相应地指导其响应。
Roleplay prompts are commands that frame the input as if the model is a character or has specific role, guiding its response accordingly.
考虑以下示例 −
Consider the following example −
Question-Answer Prompts
顾名思义,问答提示是向模型提出问题的命令,以引出内容丰富或有创意的答案。
As the name suggests, QA prompts are commands that pose questions to the model to elicit informative or creative answers.
请看以下示例:
Take a look at the following example −
Contextual Prompts
上下文提示提供了背景信息或背景知识,以指导模型的理解和响应。
Contextual prompts provide context or background information to guide the model’s understanding and response.
检查以下示例:
Check the following example −
Creative Storytelling Prompts
富有创意的讲故事提示通过设置场景或故事元素来鼓励模型生成富有想象力或创造性的叙述。
Creative storytelling prompts encourage the model to generate imaginative or creative narratives by setting up scenarios or story elements.
观察以下提示在此示例中的工作原理 -
Observe how the following prompt works in this example −
Conditional Prompts
条件提示指定响应的条件或约束,以指导模型的输出朝某个特定方向发展。
Conditional prompts specify conditions or constraints for the response to guide the model’s output in a particular direction.
探索以下示例 -
Explore the following example −
Comparison Prompts
比较提示要求模型对不同的概念、想法或方案进行比较或对比。考虑以下示例 -
Comparison prompts ask the model to compare or contrast different concepts, ideas, or scenarios. Consider the following example −
Instructive Prompts
指导提示明确指示模型在其响应中的所需行为或方法。看看以下示例 -
Instructive prompts clearly instruct the model on the desired behavior or approach in its response. Take a look at the following example −
Principles of Well-Defined Prompts
在前面的讨论中,我们强调了提示工程在影响模型输出中的重要性。现在,让我们深入探讨改进提示的推荐做法,并确定一些应避免的做法。
In the earlier discussion, we emphasized the significance of prompt engineering in influencing model output. Now, let’s delve into recommended practices for improving your prompts and identify some practices to avoid.
Ensure Clarity
以简单的方式构建句子和说明,使 ChatGPT 易于理解。
Frame your sentences and instructions in a simple manner, making them easily understandable for ChatGPT.
Be Concise
选择较短的提示和句子。将你的说明分成较小、连贯的句子,以提高理解度。
Choose shorter prompts and sentences. Break your instructions into smaller, coherent sentences for improved understanding.
Maintain Focus
确保提示集中在一个明确定义的主题上,以避免产生过于通用的输出。
Ensure that the prompt centers on a clearly defined topic to avoid the risk of producing overly generic output.
Consistency
在对话中保持一致的语气和语言,以实现更连贯的交互。
Maintain a consistent tone and language during the conversation for a more coherent interaction.
Acting as…
让 ChatGPT 扮演某人或事物的角色的技术已经显示出显着的效果。你可以通过指示它“扮演”所需的人物或系统来简化从模型中获得的信息。
The technique of having ChatGPT assume the identity of someone, or something has shown remarkable effectiveness. You can streamline the information you need from the model by instructing it to "act like" the desired person or system.
我们在前一部分已经看到了角色扮演提示示例,其中 ChatGPT 充当侦探。
We’ve already seen the roleplay prompt example in the previous section, where ChatGPT acted as a detective.