Skip to content
Prompty

Message

A message in a conversation. Messages have a role and a list of content parts representing the different modalities of the message content.

---
title: Message
config:
  look: handDrawn
  theme: colorful
  class:
    hideEmptyMembersBox: true
---
classDiagram
    class Message {
        +string role
        +ContentPart[] parts
        +dictionary metadata
    }
    class ContentPart {
      <<abstract>>
        +string kind
    }
    Message *-- ContentPart
role: user
parts:
- kind: text
value: Hello!
metadata:
source: user-input
Name Type Description
role string The role of the message sender
parts ContentPart[] The content parts of the message(Related Types: TextPart, ImagePart, FilePart, AudioPart)
metadata dictionary Optional metadata associated with the message. Values may be explicit null.

The following factory methods are declared via @factory and are generated automatically by the emitter in every language.

  • assistant(text: string)
  • system(text: string)
  • user(text: string)

The following types are composed within Message: