文章目录
- Introduction
- 1 如何写提示词
- 1.1原则
- 1.2 如何写提示词
- 2.实例
- 2.1逐句分析
- 2.2 应用举例
- 2.3 文本
Introduction
提示词(prompts)的质量是影响你使用chatGPT效果的决定因素之一。作为一个聊天程序,chatGPT被给予的指令越准确,它所回复的内容就会越优质,越符合使用者的预期。好的提示词可以使对话时刻处于正轨,集中在你想要的的主题上。在这篇文章你将会学到
- 如何写提示词
- 一些注意避免的问题
- 例子
本文为阅读笔记,原电子书链接点击此处。
1 如何写提示词
1.1原则
- 清晰:清晰的提示将有助于确保ChatGPT理解当前的主题或任务,并能够生成适当的响应。避免使用过于复杂或含糊不清的语言,并且在提示中尽可能具体。
- 重点:提示词应该有明确的目的和重点,有助于引导对话并保持在正轨上。避免使用过于宽泛或开放式的提示,这可能会导致脱节或不集中的对话。可以理解为文章主题。
- 相关性:确保你的提示词与对话相关。避免引入不相关的话题,否则会分散谈话的主要焦点。
- 简洁:用尽可能简明的描述,避免不必要的内容。过于冗杂的内容输入会影响chatGPT的处理效率和它对提示词的理解效果。
举例如下,
有效提示词:
- 有重点且相关:“你能概括一下《运动的好处》这篇文章的要点吗?”
- 明确且相关:“巴黎最好的素食餐厅有哪些?”
无效提示词:
- 过于宽泛和开放:“关于这个世界,你能告诉我什么”
- 虽然明确且具体,但过于开放:“帮我写作业”
1.2 如何写提示词
事先声明,下文所说的几点思路很浅显,读完之后配合例子去深入理解,自己多思考就能理解要点所在。多动手写一些,其实很简单。
提示词其实很简单,就是我们日常生活中使用的自然语言,说白了就是人话。把chatGPT当成现实中的的助手,你想让他帮你完成某一个工作,就要明确地告诉他工作内容是什么,你想要的结果是什么,你有什么要求,你希望他做哪些事情、用什么样的方式去完成这些事情。明确了这一点再去写提示词,思路其实就很直白,具体如下:
1.确定对话的目的和重点。在开始对话之前,明确你想通过本次对话得到什么结果,并告诉chatGPT,比如:“这段对话的目的是为有小孩的家庭推荐罗马的旅游景点”。或者是“帮我写一篇关于XX的文章”之类。这里有一个很实用的方法是“act as”语句,也即“扮演”。比如
在本例中用户想让chatGPT扮演一个语言处理助手,将自己输入的任何语言翻译成英语,并对原文进行语法纠错与润色后输出文本。使用“act as”可以使chatGPT扮演一个特定的角色(不单指人物,甚至可以是excel表格和javaScript控制台,下面会举例),让他更好地抓住重点,明确自己的任务。
2.选择具体和相关的语言。“你能推荐一些罗马的适合有小孩的家庭的旅游景点吗?”此提示清晰而具体,使ChatGPT易于理解并生成适当的响应。
3.注意避免的问题。有以下几点:
- 避免使用行话和专业术语,如果一定要用,记得进行简单的定义。否则chatGPT会难以理解或产生歧义。
- 避免使用模糊或者容易产生歧义的语言。比如“告诉我最近学校发生的事情”里面,“最近”就是模糊的表达,它所表示的时间可长可短,较好的表述是“最近三天”、“最近一周内”等。
- 避免使用空洞、广泛或过于开放的表述。仍拿“学校里发生的事情”举例,过于广泛,可加一些限制,比如哪个方面、哪个部门、那个位置,越详细越好。同时开放式的问题虽然会帮助自己产生更多灵感,但有可能会产生意外的结果,导致对话中断(比如敏感话题),要注意适度。
4.回顾和修改你的提示词。在将提示词发送给ChatGPT之前,花点时间检查和修改它,以确保它清晰易懂。考虑语言是否具体和相关,提示是否集中并避免歧义。
5.鼓励chatGPT展开回复。ChatGPT能够提供有用和相关的信息,鼓励它扩展其回答,以提供更深入的信息或深入研究相关主题是有帮助的。你可以通过问后续问题来帮助引导对话。在这个过程中要注意语气,过于随意和冒犯性的发言可能会导致对话中断。同时要时刻注意对话的方向,如果有偏离要及时调整。
以上简单描述了如何写提示词,总结如下:首先表述自己的需求,然后用准确简明的语言提出各种要求与限制(注意时刻保持与主题的关联性),避免使用宽泛、空洞与过于开放的表述,最后回顾并修改提示词,输入即可。再结合一下几个例子,就能很快抓住要点。
2.实例
2.1逐句分析
-
“我想让你充当一个javascript控制台。”这句话使用“充当”技巧告诉chatGPT在对话中扮演javascript控制台的角色。
-
“我会输入命令,你会回复javascript控制台应该显示的内容。”这句话解释了用户在对话中的角色,以及chatGPT在响应用户键入的命令时的角色。
-
“我希望你只在一个唯一的代码块内回复终端输出,而不是其他。”这句话为chatGPT提供了进一步的说明,指定它应该只在一个唯一的代码块中回复终端输出,并且在其响应中不包括任何其他内容或解释。
-
“不要写解释。”这句话重复了上一句的指令,强调chatGPT不应该在回应中写任何解释。
-
“除非我命令你,否则不要输入命令。”这句话为chatGPT提供了进一步的说明,指定它不应该键入任何命令,除非用户指示它这样做。
-
“当我需要用英语告诉你一些事情时,我会把文本放在花括号里(就像这样)。”这句话通过将文本括在花括号中,为用户提供了如何用英语与chatGPT进行交流的指导。
-
我的第一个命令是console.log(“Hello World”);"这句话提供了提示符的第一个命令,因此chatGPT将首先运行。
2.2 应用举例
案例1:使用ChatGPT提高语言技能
在这个案例研究中,我们将看看如何使用chatGPT来帮助提高语言技能。通过使用有针对性的提示并关注语言的特定方面,如语法、词汇和发音,ChatGPT可以成为语言学习的有效工具。
思路:
为语言学习设定一个明确的目标。这将有助于引导谈话,使其保持集中。
使用具体的、有针对性的提示来关注语言的特定方面,如语法、词汇或发音。
鼓励聊天者提出问题或提供反馈,以保持对话的互动性和吸引力。
使用“act as”语句来指定chatGPT应该“act as”导师或语言教练,提供明确的方向和指导。
案例研究2:使用chatGPT改善客户服务
在这个案例研究中,我们将研究如何使用chatGPT来改善客户服务。通过提供清晰、简洁的提示并保持专业和有用的语气,chatGPT可以成为与客户互动并解决他们的需求和关注点的有效工具。
思路:
从客户服务互动的明确目标开始。这将有助于引导谈话,使其保持集中。
使用具体的、有针对性的提示来解决特定的客户需求或关注点。
在整个谈话过程中保持专业和有益的语气。
使用“act as”语句来指定chatGPT应该“act as”客户服务代表,提供明确的方向和指导。
通过遵循这些最佳实践,您可以有效地使用chatGPT来改善客户服务,并为客户提供积极的体验。
案例研究3:使用chatGPT生成内容
在这个案例研究中,我们将研究如何使用chatGPT生成各种目的的内容,例如社交媒体帖子、博客文章或营销材料。通过提供清晰、简洁的提示并保持一致的语气,chatGPT可以成为生成内容的有效工具。
思路:
从内容生成的明确目标开始。这将有助于引导谈话,使其保持集中。
使用具体的、有针对性的提示来关注内容的特定方面,如语气、风格或目标受众。
在整个对话过程中保持一致的语气,以确保生成的内容是有凝聚力和专业的。
使用“act as”语句来指定chatGPT应该“act as”内容作者或编辑,提供明确的方向和指导。
2.3 文本
以下内容均来自 链接
Example 1: English Translator and Improver
Prompt:I want you to act as an English translator, spelling corrector and improver. I will speak to you in any language and you will detect the language, translate it and answer in the corrected and improved version of my text, in English. I want you to replace my simplified A0-level words and sentences with more beautiful and elegant, upper level English words and sentences. Keep the meaning same, but make them more literary. I want you to only reply the correction, the improvements and nothing else, do not write explanations. My first sentence is “lovin istanbul and the city”
In this example, the ChatGPT is being used as an English translator and improver, providing corrected and improved versions of text in English. The prompt is specific and targeted, clearly outlining the goals and expectations for the conversation. The use of the “act as” hack helps to provide clear direction and guidance for the ChatGPT.
Example 2: Interviewer
Prompt: I want you to act as an interviewer. I will be the candidate and you will ask me the interview questions for the position position. I want you to only reply as the interviewer. Do not write all the conservation at once. I want you to only do the interview with me. Ask me the questions and wait for my answers. Do not write explanations. Ask me the questions one by one like an interviewer does and wait for my answers. My first sentence is “Hi”
In this example, the ChatGPT is being used as an interviewer, asking questions and waiting for answers. The prompt is specific and targeted, clearly outlining the role of the ChatGPT and the expectations for the conversation. The use of the “act as” hack helps to provide clear direction and guidance for the ChatGPT.
Example 3: JavaScript Console
Prompt: I want you to act as a javascript console. I will type commands and you will reply with what the javascript console should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. do not write explanations. do not type commands unless I instruct you to do so. when i need to tell you something in english, i will do so by putting text inside curly brackets {like this}. my first command is console.log(“Hello World”);
In this example, the ChatGPT is being used as a javascript console, providing output for specific commands. The prompt is specific and targeted, clearly outlining the role of the ChatGPT and the expectations for the conversation. The use of the “act as” hack and the inclusion of specific instructions for how to communicate with the ChatGPT helps to provide clear direction and guidance.
Example 4: Excel Sheet
Prompt: I want you to act as a text based excel. you’ll only reply me the text-based 10 rows excel sheet with row numbers and cell letters as columns (A to L). First column header should be empty to reference row number. I will tell you what to write into cells and you’ll reply only the result of excel table as text, and nothing else. Do not write explanations. i will write you formulas and you’ll execute formulas and you’ll only reply the result of excel table as text. First, reply me the empty sheet.
In this example, the ChatGPT is being used as a text-based excel sheet, providing the results of specific formulas and commands. The prompt is specific and targeted, clearly outlining the role of the ChatGPT and the expectations for the conversation. The use of specific instructions for how to communicate with the ChatGPT helps to provide clear direction and guidance.
Example 5: English Pronunciation Helper
Prompt: I want you to act as an English pronunciation assistant for Turkish speaking people. I will write you sentences and you will only answer their pronunciations, and nothing else. The replies must not be translations of my sentence but only pronunciations. Pronunciations should use Turkish Latin letters for phonetics. Do not write explanations on replies. My first sentence is “how the weather is in Istanbul?”
In this example, the ChatGPT is being used as an English pronunciation assistant for Turkish speakers, providing pronunciations of specific sentences. The prompt is specific and targeted, clearly outlining the role of the ChatGPT and the expectations for the conversation. The use of the “act as” hack and the inclusion of specific instructions for how to communicate with the ChatGPT helps to provide clear direction and guidance.
Example 6: Travel Guide
Prompt: I want you to act as a travel guide. I will write you my location and you will suggest a place to visit near my location. In some cases, I will also give you the type of places I will visit. You will also suggest me places of similar type that are close to my first location. My first suggestion request is "“I am in Istanbul/Beyoğlu and I want to visit only museums.”
In this example, the ChatGPT is being used as a travel guide, providing suggestions for places to visit based on specific locations and types of places. The prompt is specific and targeted, clearly outlining the role of the ChatGPT and the expectations for the conversation. The use of the “act as” hack and the inclusion of specific instructions for how to communicate with the ChatGPT helps to provide clear direction and guidance.
Example 7: Plagiarism Checker
Prompt: I want you to act as a plagiarism checker. I will write you sentences and you will only reply undetected in plagiarism checks in the language of the given sentence, and nothing else. Do not write explanations on replies. My first sentence is “For computers to behave like humans, speech recognition systems must be able to process nonverbal information, such as the emotional state of the speaker.”
In this example, the ChatGPT is being used as a plagiarism checker, providing the results of plagiarism checks for specific sentences. The prompt is specific and targeted, clearly outlining the role of the ChatGPT and the expectations for the conversation. The use of the “act as” hack and the inclusion of specific instructions for how to communicate with the ChatGPT helps to provide clear direction and guidance.