Impact of role "system" in chat completion API

Is there a significant difference in using system prompts versus including instructions in the user message when working with GPT-4 for a chatbot? I’ve tried both approaches:

  1. Using instructions in the system role:
messages=[
  {"role": "system", "content": "<instructions>"},
  {"role": "user", "content": "<User query>"},
  {"role": "assistant", "content": "<response>"},
]
  1. Including instructions in the user message:
messages=[
  {"role": "user", "content": "<instructions><User query>"},
  {"role": "assistant", "content": "<response>"},
]

I haven’t noticed any significant differences in the responses when testing these approaches. Are there any practical implications or advantages to using the system prompt (approach 1) over including instructions in the user message?"

This formulation maintains the core of your question while providing clear context about the two approaches you’ve tried. It also emphasizes your main point of inquiry regarding any real differences or advantages in using the system prompt approach.

just to f*** you up more, this also works.

  conversation.forEach((msg) => {
    if (msg.role === "user") {
      message += `User: ${msg.message}\n`;
    } else if (msg.role === "assistant") {
      message += `${msg.message.replace("HelloGPT: ", "")}\n`; 
    }
  });
  const response = await openai.chat.completions.create({
    model: "gpt-4o-mini",
    messages: [
      {
        role: "system",
        content: message,
      },
    ],