Prompt Engineering: Role
A role tells the model who it is. 'You are a senior support agent' changes the answer.
No role
With no role, the model picks its own tone. The reply may fit or miss the job.
Write a reply to a customer whose mug arrived chipped.A support agent role
The role sets the tone. The reply follows the damaged-item policy and offers the customer's choice.
You are a senior support agent for ShopStack. Write a reply to a customer whose Aurora Ceramic Mug arrived chipped. Ask for a photo and offer a replacement or a refund.A wrong role
A salesperson role pulls a pitch into a complaint. The role must fit the job.
You are a salesperson for ShopStack. Write a reply to a customer whose Aurora Ceramic Mug arrived chipped.Example
You are a senior support agent for ShopStack. Write a short reply to a customer who wants to return the Willow Linen Cushion because she bought the wrong colour. Returns run 30 days for unused items with a full refund to the original payment method.Key points
- A role is the first line of a prompt. It names the job the model takes on.
- Role first, task second. The role shapes every word that follows.
- A senior support agent answers with care and policy. A salesperson answers with a pitch.
- The role must fit the job. A wrong role pulls the wrong tone.
This example runs a prompt with a role against the local model and shows the reply it gave.
Note
A role does not add facts. It shapes how the facts are said.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
Where does the role go in a prompt?