Companion

object Companion

Properties

Link copied to clipboard
const val SUPPORTED_VERSION: Int = 1

The newest format version of the built-in kinds this SDK understands.

Link copied to clipboard
const val TYPE_PREFIX: String

The attachment type prefix every AI step uses.

Functions

Link copied to clipboard
fun from(type: String, payload: Map<String, Any?>, position: Int = 0): AIMessagePart?

Decodes one attachment, or returns null when it is not an AI step.

Link copied to clipboard
fun fromJson(type: String, json: String, position: Int = 0): AIMessagePart?

Decodes one attachment from its payload as JSON text, or returns null when it is not an AI step. A payload that is not a JSON object reads as empty.

Link copied to clipboard
fun parts(attachments: List<Pair<String, Map<String, Any?>>>): List<AIMessagePart>

Decodes the AI steps among a message's attachments, in order. Attachments that are not AI steps (images, files and so on) are skipped.

Link copied to clipboard

Decodes the AI steps among a message's attachments, with each payload as JSON text, in order. Attachments that are not AI steps are skipped, and a payload that is not a JSON object reads as empty.