LlmMessage

@Serializable
data class LlmMessage(val role: MessageRole = MessageRole.User, val content: String? = null, val contentParts: List<MessageContent>? = null, val toolCalls: List<LlmToolCall>? = null)

A message in an LLM conversation. Accumulates during a chat session.

Use the companion factories (system, user, assistant, tool) for the common shapes; construct directly for advanced cases.

Constructors

Link copied to clipboard
constructor(role: MessageRole = MessageRole.User, content: String? = null, contentParts: List<MessageContent>? = null, toolCalls: List<LlmToolCall>? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Plain text content, when the message is a single text part.

Link copied to clipboard

Rich content parts (text + images), when present.

Link copied to clipboard

Speaker role.

Link copied to clipboard

Tool-call requests issued by an assistant message, or the call to which a tool message is responding.

Functions

Link copied to clipboard

Plain message text for provider roles that accept text only.