Beginner-Friendly Topic
Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on. You've got this! 🚀
Role and Task Instructions
You can improve AI responses significantly by telling the AI what role to play or what perspective to take. This helps the model apply the right knowledge and tone for your situation.
Role Prompting
Role prompting means telling the AI to respond as a specific type of expert or character.
Examples:
- 'You are a patient Python tutor for complete beginners. Explain list comprehensions.'
- 'You are an experienced startup founder. Review this business idea and give honest feedback.'
- 'You are a plain-English editor. Rewrite this legal paragraph so a 10-year-old can understand it.'
Role prompting works because it activates specific patterns the model learned from content written by or about that type of expert.
Deep Learning ⊂ Machine Learning ⊂ Artificial Intelligence
Task Framing
- Act as: 'Act as a job interview coach and ask me 5 common interview questions for a software engineering role'
- You are: 'You are a nutritionist. Create a 7-day meal plan for someone who does not eat meat'
- Respond as: 'Respond as a friendly customer service agent helping someone who is frustrated about a delayed order'
- Take the perspective of: 'Take the perspective of a first-time home buyer and explain what questions I should ask before signing a mortgage'
Common Mistake
Warning
Role prompting improves the style and focus of responses but does not give the AI new knowledge or real expertise. An AI told to act as a doctor does not have medical license knowledge or clinical experience. Always verify health, legal, or financial information with qualified human professionals.
Key Takeaways
- You can improve AI responses significantly by telling the AI what role to play or what perspective to take.
- Act as: 'Act as a job interview coach and ask me 5 common interview questions for a software engineering role'
- You are: 'You are a nutritionist. Create a 7-day meal plan for someone who does not eat meat'
- Respond as: 'Respond as a friendly customer service agent helping someone who is frustrated about a delayed order'