Skip to the workspace
Pebellslearn by building
Working with Model APIs  ›  Lesson

System Prompts and Message Roles

System Prompting 12 minA chat request is a list of messages with roles, where the system prompt sets the model's job, rules and output format and the user messages carry each request.

ai engineer / System Prompts and Message Roles

Explore each scene at your own pace.

01 · The rule

The rule

System Prompts and Message Roles

The Pedal Point assistant answers a question about a competitor's e-bikes, writes a limerick when asked, and replies in long paragraphs on a phone screen. None of that is a model failure. Nobody told it what its job was. That is what the system prompt is for.

The rule

The system prompt sets the job; user messages bring the requests.

Chat models take a list of messages, each with a role:

  • system: standing instructions from you, the developer. Who the assistant is, what it may and may not do, how to answer.
  • user: what the customer typed.
  • assistant: the model's earlier replies, resent so it can follow the conversation.
[
  {"role": "system", "content": "You are Pedal Point's support assistant..."},
  {"role": "user", "content": "Can I return a helmet?"},
  {"role": "assistant", "content": "Yes, if it is still sealed..."},
  {"role": "user", "content": "What if I opened it?"}
]

This is the input format. The exact shape varies by provider (some take the system prompt as a separate field), but the idea is the same everywhere.

A good system prompt covers three things:

  • Role and behaviour. Who the assistant is and the tone it uses.
  • Constraints. What is in and out of scope, what it must never do, and what to do when unsure.
  • Format. Length, structure, language.

Be specific. "Be helpful" changes nothing. "If the reference text does not answer the question, say so and offer a human" changes behaviour.

A few more habits help. Put the most important rule where it cannot be missed. Give a reason for unusual rules ("never promise refunds, because only staff can approve them"), since models follow rules better when they understand them. Keep the prompt short enough to read in one go: every word is resent on every call.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.