Giving the AI a Role
Giving the AI a role tells it what kind of expert to act as, which changes its focus, words and tone.
What is Role Prompting?
You start the prompt with "You are..." or "Act as...". The role helps the model choose the right knowledge and style.
Example
You are an experienced English teacher. Check my paragraph for
grammar mistakes. List each mistake, the correction, and a
one-line reason. Do not rewrite the whole paragraph.Without the role, the AI might just rewrite your text. With the role and clear task, it teaches you.
Useful Roles
| Role | Good for |
|---|---|
| Patient teacher | Explaining a new topic simply |
| Strict examiner | Practising for exams and getting honest marks |
| Editor | Improving clarity and grammar |
| Senior developer | Reviewing code and finding bugs |
| Marketing expert | Ad copy, captions, campaign ideas |
| Customer | Testing your sales pitch from the buyer's side |
| Interviewer | Practising for a job interview |
Role + Audience + Tone
A role is strongest when you also say who the reader is and what tone to use:
Example
You are a friendly bank customer support agent.
A customer who is not good with technology asks how to
reset their mobile banking PIN. Reply in simple Roman Urdu,
in 4 short steps, with a calm and patient tone.Roles in Apps: the System Prompt
When developers build a chatbot, they put the role in a hidden system message. Every user message is then answered in that role. Here is how such a conversation is structured in code:
Example
conversation = [
{"role": "system",
"content": "You are the assistant for Ayesha's Bakery in Karachi. "
"Answer only questions about the menu, prices and delivery. "
"Be polite and keep answers under 50 words."},
{"role": "user", "content": "Do you deliver to Gulshan-e-Iqbal?"},
]
for message in conversation:
print(message["role"].upper(), ":", " ".join(message["content"].split()[:8]))SYSTEM : You are the assistant for Ayesha's Bakery in USER : Do you deliver to Gulshan-e-Iqbal?
The model sees both messages and answers as the bakery assistant. You will build this in the Chatbots tutorial.
Role Play for Practice
Roles are also great for practising real situations:
Example
Act as an interviewer for a junior web developer job.
Ask me one question at a time. After each answer, give
a score out of 10 and one tip to improve. Start now.Limits of Roles
- A role does not give the AI new knowledge. "You are a doctor" does not make medical answers safe to follow without a real doctor.
- Very long, dramatic role descriptions rarely help more than one clear sentence.
- The task and context still matter more than the role.
A role sets the style and focus. The facts still come from the model's training and the context you provide, so check important answers.
Exercise
Exercise
In a chatbot app, where is the bot's role usually placed?
