Data

@SerialName(value = "data")
class Data(val type: String, val data: JsonElement, val providerMetadata: ProviderMetadata = ProviderMetadata.None, val id: String? = null, val transient: Boolean = false) : UIMessagePart(source)

Typed custom data part. Mirrors v6 data-* UI parts while using an explicit type string instead of TypeScript literal keys.

Since

0.3.0-beta01

Constructors

Link copied to clipboard
constructor(type: String, data: JsonElement, providerMetadata: ProviderMetadata = ProviderMetadata.None, id: String? = null, transient: Boolean = false)

Properties

Link copied to clipboard
Link copied to clipboard
val id: String?

Optional stable id. Streaming data parts that share an id replace the prior one in place (e.g. a progress indicator that updates) rather than appending a duplicate — matching v6's keyed data parts.

Link copied to clipboard

Transient parts are shown live but not meant to be persisted in stored message history. Mirrors v6's transient data-chunk flag.

Link copied to clipboard

Functions

Link copied to clipboard
inline fun <TData> dataAs(): TData
fun <TData> dataAs(serializer: KSerializer<TData>): TData