Chat Roles & Messages

Open the developer console while chatting with an AI app and you won't see a paragraph being sent. You'll see a list, a few labeled boxes, each tagged with who said it. That list is the request. Once you see chat as a list of messages instead of a stream of te

8 lessons, each with runnable code in the browser.

  1. The Message List
  2. System Prompts: Setting Behavior
  3. Multi-Turn Conversations
  4. Building the Message Array
  5. The Assistant Turn and Prefilling
  6. Roles Beyond the Basics
  7. Injecting Context Into Messages
  8. Common Message-List Bugs

Compilearn home