065 如何撰写一份良好的ChatGPT Prompt?
本文最后更新于 300 天前,其中的信息可能已经有所发展或是发生改变。

昨天和ChatGPT聊天,聊了一圈,发现ChatGPT写的还是不够好。于是按照ChatGPT给出的官网网址进行了学习。除此之外,还参考了一些网站的内容。

ChatGPT Prompt的要求和组成?

一个ChatGPT要求

  1. Concise,简明
  2. Specific,具体

日常生活中处理事情,总是从问题出发,以自身为处理,从而获得答案。那么有了ChatGPT之后呢?对于ChatGPT,我们是拿它来解决问题的,所以应该当做一个处理器,来处理问题。从问题出发,ChatGPT,从而获得答案

为了更好理解ChatGPT Prompt的组成,绘制了一张图形。

image-20240119003925608

想要让ChatGPT输出自己想要的答案(Answer),就要撰写良好的Prompt。一份完整的ChatGPT Prompt是由四个部分组成

  1. Instruction(必需),指令词,你想让ChatGPT帮你干的事情
  2. Input data,输入,提供给模型的问题或者具体内容。
  3. Context,背景,与指令相关的其他信息。
  4. Output Indicator,输出要求,对最终生成内容的格式进行限制(包括长度,语言,语气等等)

ChatGPT的实例

为了能够更好理解这个内容,我们列举几个实例来说明内容。所以的实例内容来自于Openai的官网。https://platform.openai.com/examples

其中接下来,Prompt后面的内容是询问ChatGPT的内容,Answer的内容是ChatGPT的回答。

Create interview questions

这个Prompt的作用是产生几个采访的问题

Prompt: Create a list of 8 questions for an interview with a science fiction author.

Answers: 
1. Can you tell us a bit about your background and what inspired you to become a science fiction author?
2. How do you approach world-building in your science fiction novels? What elements do you prioritize when creating a believable and immersive fictional universe?
3. Science fiction often explores societal or technological advancements. What themes or ideas do you find most fascinating to explore in your writing?
4. How do you balance scientific accuracy with imaginative storytelling in your science fiction works?
5. Many science fiction authors use their stories as a platform to comment on contemporary issues. How do you incorporate social or political commentary into your writing, if at all?
6. Can you share any unique challenges or difficulties you've encountered while writing science fiction, and how you overcame them?
7. Science fiction often explores the potential impact of technology on society. In your opinion, what responsibilities do science fiction authors have in shaping public perception or understanding of emerging technologies?
8. Can you discuss any upcoming projects or ideas you're currently working on, and what readers can expect from your future science fiction novels?

同样分析一下上面这段话

Category Content
Instruction Create a list of 8 questions
Input data
Context for an interview with a science fiction author.
Output indicator

Rap battle writer

这个Prompt的作用是生产辩论的内容。

Prompt:Write a rap battle between Alan Turing and Claude Shannon.

Answers:
Verse 1 - Alan Turing:

I'm Turing, the father of all computation,
Built a machine that helped end a nation.
Your information theory, it's imitation,
I laid the foundation, you just gave it notation.

Broke the Enigma, saved millions of lives,
While you're playing with switches, just trying to survive,
And to think they said, you're the brightest of minds,
But not even your own theory could define your lines.

Verse 2 - Claude Shannon:

It's Shannon, the master of communication,
Your work is nothing without my information.
You can break the codes, but can't handle the truth,
I took your machine, gave it substance and proof.

You're binary, predictable, no real surprise,
But I'm riding entropy, in disguise.
Gave birth to the bit, the byte, the baud,
Without my blueprint, you'd still be flawed.

Verse 3 - Alan Turing:

Nice try Shannon, but you're no match,
Your logic circuit's flickering, I'm about to catch,
Your "bit" and "byte" are just a ruse,
Without my machine, they're of no use.

My Turing machine is universal,
Your theory is just controversial.
I'm the mastermind of artificial intelligence,
Your work is vital, but lacks relevance.

Verse 4 - Claude Shannon:

You're living in a theoretical existence,
I'm empirical, practical, I go the distance.
Your machine's universal, but I'm not impressed,
It's a theoretical model, while mine's manifest.

I'm the juggler, the unicyclist, the eclectic soul,
You're a one-track mind, stuck in a hole.
So, Turing, it's time you faced your defeat,
Cause, in this rap battle, you just can't compete.
Category Content
Instruction Write a rap battle
Input data
Context between Alan Turing and Claude Shannon
Output indicator

Emoji Translation

之前的Prompt比较简单,这里来一个复杂的。这个Prompt的作用是把现有的话翻译成为Emoji。

Prompt:
You will be provided with {{text}}, and your task is to translate it into emojis. Do not use any regular text. Do your best with emojis only.

{{text}}, Artificial intelligence is a technology with great promise.

Answers: 🤖🧠📈

现在来拆分一下这段话

Category Content
Instruction Translate text into emojis
Input data Artificial intelligence is a technology with great promise.
Context
Output indicator Do not use any regular text. Do your best with emojis only.

实战练习:让ChatGPT写一封关于自己的介绍

下面是一个实战训练,看看优化之后的Prompt是不是更好?

第一版

Prompt当中仅仅包含Instruction

image-20240119005205016

其实,如果不深究的话,这个内容也还好。

不过这个内容不是我想要的,因为核心技术这个章节我不想要。

第二版

Prompt当中包含Instruction和Context。

Category Content
Instruction 写一篇关于ChatGPT的介绍
Input data
Context 假设你是一位人工智能专家,将要到一个大山里的从来没有用过ChatGPT的小学去向小学生科普ChatGPT。
Output indicator

image-20240119010318683

但是看着,结构不清晰,于是再次补充Context

第三版

在第二版的基础上,丰富Context

Category Content
Instruction 写一篇关于ChatGPT的介绍
Input data
Context 假设你是一位人工智能专家,将要到一个大山里的从来没有用过ChatGPT的小学去向小学生科普ChatGPT。
科普内容包括一下三个方面:ChatGPT是什么?ChatGPT目前可以被用来干什么?ChatGPT可以用来干什么?
Output indicator

image-20240119010654771

感觉结构还是不够清晰,字数太少。

第四版

加入Output Indicator

Category Content
Instruction 写一篇关于ChatGPT的介绍
Input data
Context 假设你是一位人工智能专家,将要到一个大山里的从来没有用过ChatGPT的小学去向小学生科普ChatGPT。 科普内容包括一下三个方面:ChatGPT是什么?ChatGPT目前可以被用来干什么?ChatGPT可以用来干什么?
Output indicator 要求科普内容划分成三个独立的部分,每个部分的字数不少于300字。

image-20240119011115156

感觉这玩意没有标题,再改Output Indicator

第五版

image-20240119011507801

不错,这个比较满足要求。

结语

经过上述的例子,大家能否发现,学会向ChatGPT提问,才能够得到比较好的答案。期待未来大家能够把这个转化成为辅助自己进行生产的工具。

作者:Dongdong
链接:http://ddw2019.com/065
声明: 本博客所有文章除特别声明外,均采用CC BY-NC-SA 4.0协议,转载请注明文章地址。

如果观众姥爷们觉得冬冬的博客还不错,可以订阅赏杯奶茶让我继续撰写下去呦 (ฅ´ω`ฅ)
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇