2 min read

Your Prompt Sucks: How to Use Roles and Personas

Your Prompt Sucks: How to Use Roles and Personas

Prompt Engineering 01: Roles and personas

This is the first entry in our series on prompt engineering. Subscribe or check back here for our next entries in the series.

Prompt Engineering is equal parts art and science, yet we're still unraveling the science part. Chances are, your prompts have been created through trial and error and iteration. Ever had a bad response from your LLM? Maybe you added a line to your prompt to avoid that scenario next time. However, over time, your prompt can become a tangled mess of edge cases. It's beneficial to step back and apply some of the emerging science of prompt engineering.

Role: Not Just a Fancy Label

Let's start with the Role. This isn't just about slapping a job title on your AI. It's about defining its purpose, its essence.

Example: Customer support chatbots.

A basic prompt like "You are a helpful customer support agent" will function, but you might find the language too rigid or the tone mismatched. The initial impulse is to add to the prompt, like including "use informal language." However, this is often an imprecise solution.

Instead of instructing the LLM on what to do, tell it who it is. Try, "You're a savvy support guru, adept at solving tech problems with patience and clarity." This approach not only defines the role but also implies the manner of execution, leading to a more natural interaction that aligns with your desired outcome.

Persona: Giving Your AI Some Personality

Next, we have the Persona. This is where your AI gets a personality makeover, crucial for tone and branding.

Example: A research agent.

If it's currently sounding like a monotonous librarian, here's a fix. Instead of "You are an AI agent designed to perform research tasks," try "You are a digital detective, hunting down information with precision and an analytical edge." This shift doesn’t just alter the task; it transforms the entire approach, making the interaction more engaging and aligned with your brand.

Iterating Your Prompt

With your role and persona defined, you're on your way to generating more consistent LLM outputs. However, you'll inevitably encounter responses that miss the mark.

For your chatbot, if customers are baffled by technical jargon, resist the urge to simply tack on instructions like "Explain ideas in simple language." Instead, weave this requirement into the role: "You're a tech-savvy problem solver who breaks down complex ideas into simple, everyday language."

For your research agent, if it's inundated with irrelevant sources, don't just add instructions on source selection. Refine its role to include "prioritizing high-quality, relevant sources."

By embedding the specifics within the role itself rather than as additional instructions, you achieve more consistent and efficient responses, optimizing token usage.

Conclusion

Crafting the right prompt is a mix of precision, creativity, and a fair bit of trial and error. Remember, an AI is only as good as its instructions. If your prompt is unwieldy or the responses are hit-or-miss, it might be time to reevaluate your role and persona definitions.

Need a Prompt Lifeline?

If you're tired of relying on trial and error for prompts that lead nowhere, Baserun's here to help. Our Prompt Playground and Prompt Wizard can fine-tune your prompts for better accuracy and efficiency. Dive in at baserun.ai.

Our Prompt Wizard is currently in beta, if you want to try it out email us at hello@baserun.ai or signup here.