fromJson

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.

Parameters

type

The attachment type.

json

The attachment payload as JSON text.

position

The attachment's index, used as the identity of a step that carries no ID of its own.