Message
A message in a conversation. Messages have a role and a list of content parts representing the different modalities of the message content.
Class Diagram
Section titled “Class Diagram”---
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
Yaml Example
Section titled “Yaml Example”role: userparts: - kind: text value: Hello!metadata: source: user-inputProperties
Section titled “Properties”| 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. |
Factory Methods
Section titled “Factory Methods”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)
Composed Types
Section titled “Composed Types”The following types are composed within Message: