Why Should You Learn Prompt Engineering?
In today's world, AI
plays a crucial role in various aspects of our lives, from planning vacations to analyzing sales data.
However, AI doesn’t always provide relevant answers. It might generate responses that are too broad, too vague, or even completely off-topic.
Sometimes, we don't even know how to phrase our questions properly to get the answers we need.
Just as people need clear instructions to perform tasks correctly, generative AI requires
well-structured prompts
to deliver accurate responses.
To ensure AI provides precise and relevant answers, we use a structured approach called Prompt Engineering
.
A prompt is a set of instructions or a query given to AI, and prompt engineering involves refining these prompts to optimize the quality of AI-generated responses.
Improving AI Responses with Prompt Engineering
Let's look at a practical example of how prompt engineering enhances AI-generated responses.
Imagine you're asking AI for a workout and diet plan to help maintain a healthy lifestyle.
I'm creating an exercise schedule for the gym. Let me know which exercises would be good every other day from June 1 to June 10, 2024, and include the diet plan for each day.
The prompt above requests exercise schedules and diet plans, but the AI's response often includes excessive information that is difficult to interpret at a glance, making it hard for users to quickly glean the required information.
Now, let's refine the prompt for a clearer and more structured response:
I'm creating a schedule table for gym workouts. Please list which exercises would be good every other day from June 1 to June 10, 2024, along with breakfast and dinner diet plans, in table format. ---table format--- ### Title | Number | Date | Day | Exercise | Breakfast | Dinner |
You will see that your exercise schedule, along with the diet plan, is neatly organized in a table.
By applying this, you can prevent ChatGPT from providing excessively long responses or format information to suit .csv
or .xlsx
files for spreadsheets.
The ###
used next to the table format in the prompt acts as a Delimiter
to clearly separate and structure the information within the prompt.
This delimiter helps AI unmistakably identify the following as table format under the context of the prompt.
The vertical bar |
used to specify the table format acts as a delimiter for AI to separate table columns, which is a symbol used when creating tables in Markdown
.
Markdown: A document authoring method that uses simple symbols to easily style text for different sizes, weights, tables, etc.
| Number | Date | Day | Exercise | Diet | |-------|-----------|-----|---------|--------| | 1 | 2024-06-10 | Mon | Running | Salad | | 2 | 2024-06-11 | Tue | Swimming| Pasta |
The Markdown table above is displayed in AI responses or Markdown documents as follows:
Number | Date | Day | Exercise | Diet |
---|---|---|---|---|
1 | 2024-06-10 | Mon | Running | Salad |
2 | 2024-06-11 | Tue | Swimming | Pasta |
Prompt engineering is about specifying the format of responses and improving their readability, as well as preventing AI from providing incorrect answers.
In the next lesson, we’ll explore techniques to prevent AI from producing inaccurate responses. :)
Practice
Click on the different prompt examples and compare the AI-generated responses.
Prompt engineering is the process of optimizing AI to provide correct answers.
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help