CreateMessageResult

data class CreateMessageResult(val role: Role, val content: MediaContent, val model: String, val stopReason: StopReason? = null, val meta: JsonObject? = null) : ClientResult(source)

The client's response to a CreateMessageRequest from the server.

The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.

Constructors

Link copied to clipboard
constructor(role: Role, content: MediaContent, model: String, stopReason: StopReason? = null, meta: JsonObject? = null)

Properties

Link copied to clipboard
open val _meta: JsonObject
Link copied to clipboard

The generated content. Can be text, image, or audio content.

Link copied to clipboard
@SerialName(value = "_meta")
open override val meta: JsonObject?

Optional metadata for this response.

Link copied to clipboard

The name of the model that generated the message (e.g., "claude-3-opus-20240229", "gpt-4-turbo-preview"). This helps the server understand which model was used.

Link copied to clipboard
val role: Role

The role of the message sender. Typically Role.Assistant for LLM-generated responses.

Link copied to clipboard

The reason why sampling stopped, if known. Common values: "end_turn", "max_tokens", "stop_sequence", "content_filter"