Message

data class Message(val role: ChatCompletionRole, val content: MessageContent, val refusal: String? = null, val toolCalls: List<ToolCall>? = null)(source)

Represents a message in a chat completion.

According to the OpenAI specification, the content field can be either:

  • A string for simple text messages

  • An array of content parts for multimodal messages (text, images, audio, etc.)

See also

Constructors

Link copied to clipboard
constructor(role: ChatCompletionRole, content: MessageContent, refusal: String? = null, toolCalls: List<ToolCall>? = null)

Properties

Link copied to clipboard

The content of the message as either a string or array of content parts.

Link copied to clipboard

The refusal message if the model refused to generate a response.

Link copied to clipboard

The role of the message author (system, user, assistant, or tool).

Link copied to clipboard
@SerialName(value = "tool_calls")
val toolCalls: List<ToolCall>?

The tool calls generated by the model.