Assistant Message
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
Properties
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.
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.
Tool calls the model emitted on this turn, or null if none. Answer each one with a ToolMessage carrying the matching ToolCall.id.