AssistantMessage

@Serializable
@SerialName(value = "assistant")
class AssistantMessage(val content: String?, val name: String? = null, val prefix: Boolean? = null, val reasoningContent: String? = null, val toolCalls: List<ToolCall>? = null) : ChatMessage

Assistant-role message — a model response, whether produced by the API or replayed as context.

The same class travels in both directions, which is what makes the tool-calling loop a plain list append: take the message off a ChatChoice and put it straight back into the next request.

val first = client.chat(params, messages)
val call = first.choices.single().message.toolCalls?.single()
val next = messages +
first.choices.single().message +
ToolMessage(runTool(call), call.id)

Constructors

Link copied to clipboard
constructor(content: String?, name: String? = null, prefix: Boolean? = null, reasoningContent: String? = null, toolCalls: List<ToolCall>? = null)

Properties

Link copied to clipboard

Assistant message text; null when the message only carries toolCalls.

Link copied to clipboard
val name: String?

Optional participant name forwarded to the model.

Link copied to clipboard

When true, marks this message as a partial assistant response that the model should continue generating from. Prefix completion is only served from the beta base path: a request ending in such a message is routed to beta/chat/completions automatically, so the client needs no extra configuration.

Link copied to clipboard

Chain-of-thought that precedes content in thinking mode. On a response it is what the model thought; on a request it seeds the continuation, and so takes effect only alongside prefix = true.

Link copied to clipboard

Tool calls the model emitted on this turn, or null if none. Answer each one with a ToolMessage carrying the matching ToolCall.id.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String