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 fileIds: List<FileId>, 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, fileIds: List<FileId>, metadata: Map<String, String>)

Properties

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can access files. A maximum of 10 files can be attached to a message.

Link copied to clipboard

The identifier, which can be referenced in API endpoints.

Link copied to clipboard

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
val role: Role

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

Link copied to clipboard
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

The thread ID that this message belongs to.