SamplingMessage
data class SamplingMessage(val role: Role, val content: List<SamplingMessageContent>, val meta: JsonObject? = null)(source)
Describes a message issued to or received from an LLM API.
Used in sampling requests to provide conversation context and history to the LLM.
Under SEP-1577, content is a list of SamplingMessageContent blocks rather than a single block. On the wire, a list of size 1 is serialised as a single object (wire-compatible with pre-SEP single-block content); a list of size 2+ is serialised as a JSON array.
Constructors
Link copied to clipboard
Convenience constructor for a single-block message. Wraps content in a singleton list so call sites can write SamplingMessage(Role.User, TextContent("hi")) without the explicit listOf(...).