Why Should You Learn Prompt Engineering?
In an era where AI is applied across nearly all industries, AI is utilized everywhere, from personal travel planning to sales data analysis.
However, AI can sometimes provide irrelevant answers to questions or overwhelm users with overly lengthy responses to simple queries.
At times, you might not even know what to ask to resolve a problem.
Just as humans need clear instructions to work effectively, generative AI also requires proper guidance.
To address this, the systematic method of crafting effective questions for AI is called Prompt Engineering.
A prompt is a sentence that conveys the user's request to AI. Prompt engineering optimizes these prompts to help AI deliver the desired responses.
Examples of Prompt Engineering in Action
Let’s look at specific examples to understand how prompt engineering can be applied.
Imagine asking AI to create a workout schedule and diet plan for a healthy lifestyle.
I want to create a workout schedule for the gym. From June 1 to June 10, 2024, on alternate days, tell me what exercises I should do each day along with a diet plan.
The prompt above requests a workout schedule and diet plan, but the AI's response may contain excessive, irrelevant information, making it difficult for users to quickly grasp the desired details.
What if we revise the prompt as follows?
I want to create a workout schedule for the gym. From June 1 to June 10, 2024, on alternate days, please organize the schedule into a table, including the exercises for each day along with breakfast and dinner plans. ---Table Format--- ### Title | No | Date | Day | Exercise | Breakfast | Dinner |
Now, the workout schedule is neatly organized into a table alongside the diet plan, making the output much easier to interpret.
By applying this, you can prevent ChatGPT from generating unnecessarily long responses
or structure its output into .csv
or .xlsx
formats suitable for spreadsheets.
Note that the ###
used next to the table format serves as a delimiter
to clearly separate and structure information within the prompt.
This delimiter helps AI distinguish the context of the prompt, ensuring it recognizes that everything below ###
pertains to the table format.
The vertical bars |
used to define the table format act as delimiters for table columns,
and they are commonly used when writing tables in Markdown
.
Markdown: A simple markup language for styling text and creating elements like headings, bold text, and tables.
| No | Date | Day | Exercise | Diet | |----|------------|------|----------|------------| | 1 | 2024-06-10 | Mon | Running | Salad | | 2 | 2024-06-11 | Tue | Swimming | Pasta |
The Markdown table above appears in an AI response or Markdown document as shown below:
No | Date | Day | Exercise | Diet |
---|---|---|---|---|
1 | 2024-06-10 | Mon | Running | Salad |
2 | 2024-06-11 | Tue | Swimming | Pasta |
Prompt engineering not only formats responses and improves readability, but also helps prevent incorrect answers from AI.
Examples of using prompt engineering to prevent incorrect answers will be covered in the next lesson. :)
Practice
Click on the provided prompt examples and compare the AI’s responses.
Which of the following is NOT a primary purpose of prompt engineering?
Optimizing AI responses
Expanding AI’s database
Clearly conveying user requests
Improving the readability of AI responses
Lecture
AI Tutor
Publish
Design
Upload
Notes
Favorites
Help