A message typically consists of the following pieces of information:
| Role | Description |
|---|---|
| system | Used to tell the chat model how to behave and provide additional context. Not supported by all chat model providers. |
| user | Represents input from a user interacting with the model, usually in the form of text or other interactive input. |
| assistant | Represents a response from the model, which can include text or a request to invoke tools. |
| tool | A message used to pass the results of a tool invocation back to the model after external data or processing has been retrieved. Used with chat models that support tool calling. |
| function (legacy) | This is a legacy role, corresponding to OpenAI's legacy function-calling API. tool role should be used instead. |
Content: The content of a message text or a list of dictionaries representing multimodal data (e.g., images, audio, video).
Other message data:
Depending on the chat model provider, messages can include other data such as:
name property which allows differentiate between different entities/speakers with the same role. Not all models support this!