Text

@SerialName(value = "text")
@Serializable
data class Text(val text: String) : Content, Content.Request, Content.Response, Content.StreamResponse

Plain text content.

Implements Request, Response, and StreamResponse, making it usable in all contexts.

Samples

// Create a message with text content.
val message = Message(
    role = Role.User,
    content = Content.Text("Hello, how are you?")
)
when (content) { // Content is Content.StreamResponse!
    is Content.Text -> println("Text chunk: ${content.text}")
    is Content.Reasoning -> println("Reasoning chunk: ${content.value}")
    is Content.ToolCallDelta -> println("Tool call delta ${content.name}, ${content.argumentsChunk}")
}

Constructors

Link copied to clipboard
constructor(text: String)

Properties

Link copied to clipboard

The text content.

Functions

Link copied to clipboard

Wraps this request content as an assistant Message.

Link copied to clipboard

Attempts to cast this response content to a request-compatible content type.