liveBook · Manning

Aria semantics

As explained in Data Analysis with LLMs

A role attribute identifies the source type of a chat message, such as user, assistant, or system.

A chat message’s role identifies its source, while its content holds the message itself. Together, these fields describe messages in the chat history sent to chat completion. section 3.4

The role values identify who or what supplied a message:

  • user marks a message written by the user. section 3.4
  • assistant marks a message generated by the language model. section 3.4
  • system marks a message for general guidance, typically placed at the beginning of the chat history. section 3.4
[{
    'role':'user',  #1
    'content':'Tell me a story!'  #2
}]

This example shows a user message represented as a dictionary with separate role and content values. section 3.4

How Data Analysis with LLMs covers it

How deep it goes
Defines user, assistant, and system roles, explains system guidance, and does not demonstrate system messages in use.
Examples
Shows a user asking for a story and gives system guidance examples such as “You are a helpful assistant.”
What it assumes
Assumes familiarity with chats as alternating user and model messages, while defining the role and content fields.
What you can do after
Build a Python chat message by assigning it a role and content.
How it connects
Connects message roles to chat history and chat completion.

Also explained in

Compare how 4 books explain aria semantics →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data Analysis with LLMs. The section links point to the parts of the book it draws on.