ChatGPT Prompt Engineering for Developers

吴恩达和OpenAI合作的课程,适合快速掌握prompt-eng的童鞋。

这里简单总结下要点,适合懒得看官方教程的人,建议还是看官方的教程比较有感觉:

指令集调优的模型表现更好

GUIDELINES

Principles of Prompting:

  • 指令一定要清楚,而且有针对性,千万别模糊

To guide a model towards the desired output and reduce the chances of irrelevant or incorrect responses, it is important to provide clear and specific instructions, which may require longer prompts for more clarity and context.

很有有意思的小技巧,也是官方的第一个例子。

text = f"""
You should express what you want a model to do by \ 
providing instructions that are as clear and \ 
specific as you can possibly make them. \ 
This will guide the model towards the desired output, \ 
and reduce the chances of receiving irrelevant \ 
or incorrect responses. Don't confuse writing a \ 
clear prompt with writing a short prompt. \ 
In many cases, longer prompts provide more clarity \ 
and context for the model, which can lead to \ 
more detailed and relevant outputs.
"""
prompt = f"""
Summarize the text delimited by triple backticks \ 
into a single sentence.
```{text}```
"""
response = get_completion(prompt)
print(response)

PE-准则1

参考