What are Prompts and How are They Structured?
Prompt
refers to a command or question given to generative AI to request a specific task.
For example, if you want AI to summarize a large body of academic papers, you might craft a prompt like this:
Please read the following paper and summarize the main points.
A prompt can be divided into the following four components:
-
Instruction
-
Context
-
Input Data
-
Output Directives
Instruction
An Instruction
is a sentence that directs AI on what task to perform.
Just like with people, to achieve successful results with AI, you need to give a clear
instruction
rather than a vague one.
Here are examples of a poor instruction and a good instruction.
Apologize for the delayed invoice to the client.
Please draft a business email apologizing for the delayed invoice to the client. Use a tone that is polite and conveys responsibility.
A good instruction not only requests a task (writing a business email) but also specifies criteria to consider when performing the task (polite tone, conveying responsibility).
Context
Context
provides background information that helps AI understand and evaluate the task better.
# Instruction
Based on the following product description, create an attractive advertisement slogan.
# Context
This product is a premium coffee machine targeting professionals in their 20s and 30s. We want to emphasize both convenience and luxury. Competitors have similar design and price, but our product excels in extraction speed and maintenance.
In the prompt above, the context informs the AI of the product's target audience and differentiating features, which helps the AI consider these factors when performing the task.
Input Data
Input Data
refers to the data that AI will analyze or reference to perform the task.
For instance, when asking AI for coffee machine ad slogans, input data can be provided as follows:
# Instruction
Based on the following product description, create an attractive advertisement slogan.
# Context
This product is a premium coffee machine targeting professionals in their 20s and 30s. We want to emphasize both convenience and luxury. Competitors have similar design and price, but our product excels in extraction speed and maintenance.
# Previously Created Ad Phrases
1. "A delicious cup of coffee to make your day extraordinary."
2. "Enjoy premium coffee effortlessly at home."
In the above prompt, the input data consists of previously created ad phrases
, which the AI will reference to generate new slogans.
Output Directives
The output directives guide the AI on what format to deliver the results in.
# Response Format
Please write the ad slogan in one sentence. Express it concisely and impressively within 20 characters. Also suggest 3 hashtags for social media.
This prompt specifies output directives through response formatting, instructing the AI on how to structure the results.
A prompt is not just a simple question; it is a carefully designed input to harness the capabilities of AI.
In the next lesson, we will explore an overview of how AI interprets prompts.