Assistant

data class Assistant(val parts: List<ContentPart>, val metaInfo: ResponseMetaInfo, val finishReason: String? = null) : Message.Response(source)

Represents a message generated by the assistant as a response.

Constructors

Link copied to clipboard
constructor(part: ContentPart, metaInfo: ResponseMetaInfo, finishReason: String? = null)

Single content part assistant message constructor

constructor(content: String, metaInfo: ResponseMetaInfo, finishReason: String? = null)

Text content assistant message constructor

constructor(parts: List<ContentPart>, metaInfo: ResponseMetaInfo, finishReason: String? = null)

Properties

Link copied to clipboard
open val content: String

The textual content of the message aggregated from all ContentPart.Text parts joined to String separated by newlines.

Link copied to clipboard
val finishReason: String? = null

An optional explanation for why the assistant's response was finalized. Defaults to null if not provided.

Link copied to clipboard
open override val metaInfo: ResponseMetaInfo

Metadata related to the response, including token counts and timestamp.

Link copied to clipboard
open override val parts: List<ContentPart>

The parts of the assistant's response.

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

The role associated with the response, which is fixed as Role.Assistant.

Functions

Link copied to clipboard
open override fun copy(updatedMetaInfo: ResponseMetaInfo): Message.Assistant

Creates a copy of the current Response instance with updated metadata.

Link copied to clipboard

Checks weather the message consists of attachments.

Link copied to clipboard

Checks weather the message consists of only sungle text content.

Link copied to clipboard