ContentPartsBuilder
A builder for constructing parts for prompt messages. All parts are added to a list in declaration order and can be retrieved through the build method.
Example usage:
val parts = ContentPartsBuilder().apply {
text("Hello!")
image("screenshot.png")
binaryFile("report.pdf")
}.build()See also
Functions
Configures media attachments for this content builder.
Adds ContentPart.Audio to the list of parts.
Adds ContentPart.Audio with AttachmentContent.URL content from the provided URL.
Adds ContentPart.Audio with AttachmentContent.Binary.Bytes content from the provided local file path.
Adds ContentPart.File with AttachmentContent.Binary.Bytes content from the provided local file path.
Constructs and returns the accumulated list of attachment items.
Adds ContentPart.File to the list of parts.
Adds ContentPart.File with AttachmentContent.URL content from the provided URL.
Adds ContentPart.Image to the list of parts.
Adds ContentPart.Image with AttachmentContent.URL content from the provided URL.
Adds ContentPart.Image with AttachmentContent.Binary.Bytes content from the provided local file path.
Extension function for TextContentBuilder that adds line numbering to the content.
Adds padding to each line of the content produced by the provided builder block.
Adds ContentPart to the list of parts.
Adds ContentPart.Text to the list of parts.
Appends the given text to the current content.
Extension function to add text content to a TextContentBuilder.
Adds ContentPart.File with AttachmentContent.PlainText content from the provided local file path.
Adds the given text to the content. If the caret is not at the beginning of the line, a newline is added before appending the text.
Adds the given string as a new line of text to the content being built by the TextContentBuilder.
Adds ContentPart.Video to the list of parts.
Adds ContentPart.Video with AttachmentContent.URL content from the provided URL.
Adds ContentPart.Video with AttachmentContent.Binary.Bytes content from the provided local file path.