ChatMessage

@Serializable
sealed interface ChatMessage

One turn in a chat conversation.

Concrete subtypes — SystemMessage, UserMessage, AssistantMessage, ToolMessage — are distinguished on the wire by the role discriminator.

The MessageBuilder DSL (available via client.chat { ... }) offers shorter syntax for building a list of ChatMessage than instantiating these classes directly.

Inheritors

Properties

Link copied to clipboard
abstract val content: String?

Message text; null is allowed for assistant/user messages that only carry tool calls.