Attachments.to_chat_contents()

Convert attachments to chatlas-compatible content list.

Usage

Source

Attachments.to_chat_contents()

This method processes all attached files and converts them into the appropriate chatlas content objects. Images become ContentImageInline objects, PDFs become ContentPDF objects, and text files are combined into the prompt text.

Returns

List[Any]
List containing text prompt and Content objects ready to pass directly to chatlas Chat.chat() method.

Examples

import talk_box as tb

files = tb.Attachments("image.png", "doc.pdf").with_prompt("Analyze these")
contents = files.to_chat_contents()
# Result: ["Analyze these", ContentImageInline(...), ContentPDF(...)]