Prompt Engineering 简明教程

Prompt Engineering - Constructive Critic Prompts

使用建设性批评提示,我们可以鼓励 ChatGPT 提供有见解且可操作的批评,使用户能够接收宝贵的改进或完善输入。

在本章中,我们将探讨建设性批评提示的概念,以及如何使用它来指导 ChatGPT 以建设性方式提供有用的反馈、评论或建议。

What is Constructive Critic Prompting?

建设性批评提示涉及设计提示,指导 ChatGPT 提供建设性反馈、评论或评估。目的是引导模型以支持性和积极的方式提供批评,在突出优点的同时关注改进领域。

Benefits of Constructive Critic Prompting

建设性批评提示提供了多种好处−

  1. Valuable Feedback − 用户接收详细且有用的反馈,有助于完善想法、内容或解决方案。

  2. Skill Improvement − 建设性批评使用户能够识别改进领域,促进技能发展和成长。

  3. Positive User Experience − 以建设性和支持性的方式提供的反馈可增强整体用户体验并鼓励进一步参与。

Implementing Constructive Critic Prompting

Crafting Constructive Critic Prompts − 要实施建设性批评提示,请设计提示,指导 ChatGPT 以积极和建设性的语调进行评估并提供反馈。请参阅以下 example

User: Please evaluate my article on climate change and provide constructive feedback.

Model Interaction − 当 ChatGPT 遇到建设性批评提示时,它会通过提供既突出内容优点又突出改进领域的反馈来做出响应。这里有一个 example

User: Please evaluate my article on climate change and provide constructive feedback.
ChatGPT: Your article on climate change is well-researched and informative. The introduction effectively grabs the reader's attention. However, consider expanding on the potential solutions to address climate change to make the article even more impactful. Great effort overall!

Customizing the Feedback − 根据语境和用户的喜好,可以定制反馈中的详尽程度和重点强调的领域以满足特定要求。以下是一个 example

User: Please critique my design for the website's homepage.
ChatGPT: Your design for the website's homepage is visually appealing and user-friendly. However, consider optimizing the layout for mobile devices to ensure seamless navigation for mobile users. Additionally, explore using a more contrasting color scheme to enhance readability. Keep up the good work!

Applications of Constructive Critic Prompting

建设性批评提示可用于各种场景 −

  1. Content Review − 对书面内容、设计草稿或营销素材请求有价值的反馈。

  2. Code Review − 对代码片段或编程项目获取建设性反馈。

  3. Skill Enhancement − 将建设性批评提示用于语言学习或技能培训练习。

Best Practices for Chain of Thought Prompting

充分利用建设性批评提示,请考虑以下最佳实践 −

  1. Specific Feedback Requests − 设计明确概述待评估的特定领域或方面的提示。

  2. Positive Tone − 指示 ChatGPT 以积极和鼓舞人心的方式提供反馈,并强调优势和可改进的领域。

  3. Tailored Feedback − 根据语境和用户喜好定制反馈,确保相关性和实用性。

Example Application − Python Implementation

让我们探索一个使用指令与 ChatGPT 交互的 Python 脚本的实际示例。

import openai

# Set your API key here
openai.api_key = 'YOUR_API_KEY'

def generate_chat_response(prompt):
   response = openai.Completion.create(
   engine="text-davinci-003",
      prompt=prompt,
      max_tokens=500,
      temperature=0.7,
      n=1,
      stop=None
   )
   return response

user_prompt = "User: Please evaluate my article on climate change and provide constructive feedback. \n"
chat_prompt = user_prompt + "[Constructive Critic Prompting]"

response = generate_chat_response(chat_prompt)
print(response)

Output

在此,我们收到了以下建设性批评作为输出 −

The article provides a good overview of the key issues associated with climate change, but it could benefit from a more detailed analysis of the potential solutions. It would also be useful to include more specific examples of the impacts of climate change to provide context for the reader.
Additionally, it might be helpful to provide a more comprehensive overview of the different types of climate change and how they affect the environment.
Finally, it would be beneficial to include a conclusion that summarizes the main points of the article and provides the reader with some actionable steps they can take to help mitigate climate change.

Conclusion

建设性批评提示营造积极的用户体验,鼓励参与和持续增长。当你将建设性批评提示纳入你与 ChatGPT 的互动时,你可以期待收到周到和可操作的反馈,从而提升你的项目。