package llm // Part is one piece of message content: text, an image, or future media // kinds. The set of implementations is closed (sealed by the unexported // method) so providers can switch exhaustively over content kinds. // // Why: providers need a finite, known content vocabulary to serialize into // their wire formats; an open interface would silently drop unknown content. type Part interface { isPart() } // TextPart is plain text content. type TextPart struct { Text string } func (TextPart) isPart() {} // ImagePart is image content carried as raw bytes plus a MIME type. // // Why bytes-only (no URL form): the media pipeline must be able to inspect, // downscale, and re-encode every image to fit the target's capabilities, and // that requires the bytes. Callers with a URL fetch it themselves; majordomo // does not download remote content on a caller's behalf. type ImagePart struct { // MIME is the image content type, e.g. "image/png" or "image/jpeg". MIME string // Data is the raw, unencoded image bytes (providers base64 as needed). Data []byte } func (ImagePart) isPart() {} // Text constructs a text content part. func Text(s string) Part { return TextPart{Text: s} } // Image constructs an image content part from raw bytes. func Image(mime string, data []byte) Part { return ImagePart{MIME: mime, Data: data} }