User

data class User @JvmOverloads constructor(val parts: List<MessagePart.RequestPart>, val metaInfo: RequestMetaInfo, val id: String? = null) : Message(source)

A user-role message sent to the LLM. May contain text, attachments, or tool results.

Constructors

Link copied to clipboard
constructor(parts: List<MessagePart.RequestPart>, metaInfo: RequestMetaInfo, id: String? = null)
constructor(part: MessagePart.RequestPart, metaInfo: RequestMetaInfo, id: String? = null)

Convenience constructor that wraps a single MessagePart.RequestPart in a list.

constructor(content: String, metaInfo: RequestMetaInfo, cache: CacheControl? = null, id: String? = null)

Convenience constructor that creates a MessagePart.Text from a raw string.

Properties

Link copied to clipboard
open override val id: String?

Optional unique identifier for the message.

Link copied to clipboard
open override val metaInfo: RequestMetaInfo

Request metadata such as timestamp.

Link copied to clipboard
open override val parts: List<MessagePart.RequestPart>

The request parts (text, attachments, or tool results) of the message.

Link copied to clipboard
open override val role: Message.Role

The role associated with the message.

Functions

Link copied to clipboard
open fun textContent(): String

Extracts and concatenates the textual content from all MessagePart.Text elements in the message. Messages are joined by a newline character ("\n").

open fun textContent(separator: String): String

Extracts and concatenates the textual content from all MessagePart.Text elements in the message.