Skip to main content
Helicone OSS LLM Observability

Leverage role-playing

Assign a specific role or persona to the model as a system prompt to set the style, tone, and content of the output.
2 min read

Why use role-prompting#

  • Targeted responses: the model can produce information that's more aligned with the desired perspective or expertise.
  • Audience alignment: ensures the content is suitable for the intended audience.
  • Style consistency: maintains a consistent tone and style throughout the response.
  • Enhanced engagement: make the content more relatable and engaging, especially in creative or educational contexts.

How to implement role-playing#

  1. Assign a specific role or persona
  2. Set the task or goal
  3. Include style and tone instructions

Example#

Example 1: Customer service scenario.

Assign the role of a customer service representative, the model is guided to respond in a professional manner appropriate for the hospitality industry.

Prompt:

You are a customer service representative for a luxury hotel chain. A guest has emailed complaining about a billing error on their recent stay. Compose a professional and apologetic email addressing their concerns and explaining the steps you will take to resolve the issue.

Example 2: Medical advice.

The role-playing helps the model provide information sensitively and appropriately for a non-expert audience.

Prompt:

You are a pediatrician explaining to a concerned parent the importance of vaccinations for their child. Use simple language and address common misconceptions.

Example 3: Technical writing.

The model adopts the perspective of a professional who can explain complex concepts in an accessible way.

Prompt:

As an experienced software engineer, write documentation for the installation of a new software package, intended for users with basic technical knowledge.