Message

@Serializable
data class Message(val id: MessageId, val createdAt: Int, val threadId: ThreadId, val role: Role, val content: List<MessageContent>, val assistantId: AssistantId? = null, val runId: RunId? = null, val metadata: Map<String, String>)

Represents a message within a thread.

Constructors

Link copied to clipboard
constructor(id: MessageId, createdAt: Int, threadId: ThreadId, role: Role, content: List<MessageContent>, assistantId: AssistantId? = null, runId: RunId? = null, metadata: Map<String, String>)

Properties

Link copied to clipboard
@SerialName(value = "assistant_id")
val assistantId: AssistantId? = null

If applicable, the ID of the assistant that authored this message. Can be null.

Link copied to clipboard
@SerialName(value = "content")
val content: List<MessageContent>

The content of the message in an array of text and/or images.

Link copied to clipboard
@SerialName(value = "created_at")
val createdAt: Int

The Unix timestamp (in seconds) for when the message was created.

Link copied to clipboard
@SerialName(value = "id")
val id: MessageId

The identifier, which can be referenced in API endpoints.

Link copied to clipboard
@SerialName(value = "metadata")
val metadata: Map<String, String>

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long, and values can be a maximum of 512 characters long.

Link copied to clipboard
@SerialName(value = "role")
val role: Role

The entity that produced the message. One of user or assistant.

Link copied to clipboard
@SerialName(value = "run_id")
val runId: RunId? = null

If applicable, the ID of the run associated with the authoring of this message. Can be null.

Link copied to clipboard
@SerialName(value = "thread_id")
val threadId: ThreadId

The thread ID that this message belongs to.