AttachmentBuilder

A builder for constructing attachments for prompt messages.

Example usage:

val attachments = AttachmentBuilder().apply {
image("screenshot.png")
binaryFile("report.pdf")
}.build()

See also

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun attachment(attachment: Attachment)

Adds Attachment to the list of attachments.

Link copied to clipboard

Adds Attachment.Audio to the list of attachments.

fun audio(url: String)

Adds Attachment.Audio with AttachmentContent.URL content from the provided URL.

fun audio(path: Path)

Adds Attachment.Audio with AttachmentContent.Binary.Bytes content from the provided local file path.

Link copied to clipboard
fun binaryFile(path: Path, mimeType: String)

Adds Attachment.File with AttachmentContent.Binary.Bytes content from the provided local file path.

Link copied to clipboard

Constructs and returns the accumulated list of attachment items.

Link copied to clipboard

Adds Attachment.File to the list of attachments.

fun file(url: String, mimeType: String)

Adds Attachment.File with AttachmentContent.URL content from the provided URL.

Link copied to clipboard

Adds Attachment.Image to the list of attachments.

fun image(url: String)

Adds Attachment.Image with AttachmentContent.URL content from the provided URL.

fun image(path: Path)

Adds Attachment.Image with AttachmentContent.Binary.Bytes content from the provided local file path.

Link copied to clipboard
fun textFile(path: Path, mimeType: String)

Adds Attachment.File with AttachmentContent.PlainText content from the provided local file path.

Link copied to clipboard

Adds Attachment.Video to the list of attachments.

fun video(url: String)

Adds Attachment.Video with AttachmentContent.URL content from the provided URL.

fun video(path: Path)

Adds Attachment.Video with AttachmentContent.Binary.Bytes content from the provided local file path.