ContentPart

sealed interface ContentPart(source)

Represents a part of a message. Parts can be text ContentPart.Text, images ContentPart.Image, audio ContentPart.Audio, or files ContentPart.File. All attachment parts (all except ContentPart.Text) must implement Attachment interface.

Inheritors

Types

Link copied to clipboard

Represents different types of content that can be attached to messages. Check nested implementation classes for supported formats and details.

Link copied to clipboard
data class Audio(val content: AttachmentContent, val format: String, val mimeType: String = "audio/", val fileName: String? = null) : ContentPart.Attachment

Audio attachment (mp3, wav, etc.).

Link copied to clipboard
data class File(val content: AttachmentContent, val format: String, val mimeType: String, val fileName: String? = null) : ContentPart.Attachment

Other types of file attachments. E.g. pdf, md, txt.

Link copied to clipboard
data class Image(val content: AttachmentContent, val format: String, val mimeType: String = "image/", val fileName: String? = null) : ContentPart.Attachment

Image attachment (jpg, png, gif, etc.).

Link copied to clipboard
@SerialName(value = "text")
data class Text(val text: String) : ContentPart

Text content part in the OpenAI chat completion API.

Link copied to clipboard
data class Video(val content: AttachmentContent, val format: String, val mimeType: String = "video/", val fileName: String? = null) : ContentPart.Attachment

Video attachment (mp4, avi, etc.).