Class ImagePart


public final class ImagePart extends MessagePart
An image attachment for a multi-modal ChatMessage. Construct from raw bytes (the provider encodes them as base64 inline data) or from a publicly-reachable URL -- both modes are accepted by OpenAI, Anthropic, and Gemini.
  • Constructor Details

    • ImagePart

      public ImagePart(byte[] data, String mimeType)
      Inline image bytes. mimeType must be set (e.g. "image/png", "image/jpeg"); the providers reject inline images without it.
    • ImagePart

      public ImagePart(String url)
      Remote image by URL. Only HTTPS is portable across providers.
  • Method Details

    • getData

      public byte[] getData()
    • getMimeType

      public String getMimeType()
    • getUrl

      public String getUrl()
    • isUrl

      public boolean isUrl()