A prompt is the instruction or input given to an AI model to generate a response.
To obtain accurate and useful results, a prompt should contain certain important components. These components help the AI understand what task needs to be performed, what information is required, and how the output should be presented.
The main components of a prompt include:
- Instruction
- Context
- Input Data
- Output Format
- Constraints (optional but useful)
Let us understand each component with examples.
1. Instruction
The instruction tells the AI what task it needs to perform. It clearly defines the action that the AI should take, such as explaining a concept, summarizing text, generating ideas, or writing code.
The instruction is usually written using action words like explain, summarize, generate, describe, list, or analyze.
Example:
Prompt:
“Explain machine learning.”
In this prompt, the instruction is “Explain”, which tells the AI that it needs to provide an explanation.
Better Example:
“Explain machine learning in simple words.”
Here the instruction still remains “Explain”, but it is slightly clearer about the expected explanation.
More Example 2: Summarize
Prompt:
“Summarize the following paragraph about climate change.”
Instruction word: Summarize
Task: The AI reduces the information into a shorter version while keeping the main ideas.
Example 3: List
Prompt:
“List five applications of artificial intelligence in healthcare.”
Instruction word: List
Task: The AI generates information in the form of a list.
Example 4: Describe
Prompt:
“Describe how machine learning is used in recommendation systems.”
Instruction word: Describe
Task: The AI explains the concept with more descriptive details.
Example 5: Generate
Prompt:
“Generate three ideas for a blog about artificial intelligence.”
Instruction word: Generate
Task: The AI creates new content or ideas.
Example 6: Compare
Prompt:
“Compare supervised learning and unsupervised learning.”
Instruction word: Compare
Task: The AI highlights similarities and differences between two concepts.
Example 7: Translate
Prompt:
“Translate the following sentence into Spanish: Artificial Intelligence is transforming the world.”
Instruction word: Translate
Task: The AI converts the text from one language to another.
Example 8: Write
Prompt:
“Write a short paragraph about the importance of data in artificial intelligence.”
Instruction word: Write
Task: The AI generates written content on the given topic.
These examples show that the instruction is one of the most important parts of a prompt, because it determines what kind of response the AI will generate.
examples:
2. Context
The context provides background information that helps the AI understand the situation or the audience. Adding context improves the relevance and accuracy of the response.
Context answers questions such as:
- Who is the audience?
- What level of detail is needed?
- What situation is being discussed?
Example without context:
“Explain neural networks.”
Example with context:
“Explain neural networks to first-year engineering students.”
In the second prompt, the AI understands that the explanation should be simple and beginner-friendly.
Another Example:
“Explain the benefits of renewable energy for developing countries.”
Here, the context specifies where the benefits are being considered.
More examples: Example 2: Professional Context
Prompt without context:
“Explain blockchain.”
Prompt with context:
“Explain blockchain technology for business professionals.”
Here, the AI will focus more on business applications rather than technical details.
Example 3: Educational Context
Prompt without context:
“Explain photosynthesis.”
Prompt with context:
“Explain photosynthesis for a 10th-grade biology class.”
The context helps the AI adjust the explanation according to the academic level of the audience.
Example 4: Purpose-Based Context
Prompt without context:
“Write about artificial intelligence.”
Prompt with context:
“Write a short introduction about artificial intelligence for a college assignment.”
This tells the AI the purpose of the content and influences the tone and structure of the response.
Example 5: Industry Context
Prompt without context:
“Explain data analytics.”
Prompt with context:
“Explain how data analytics is used in the healthcare industry.”
The context directs the AI to focus specifically on healthcare-related applications.
3. Input Data
Input data refers to the specific information provided to the AI that it needs to process. This could be a paragraph to summarize, a dataset to analyze, or a piece of code to debug.
Example:
Prompt:
“Summarize the following paragraph:
Artificial Intelligence is transforming many industries such as healthcare, education, and finance by enabling machines to learn from data and make intelligent decisions.”
In this case, the paragraph given is the input data, and the AI must process it to produce a summary.
Another Example:
“Translate the following sentence into French:
Artificial Intelligence is the future of technology.”
The sentence provided is the input data that the AI will translate.
More example:
Example 3: Text Classification
Prompt:
“Identify whether the following review is positive or negative:
‘The mobile phone has excellent battery life and a great camera.’”
The review sentence is the input data, and the AI must analyze it to determine the sentiment.
More example:
Example 4: Code Analysis
“Explain what the following Python code does:
for i in range(1,6):
print(i*i)
“
Here the Python code is the input data because the AI must read it and explain it.
Example 5: Data Interpretation**
Prompt: “Analyze the following data and identify the highest value: 23, 45, 12, 67, 34”
The numbers are the **input data**, and the AI processes them to find the highest value. —
**Example 6: Error Detection**
Prompt: “Find the error in the following sentence: ‘She don’t like coffee.’”
The sentence is the **input data**, and the AI must analyze it to identify the grammatical mistake. —
These examples show that **input data is the information that the AI processes to generate a meaningful output.
** The clearer and more accurate the input data, the better the response produced by the AI.
4. Output Format
The output format specifies how the response should be presented. It helps structure the answer in a clear and organized way.
Examples of output formats include:
- Bullet points
- Short paragraph
- Step-by-step explanation
- Table
- Code snippet
Example:
“Explain the advantages of artificial intelligence in five bullet points.”
Here the AI understands that the output must be structured as bullet points instead of a paragraph.
Another Example:
“Explain the steps of the machine learning process in numbered steps.”
Specifying the format makes the response more organized and easier to read.
More examples:
Example 1: Paragraph Format
Prompt:
“Explain the importance of data in artificial intelligence in one short paragraph.”
Here, the AI understands that the response should be written in a single paragraph.
Example 2: Bullet Points
Prompt:
“List the applications of artificial intelligence in healthcare using bullet points.”
The AI will present the answer as a list of bullet points.
Example output structure:
• Disease diagnosis
• Medical image analysis
• Drug discovery
• Patient monitoring
Example 3: Table Format
Prompt:
“Compare supervised learning and unsupervised learning in a table.”
The AI will organize the answer into a table format for easy comparison.
Example structure:
| Feature | Supervised Learning | Unsupervised Learning |
| Data Type | Labeled Data | Unlabeled Data |
| Example | Classification | Clustering |
Example 4: Step-by-Step Explanation
Prompt:
“Explain the process of training a machine learning model step by step.”
The AI will structure the response as numbered steps, making the explanation easier to follow.
Example structure:
- Collect data
- Prepare and clean the data
- Train the model
- Evaluate the model
- Deploy the model
Example 5: Code Format
Prompt:
“Write a Python program to print numbers from 1 to 5.”
Here the AI understands that the output should be in the form of a code snippet.
Example output:
for i in range(1,6):
print(i)
Example 6: Numbered List
Prompt:
“Explain five benefits of artificial intelligence using a numbered list.”
The AI will structure the answer like this:
- Automation of repetitive tasks
- Improved decision-making
- Faster data analysis
- Increased efficiency
- Enhanced customer experience
These examples show that specifying the output format helps guide the AI to present information in a structured and readable way.
5. Constraints
Constraints are limitations or conditions placed on the response. They guide the AI on what should or should not be included.
Common constraints include:
- Word limits
- Specific style or tone
- Target audience
- Level of difficulty
Example:
“Explain deep learning in 100 words.”
Here the AI must generate a response within the word limit.
Another Example:
“Write a short explanation of artificial intelligence in simple language suitable for school students.”
This constraint ensures that the explanation remains simple.
More examples:
Example 1: Word Limit Constraint
Prompt:
“Explain machine learning in 50 words.”
Here the AI must keep the response within a specific word limit.
Example 2: Audience Constraint
Prompt:
“Explain artificial intelligence in simple language for school students.”
This constraint ensures that the explanation remains easy to understand.
Example 3: Tone Constraint
Prompt:
“Write a short paragraph about renewable energy in a formal academic tone.”
Here the AI adjusts the writing style to sound more professional and academic.
Example 4: Length Constraint
Prompt:
“List three advantages of artificial intelligence.”
The AI must limit the answer to exactly three points.
Example 5: Content Restriction
Prompt:
“Explain the benefits of social media without mentioning Facebook or Instagram.”
This constraint tells the AI what information should not be included in the response.
Example 6: Difficulty Level Constraint
Prompt:
“Explain neural networks in a beginner-friendly way without using technical terms.”
This constraint ensures that the explanation remains simple and avoids complex terminology.
Example 7: Time-Based Constraint
Prompt:
“Write a two-minute speech about the importance of artificial intelligence.”
The AI will structure the content to fit a short speaking duration.
These examples show that constraints help control the length, style, complexity, and focus of the AI’s response. By adding appropriate constraints, users can guide the AI to produce more accurate and suitable outputs.
Example of a Complete Prompt
A well-structured prompt may combine all components.
Example:
“Explain the concept of machine learning to first-year engineering students in five bullet points using simple language.”
In this prompt:
Instruction → Explain
Context → For first-year engineering students
Output Format → Five bullet points
Constraint → Use simple language
By combining these components, the prompt becomes clearer and produces more useful results.
More examples:
Example 2
Prompt:
“Summarize the following paragraph about climate change in two sentences.”
Components:
Instruction → Summarize
Input Data → Paragraph about climate change
Output Format → Short paragraph summary
Constraint → Limit to two sentences
Example 3
Prompt:
“Compare supervised learning and unsupervised learning in a table format suitable for beginner AI students.”
Components:
Instruction → Compare
Context → For beginner AI students
Output Format → Table
Example 4
Prompt:
“Write a short paragraph about the importance of renewable energy in developing countries using about 80 words.”
Components:
Instruction → Write
Context → Renewable energy in developing countries
Output Format → Paragraph
Constraint → Around 80 words
Example 5
Prompt:
“Explain the following Python code step by step for beginner programmers:
for i in range(1,6):
print(i)”
Components:
Instruction → Explain
Input Data → Python code snippet
Context → Beginner programmers
Output Format → Step-by-step explanation
Example 6
Prompt:
“List five applications of artificial intelligence in healthcare in numbered points.”
Components:
Instruction → List
Context → Healthcare domain
Output Format → Numbered list
Constraint → Five points
These examples demonstrate how combining different components makes prompts clearer, more structured, and more effective when interacting with AI systems.
