Different roles in the API and their use cases

I am trying to understand the real difference between:

  1. Defining just the system role (as in my code block below)
  2. Defining system and user roles
  3. Defining just the user role

I mean I could take the whole system content below and assign it to the user role instead and just put the system role as ‘You are a helpful email writing assistant’ (or something along these lines) but what are the pros and cons of doing something like this?

I notice in other APIs e.g. Perplexity’s that a user role is required in your input prompt but it isn’t for OpenAI hence my question.

Btw, my prompt below mostly works fine… but I have issues in getting it to do a bit more reliably (e.g. if I add to the below and ask it to only output emails WITHOUT a call to action then it doesn’t behave reliably enough) and I feel like perhaps its related to the fact I don’t have a user role…

Overall, I am not trying to create a chatbot. I am trying to create an assistant that will simply take the data in the variables {} then write emails based on them. I don’t need functionality for the user to ask follow up questions etc.

messages = [{

"role": "system",
"content": 

f"“”

Write an email to the cold contact pitching our product.

Follow the 2-step instructions below to generate the email:

  1. Start the email with a HOOK using specific examples from {summary_data} to personalise the email.

  2. Our product solves the problems in {problems}.

“”" }]

response = client.chat.completions.create(
model=“gpt-3.5-turbo-1106”,
messages=messages
)

I don’t think it really matters all that much, apart from assistant messages

the LLM will be more reluctant to disagree with assistant messages, and sometimes ignore the last message entirely if it’s an assistant message (in some models and circumstances).

But you didn’t ask that.

I don’t think there’s much difference between user and system messages, you can use user messages as system messages and vice versa if you frame them right.

I use system messages to tell the model how to interpret user messages (context, nuance, etc), and user messages to tell the model what to do, but that’s probably just personal preference at this point.


I don’t think this is related to your format at all. There’s two things to keep in mind:

  1. telling a model to NOT do something will more likely than not encourage to do it anyways. Better not even give it any ideas in the first place

  2. some models have a certain style of doing certain things. Some models are absolutely adamant on including preachy disclaimers or ensuring that every story has a happy ending. Prompting around that is possible, but it can be tough and eats into your reliability.


dealing with nr 1 is fairly straight forward: you need to critically examine your prompt and think if there is any verbiage that allows you to express yourself without negation. Is there a name for a cold pitch without a CTA? I don’t know, but if it’s a well known tactic that has a name, use that.

Prompt engineering for GPT-3/4 is an additive manufacturing process, not a subtractive one.

If you can’t overcome your issues with nr1 and are certain that you have a nr2 issue, there’s ways around that too but it might involve using a schema and parsing your output. We have a thread about it here: How to stop models returning "preachy" conclusions. But I’d suggest working on nr1 before resorting to this stuff.

Let us know how it works out!