Home »
AI Prompts Tutorial
Types of AI Prompts
AI prompts can be created in different ways depending on the task, information required, and expected output. Understanding the different types of AI prompts can help you choose the right prompt for a particular task.
In this chapter, you will learn about common types of AI prompts, their purpose, and simple examples of each type.
Question Prompts
Question prompts ask the AI model for information, an explanation, or an answer to a specific question.
For example:
What is machine learning?
Another example is:
What are the main features of Python?
Question prompts are commonly used for learning, research, and general information.
Instruction Prompts
Instruction prompts tell the AI model to perform a specific task.
For example:
Write a short introduction to cybersecurity.
Another example is:
Convert the following text into a bullet-point list.
Instruction prompts are useful when you want the AI model to perform an action rather than simply answer a question.
Role-Based Prompts
Role-based prompts ask the AI model to respond from a particular role or perspective.
For example:
Act as a Python instructor and explain loops to a beginner.
Another example is:
Act as a technical writer and explain REST APIs in simple English.
Role-based prompts can help define the perspective, style, or expertise expected in the response.
Context-Based Prompts
Context-based prompts provide additional information before asking the AI model to perform a task.
For example:
I am preparing a presentation for college students.
Explain the basics of artificial intelligence using simple English.
The information about the audience provides context for the task.
Context can include information about the audience, situation, purpose, background, or previous information.
Zero-Shot Prompts
A zero-shot prompt asks the AI model to complete a task without providing an example of the expected output.
For example:
Classify the following review as positive or negative:
"The product is easy to use and works very well."
No example of a positive or negative review is provided.
Zero-shot prompts are useful when the task is relatively straightforward and the expected result can be understood from the instruction.
One-Shot Prompts
A one-shot prompt provides one example to show the AI model how the task should be performed.
For example:
Convert the sentence into a question.
Example:
Statement: Python is a programming language.
Question: Is Python a programming language?
Now convert:
Statement: Java is object-oriented.
The example provides guidance for the expected output.
Few-Shot Prompts
Few-shot prompts provide multiple examples before asking the AI model to perform the task.
For example:
Classify the following sentences as Formal or Informal.
Example 1:
"Please provide the requested information."
Classification: Formal
Example 2:
"Can you send me the details?"
Classification: Informal
Now classify:
"Could you please share the report?"
Few-shot prompts are useful when the task has a specific pattern that may be difficult to describe using instructions alone.
Summarization Prompts
Summarization prompts ask the AI model to shorten or summarize information while retaining important points.
For example:
Summarize the following article in 100 words.
Another example is:
Summarize the following meeting notes and list the five most important points.
Summarization prompts are commonly used for articles, documents, reports, emails, and meeting notes.
Classification Prompts
Classification prompts ask the AI model to place information into predefined categories.
For example:
Classify the following customer review as Positive, Negative, or Neutral:
"The delivery was late, but the product quality was excellent."
Classification prompts can be used for customer feedback, emails, documents, reviews, and other types of text.
Analysis Prompts
Analysis prompts ask the AI model to examine information and provide insights, comparisons, patterns, or conclusions.
For example:
Analyze the following sales data and identify the three months with the highest revenue.
Another example is:
Compare these two programming languages and explain their main differences.
Analysis prompts are commonly used for research, business data, reports, and decision-making.
Code Generation Prompts
Code generation prompts ask the AI model to create programming code.
For example:
Write a Python program to calculate the factorial of a number.
Another example is:
Write a JavaScript function that checks whether a number is even or odd.
Code generation prompts can also be used to create SQL queries, scripts, functions, classes, and other programming solutions.
Creative Writing Prompts
Creative writing prompts ask the AI model to create original written content based on a topic, idea, style, or situation.
For example:
Write a short story about a programmer who discovers an AI system that can predict the future.
Other examples include prompts for poems, stories, advertisements, scripts, and creative descriptions.
Image Generation Prompts
Image generation prompts describe an image that an AI image generation system should create.
For example:
Create an illustration of a futuristic city with autonomous cars,
modern skyscrapers, and people using AI-powered devices.
Image prompts can describe the subject, environment, composition, style, lighting, colors, and other visual details.
Structured Output Prompts
Structured output prompts specify how the AI model should organize its response.
For example:
List five programming languages in the following format:
1. Language:
Main Use:
Difficulty:
Another example is:
Return the information as a JSON object containing:
name, age, and occupation.
Structured output prompts are useful when the response needs to follow a specific format.
Instruction and Constraint Prompts
These prompts combine a task with specific rules or limitations that the AI model should follow.
For example:
Explain cloud computing in 200 words.
Use simple English.
Include three examples.
Use headings and bullet points.
The prompt contains both the main instruction and constraints for the response.
Multi-Step Prompts
Multi-step prompts ask the AI model to perform more than one related task.
For example:
Analyze the following article.
1. Summarize the article.
2. Identify the main points.
3. List the advantages and disadvantages.
4. Provide a short conclusion.
Multi-step prompts are useful when a task contains several connected requirements.
Advertisement
Advertisement