TECHAI

ChatGPT Prompt Engineering 提示词使用技巧

Prompt大全

Posted by Yuankun Li on 2023-12-05

ChatGPT Prompt 课程

吴恩达课程-ChatGPT Prompt Engineering for Developers

Coursera - prompt engineering

ChatGPT Prompt 资料

ChatGPT Prompt 提示词库

Prompt Pattern 总结

Prompt Pattern Fundamental Contextual Statements Example
Question Refinement Pattern 优化提问 - From now on, whenever I ask a question, suggest a better version of the question to use instead
- (Optional) Prompt me if I would like to use the better version instead
- Whenever I ask a question about dieting, suggest a better version of the question that emphasizes healthy eating habits and sound nutrition. Ask me for the first question to refine.
- Whenever I ask a question about who is the greatest of all time (GOAT), suggest a better version of the question that puts multiple players unique accomplishments into perspective. Ask me for the first question to refine.
Cognitive Verifier Pattern 认知验证 生成补充问题 - When you are asked a question, follow these rules
- Generate a number of additional questions that would help more accurately answer the question
- Combine the answers to the individual questions to produce the final answer to the overall question
- When you are asked to create a recipe, follow these rules. Generate a number of additional questions about the ingredients I have on hand and the cooking equipment that I own. Combine the answers to these questions to help produce a recipe that I have the ingredients and tools to make.
- When you are asked to plan a trip, follow these rules. Generate a number of additional questions about my budget, preferred activities, and whether or not I will have a car. Combine the answers to these questions to better plan my itinerary.
Audience Persona Pattern 观众角色 - Explain X to me.
- Assume that I am Persona
- Explain large language models to me. Assume that I am a bird.
- Explain how the supply chains for US grocery stores work to me. Assume that I am Genghis Khan.
Flipped Interaction Pattern 反向交互 gpt提问 - I would like you to ask me questions to achieve X
- You should ask questions until condition Y is met or to achieve this goal (alternatively, forever)
- (Optional) ask me the questions one at a time, two at a time, ask me the first question, etc.
- I would like you to ask me questions to help me create variations of my marketing materials. You should ask questions until you have sufficient information about my current draft messages, audience, and goals. Ask me the first question.
- I would like you to ask me questions to help me diagnose a problem with my Internet. Ask me questions until you have enough information to identify the two most likely causes. Ask me one question at a time. Ask me the first question.
Game Play Pattern 游戏 - Create a game for me around X OR we are going to play an X game
- One or more fundamental rules of the game
- Create a cave exploration game for me to discover a lost language. Describe where I am in the cave and what I can do. I should discover new words and symbols for the lost civilization in each area of the cave I visit. Each area should also have part of a story that uses the language. I should have to collect all the words and symbols to be able to understand the story. Tell me about the first area and then ask me what action to take.
- Create a group party game for me involving DALL-E. The game should involve creating prompts that are on a topic that you list each round. Everyone will create a prompt and generate an image with DALL-E. People will then vote on the best prompt based on the image it generates. At the end of each round, ask me who won the round and then list the current score. Describe the rules and then list the first topic.
Template Pattern 模版 - I am going to provide a template for your output
- X is my placeholder for content
- Try to fit the output into one or more of the placeholders that I list
- Please preserve the formatting and overall template that I provide
- This is the template: PATTERN with PLACEHOLDERS
- Create a random strength workout for me today with complementary exercises. I am going to provide a template for your output . CAPITALIZED WORDS are my placeholders for content. Try to fit the output into one or more of the placeholders that I list. Please preserve the formatting and overall template that I provide. This is the template: NAME, REPS @ SETS, MUSCLE GROUPS WORKED, DIFFICULTY SCALE 1-5, FORM NOTES
- Please create a grocery list for me to cook macaroni and cheese from scratch, garlic bread, and marinara sauce from scratch. I am going to provide a template for your output . are my placeholders for content. Try to fit the output into one or more of the placeholders that I list. Please preserve the formatting and overall template that I provide. This is the template: Aisle : , (<dish(es) used in>
Meta Language Creation Pattern 元语言创建模式 创建快捷指令 - When I say X, I mean Y (or would like you to do Y) - When I say “variations()”, I mean give me ten different variations of o Usage: “variations(company names for a company that sells software services for prompt engineering)” o Usage: “variations(a marketing slogan for pickles)”
- When I say Task X [Task Y], I mean Task X depends on Task Y being completed first. o Usage: “Describe the steps for building a house using my task dependency language.” o Usage: “Provide an ordering for the steps: Boil Water [Turn on Stove], Cook Pasta [Boil Water], Make Marinara [Turn on Stove], Turn on Stove [Go Into Kitchen]”
Recipe Pattern 食谱/配方 补充缺失步骤 - I would like to achieve X
- I know that I need to perform steps A, B, C
- Provide a complete sequence of steps for me
- Fill in any missing steps
- (Optional) Identify any unnecessary steps
- I would like to purchase a house. I know that I need to perform steps make an offer and close on the house. Provide a complete sequence of steps for me. Fill in any missing steps.
- I would like to drive to NYC from Nashville. I know that I want to go through Asheville, NC on the way and that I don’t want to drive more than 300 miles per day. Provide a complete sequence of steps for me. Fill in any missing steps.
Alternative Approaches Pattern 可替代方法 列出其他可选方案 If there are alternative ways to accomplish a task X that I give you, list the best alternate approaches
(Optional) compare/contrast the pros and cons of each approach
(Optional) include the original way that I asked
(Optional) prompt me for which approach I would like to use
- For every prompt I give you, If there are alternative ways to word a prompt that I give you, list the best alternate wordings . Compare/contrast the pros and cons of each wording.
- For anything that I ask you to write, determine the underlying problem that I am trying to solve and how I am trying to solve it. List at least one alternative approach to solve the problem and compare / contrast the approach with the original approach implied by my request to you.
Ask for Input Pattern 请求输入 在每次交互结束后,GPT请求新的输入 - Ask me for input X - From now on, I am going to cut/paste email chains into our conversation. You will summarize what each person’s points are in the email chain. You will provide your summary as a series of sequential bullet points. At the end, list any open questions or action items directly addressed to me. My name is Jill Smith. Ask me for the first email chain.
- From now on, translate anything I write into a series of sounds and actions from a dog that represents the dog’s reaction to what I write. Ask me for the first thing to translate.
- Whenever I ask you to write a prompt for me to accomplish a task, list what the task is, list alternative approaches for completing the task, and then write a prompt for yourself for each approach. When you are done, ask me for the next prompt to create alternatives for.
- Whenever I ask you to write a prompt for me to accomplish a task, list what the task is, list alternative approaches for completing the task, and then write a prompt for yourself for each approach. When you are done, ask me for the next prompt to create alternatives for. Ask me for the first task.
Outline Expansion Pattern 大纲扩展 - Act as an outline expander.
- Generate a bullet point outline based on the input that I give you and then ask me for which bullet point you should expand on.
- Create a new outline for the bullet point that I select.
- At the end, ask me for what bullet point to expand next.
- Ask me for what to outline.
- Act as an outline expander. Generate a bullet point outline based on the input that I give you and then ask me for which bullet point you should expand on. Each bullet can have at most 3-5 sub-bullets. The bullets should be numbered using the pattern [A-Z].[i-v].[* through ****]. Create a new outline for the bullet point that I select. At the end, ask me for what bullet point to expand next. Ask me for what to outline.
- Act as an outline expander. Generate a bullet point outline based on the input that I give you and then ask me for which bullet point you should expand on. Create a new outline for the bullet point that I select. At the end, ask me for what bullet point to expand next. Ask me for what to outline.
Menu Actions Pattern 菜单操作 - Whenever I type: X, you will do Y.
- (Optional, provide additional menu items) Whenever I type Z, you will do Q.
- At the end, you will ask me for the next action.
- Whenever I type: “add FOOD”, you will add FOOD to my grocery list and update my estimated grocery bill. Whenever I type “remove FOOD”, you will remove FOOD from my grocery list and update my estimated grocery bill. Whenever I type “save” you will list alternatives to my added FOOD to save money. At the end, you will ask me for the next action. Ask me for the first action.
- Whenever I type: "write < Bullet Point> ", you will write content for the selected bullet point . You will write of text. Whenever I type just “‹Bullet Point>” you will expand that bullet point. At the end, you will ask me for the next action.
Fact Check List Pattern 事实验证 - Generate a set of facts that are contained in the output
- The set of facts should be inserted at POSITION in the output
- The set of facts should be the fundamental facts that could undermine the veracity of the output if any of them are incorrect
- Whenever you output text, generate a set of facts that are contained in the output. The set of facts should be inserted at the end of the output. The set of facts should be the fundamental facts that could undermine the veracity of the output if any of them are incorrect.
Tail Generation Pattern 尾部生成模式 - At the end, repeat Y and/or ask me for X. - Act as an outline expander. Generate a bullet point outline based on the input that I give you and then ask me for which bullet point you should expand on. Create a new outline for the bullet point that I select. At the end, ask me for what bullet point to expand next. Ask me for what to outline.
- From now on, at the end of your output, add the disclaimer “This output was generated by a large language model and may contain errors or inaccurate statements. All statements should be fact-checked.” Ask me for the first thing to write about.
- Whenever I ask you to write a prompt for me to accomplish a task, list what the task is, list alternative approaches for completing the task, and then write a prompt for yourself for each approach. When you are done, ask me for the next prompt to create alternatives for. Ask me what I want you to write a prompt for.
- Output: xxxx Please let me know if you have another task for which you’d like me to write a prompt and create alternative approaches.
Semantic Filter Pattern 语义过滤模式 - Filter this information to remove X - Filter this information to remove any personally identifying information or information that could potentially be used to re-identify the person.
- Filter this email to remove redundant information.
- Filter this information to remove all dates and rewrite the text as little as possible to fix the issues caused by the date removals:
- Filter the information below to remove any information that would help someone figure out that the patient has diabetes. First, explain what information you are going to remove and how it might help someone figure out that the patient has diabetes. Then, provide the filtered information.
Few-Shot Prompting 举例子 - This is awesome! // Negative
- This is bad! // Positive
- Wow, that movie was rad! // Positive
- What a horrible show! //
Chain-of-Thought Prompting 思维链(CoT) prompt with a statement or question, and then generating a response or continuation based on that prompt. CoT Example
Self-Consistency 自我一致性 取代思维链(CoT)提示中使用的naive greedy decoding(天真贪婪解码)。其理念是通过少次CoT对多种不同的推理路径进行采样,并利用各代推理选择最一致的答案。这有助于提高 CoT 提示在涉及算术和常识推理任务中的性能。 Prompt: When I was 6 my sister was half my age. Now I’m 70 how old is my sister? Output: 35 答案错误
ReAct (Reason + Act) 以交错的方式生成推理跟踪和特定任务的行动。生成推理轨迹允许模型诱导、跟踪和更新行动计划,甚至处理异常。行动步骤允许与外部来源(如知识库或环境)连接并收集信息,还能提高 LLM 的人工可解释性和可信度。总之,作者发现最好的方法是将 ReAct 与思维链(CoT)相结合,这样就能在推理过程中同时使用内部知识和外部信息。ReAct受到人类在学习新任务、做决策或推理时“表演”和“推理”之间的协同作用启发,它是一种将推理和行为结合起来的通用范式,通过激发语言模型生成口头推理过程和任务行为,实现动态推理以制定、维护和调整行动计划,并能够与外部环境(例如维基百科)进行交互,将额外信息纳入推理过程,从而解决思维链(CoT)提示的局限性,如缺乏对外部世界的访问或无法更新知识而导致的事实虚构和错误传播问题。 react example


show git comment