Attachments

LLM Integration

How attachments become multimodal parts for provider requests

Part Mapping

Attachments that resolve successfully are converted to provider‑agnostic parts:

AttachmentResolutionLLM PartNotes
imageURLImageURLPartSent as a URL reference (no binary payload)
imagePathBinaryPartRead and included as binary (image/*)
audio, videoURL or PathBinaryPartRemote URLs are downloaded to temp under limits; MIME must match allow‑list
pdfURL or PathTextPart or BinaryPartTries text extraction up to a configured limit; falls back to binary
filePathTextPart or BinaryParttext/* files are loaded as text (bounded); others as binary
urlURLValidated but not included as a part in this phase

Choosing URL vs Path

  • 1
    URL for images

    When supported by the provider, image URLs are cheaper and faster than uploading bytes.

  • 2
    Path for reliability

    Local paths embed the bytes, ensuring the prompt remains self‑contained regardless of external availability.

  • 3
    Large media

    Ensure global limits are sized appropriately to avoid truncation; otherwise prefer URLs when possible.

Prompt Assembly

Attachments are passed alongside the user content. Adapters must avoid duplicating text content when parts are present.

User message → { content: "...", parts: [ImageURLPart | BinaryPart | TextPart, ...] }

Cross‑References