System

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

A system-role message used to set the behaviour or persona of the assistant. Only MessagePart.Text parts are supported.

Constructors

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

Convenience constructor that wraps a single MessagePart.Text 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.Text>

The text parts that make up the system prompt.

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.