What Is a Prompt?
A prompt is the input or instruction you give to an LLM to tell it what you want it to do.
A prompt tells the LLM what you want.
Think of a prompt as the way you communicate a task to an AI model.
What Is a Prompt?
Suppose you ask an AI:
That sentence is a prompt. The LLM receives it and generates a response.
The important idea is simple: your prompt tells the model what task you want it to perform.
A Prompt Is More Than Just a Question
A common beginner mistake is thinking:
Not exactly. A prompt can contain an instruction, context, examples, rules, or several of these together.
"Write a Python function."
"Write a Python function that calculates the average of a list of numbers."
"Write a Python function that calculates the average of a list of numbers. Use Python 3, keep the code simple, and explain it for a beginner."
All three are prompts. The difference is how much direction they give the model.
The Four Main Parts of a Good Prompt
A useful mental model is:
You do not need all four every time. Use the pieces that are useful for the task.
Instructions
An instruction tells the LLM what you want it to do.
The instruction is: Summarize.
"Translate this sentence into Spanish."
"Write Python code to calculate factorial."
Context
Context gives the LLM the information it needs to perform the task correctly.
Compare these two prompts:
"Write a response."
"The customer has been waiting 10 days for the order. Write a polite response explaining that it will arrive tomorrow."
The second prompt gives the model enough information to produce a more useful response.
Examples
Sometimes the instruction alone is not enough. You can show the model examples of the behavior you want.
Suppose you want to classify customer messages:
Example 1:
"I love this product."
→ Positive
Example 2:
"The product arrived broken."
→ Negative
Example 3:
"The product arrived yesterday."
→ Neutral
Then give the model a new message:
The expected classification is: Positive.
Providing a small number of examples to guide the model's behavior is commonly called few-shot prompting.
Why Are Examples Powerful?
Examples are especially useful when the task has several possible categories or a specific expected format.
For example, imagine these categories:
"I want my money back."
→ Refund Request
"My product isn't working."
→ Technical Issue
"How long will shipping take?"
→ Question
"I really like the product."
→ General Feedback
Now the model has concrete examples showing how messages should be classified.
Constraints
A constraint tells the LLM what limitations or rules the output should follow.
"Explain Python in 100 words."
"Give exactly 3 examples."
"Return only JSON."
Real-World Example — Product Description
Imagine you are building an AI system that generates product descriptions for an e-commerce website.
Product:
Wireless headphones
Instruction:
Write a product description.
Context:
30-hour battery life,
Bluetooth 5.3,
noise cancellation.
Constraints:
- Maximum 80 words
- Simple English
- Mention battery life
- Don't invent information
The prompt gives the model the task, the product information, and the rules it needs to follow.
Practical Python Example
Now let's send a structured prompt to an LLM from Python.
from openai import OpenAI
client = OpenAI()
prompt = """
Explain Python to a complete beginner.
Requirements:
- Use simple English.
- Keep it under 100 words.
- Give 2 real-world examples.
"""
response = client.responses.create(
model="gpt-5.6",
input=prompt
)
print(response.output_text)
The variable prompt contains the instructions and constraints that we want the model to follow.
Practical Example — Customer Support
Imagine an AI customer-support system. The customer asks:
Your application retrieves the customer's order data.
Context:
Order #12345 is delayed.
Expected delivery is August 28.
Instruction:
Write a polite response to the customer.
Constraints:
- Be concise.
- Don't promise an earlier delivery date.
- Don't invent information.
The LLM can now generate something like:
I'm sorry for the delay. Your order #12345 is currently delayed and is expected to arrive by August 28.
The important point is that the application supplied the real order information. The LLM generated the natural-language response.
Practical Example — Text Classification
Suppose your application needs to classify customer messages into four categories:
Classify the customer's message.
Categories:
- Refund
- Technical Support
- Shipping
- General
Examples:
"I want my money back."
→ Refund
"My application keeps crashing."
→ Technical Support
"When will my package arrive?"
→ Shipping
"Your product is excellent."
→ General
Customer message:
"My order hasn't arrived yet."
The expected output is:
Shipping
The examples make the classification behavior much clearer to the model.
Prompt vs Context
These two concepts are related, but they are not the same thing.
Don't Make Prompts Unnecessarily Huge
A common beginner mistake is thinking:
That's wrong.
A long prompt can be useful for a complex task, but unnecessary instructions add noise and consume tokens.
"Explain Python simply."
"Explain Python to a beginner in simple English. Explain what Python is, where it is used, and give two real-world examples. Keep it under 200 words."
Give the model enough information to remove ambiguity — not as much information as possible.
The Real-World Prompting Process
In a production GenAI application, prompting is usually part of a larger application flow.
Connect Tokens, Context & Prompts
These three concepts are connected.
Pieces of text the LLM processes.
Information the LLM can use for the current task.
Instructions and information given to the LLM.
A good prompt removes ambiguity.
- A prompt tells an LLM what you want it to do.
- Instructions describe the task.
- Context provides relevant information.
- Examples demonstrate the expected behavior.
- Constraints control the output.
- Good prompts are clear, not unnecessarily long.
Test Your Understanding
Answer: The input or instruction given to an LLM to tell it what you want it to do.
Answer: Context provides information the model needs, while an instruction tells the model what task to perform.
Answer: Examples show the model the expected behavior, which is especially useful for classification and specific output formats.
Answer: No. A prompt should contain enough information to remove ambiguity without adding unnecessary instructions.
You now understand what a prompt is.
You know how instructions, context, examples, and constraints work together to communicate a task to an LLM.