MessageBuilder

DSL for building a conversation history.

Appends messages to an internal list in call order. Each helper adds the matching concrete ChatMessage subtype.

Example:

client.chat {
system("You are a Kotlin expert")
user("What are coroutines?")
}

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun assistant(content: String)

Appends an AssistantMessage with the given content.

Link copied to clipboard
fun system(content: String)

Appends a SystemMessage with the given content.

Link copied to clipboard
fun tool(content: String, toolCallId: String)

Appends a ToolMessage carrying the result of executing a prior ToolCall.

Link copied to clipboard
fun user(content: String)

Appends a UserMessage with the given content.