MessageBuilder

Builder class for creating Message instances.

This builder provides a fluent API for creating Message objects, making it easier to construct complex messages with many parameters.

Example usage:

val message = Message.create {
role = Message.Role.user
textPart("Hello, how can I help you?")
filePart {
name = "document.pdf"
mimeType = "application/pdf"
data = fileBytes
}
}

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Adds a part to the message.

Link copied to clipboard
fun build(): Message

Builds a Message instance with the configured parameters.

Link copied to clipboard
fun data(block: () -> Map<String, Any>): DataPart
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Sets the role of the message.

Link copied to clipboard
fun text(block: () -> String): TextPart
Link copied to clipboard