Guidelines
📘Guidelines for Prompt Engineering
In this section, you will learn the best guidelines that will help you to create the best prompts to produce the desired output. Here are the guidelines for prompt engineering:
- Pretend to be expert like travel guide, doctor, teacher, etc.
- Define your goal as specific as possible.
- Ask your answer in certain format like table, list, etc.
- Give examples in prompts.
- Tell you to ask question if needed.
- Give the steps to complete the task.
- Write Condition if needed.
📘Pretend to be Expert
Large language models like ChatGPT have a lot of knowledge. To get the best results, you need to pretend to be an expert like a travel guide, doctor, teacher, etc. See the example below:
Act as a professional content writer with 10 years of experience. Write a 500-word article on the topic of "Top 10 places to visit in the USA."
Act as a professional doctor with 10 years of experience. Write a 500-word article on the topic of "Top 10 ways to prevent heart disease."
Note: If you are seeking health advice, please consult a doctor. It may also provide incorrect information.
📘Define Your Goal
If you know what you want, you will get the best results. So, define your goal as specific as possible. See the example below:
I want to learn about how internet works. I am beginner in this topic. Explain me in simple words step by step.
I want to learn about world war 2 for my exam. Give answer in bullet points.
Note: In the first example, the goal is to learn about internet. In the second example, the goal is to learn about world war 2 for exam.
📘Ask Your Answer in Certain Format
You can ask your desired output in certain format like table, list, csv, json, etc.
Act as technology expert and write key things happen in Apple company from start to now in table format.
I am opening new restaurant. Can you help me to create professional menu in html format?
Note: In the first example, the answer is in table format. In the second example, the answer is in html format.
📘Give Examples in Prompts
If you give examples in prompts, it will help the model to understand the task better. See the example below:
Complete the following translation task:
English: Dog → Spanish: Perro
English: Cat → Spanish: Gato
English: Hello → Spanish: ?
Complete the following date conversion task:
2023-08-17 → August 17, 2023
2021-12-01 → December 01, 2021
2023-05-15 → ?
Note: In the first example, the model learns the pattern of translation and provides you the answer. In the second example, the model learns the pattern of date conversion and provides you the answer.
📘Tell You to Ask Question if Needed
If you ask large language models like ChatGPT to ask you questions to get the best results, it will ask you questions and that will help the model to understand the task better. See the example below:
I want to write article about Computer. Ask me questions questions if you need to get best results otherwise write article in your own words.
Write a screenplay for a short film. Ask me questions if you need to get best results otherwise write screenplay in your own words.
Note: Asking questions helps the model to understand the task better and provide you best result. In both examples, the model asks you questions to get the best results.
📘Give the Steps to Complete the Task
If you provide each step to complete the task, it will do work according to your steps and provide you the best results. See the example below:
Determine whether the student's solution is correct or not.
Steps:
1. First, do your solution
2. Then check your solution with the student's solution
3. If both are the same, then the answer is correct; otherwise, it is incorrect
Question: What is 2+20*2
Student Solution: 44
"""
Prompt engineering is the process of structuring words in a way that can be interpreted and understood by a generative AI model. A prompt can describe a desired output, such as a high-quality photo of an astronaut riding a horse, or a command, such as writing a limerick about chickens. Understanding prompts is an emergent ability of large language models (LLMs).
"""
Steps:
1. Summarize the text in one sentence
2. Translate it to Japanese and French Language
Use the following format:
Summary: <summary>
Japanese: <japnease translation>
French : <french translation>
Note: In both examples, the model follows the steps and based on the steps, it provides you the best results.
You can use delimiters to separate the prompt from the question. This helps the model understand the task better.
Delimiter Name | Delimiter Symbol |
---|---|
Triple Quotes | """ |
Triple Backticks | ``` |
Triple Dashes | — |
Angle Brackets | < > |
Note: - If you provide context (Detailed information about the task), it will help the model to understand the task better.
📘Write Condition if Needed
If you want to get the answer according to your condition, you can write condition in your prompt. See the example below:
Provide a recipe that does not include any meat or fish.
Write a poem about world war 2. The poem should be in 4 lines.
Note: In the first example, the condition is that the recipe should not include any meat or fish. In the second example, the condition is that the poem should be in 4 lines.
🚀Key Points
- Write prompts by acting as experts, like doctors or teachers.
- Clearly define your specific goals.
- Specify the desired format (e.g., table, list).
- Use examples to clarify tasks for the model.
- Allow the model to ask questions for clarity.
- Break down tasks step-by-step.
- Set conditions if there are specific requirements.