ChatMessage

@Serializable
data class ChatMessage(val role: ChatRole, val messageContent: Content? = null, val name: String? = null, val functionCall: FunctionCall? = null, val toolCalls: List<ToolCall>? = null, val toolCallId: ToolId? = null)

The messages to generate chat completions for.

Constructors

Link copied to clipboard
constructor(role: ChatRole, content: String? = null, name: String? = null, functionCall: FunctionCall? = null, toolCalls: List<ToolCall>? = null, toolCallId: ToolId? = null)
constructor(role: ChatRole, content: List<ContentPart>? = null, name: String? = null, functionCall: FunctionCall? = null, toolCalls: List<ToolCall>? = null, toolCallId: ToolId? = null)
constructor(role: ChatRole, messageContent: Content? = null, name: String? = null, functionCall: FunctionCall? = null, toolCalls: List<ToolCall>? = null, toolCallId: ToolId? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

The name and arguments of a function that should be called, as generated by the model.

Link copied to clipboard
val messageContent: Content? = null

The contents of the message. This is required for requests, and optional for responses.

Link copied to clipboard
val name: String? = null

The author's name of this message. name is required if the role is `ChatRole.Function, and it should be the name of the function whose response is in the content. It May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.

Link copied to clipboard

The role of the author of this message.

Link copied to clipboard
val toolCallId: ToolId? = null

Tool call ID.

Link copied to clipboard
val toolCalls: List<ToolCall>? = null

The tool calls generated by the model, such as function calls.