Class ImageEmbeddingInput

java.lang.Object
com.azure.ai.inference.models.ImageEmbeddingInput
All Implemented Interfaces:
com.azure.json.JsonSerializable<ImageEmbeddingInput>

public final class ImageEmbeddingInput extends Object implements com.azure.json.JsonSerializable<ImageEmbeddingInput>
Represents an image with optional text.
  • Constructor Details

    • ImageEmbeddingInput

      public ImageEmbeddingInput(Path filePath, String imageFormatType)
      Creates an instance of ImageEmbeddingInput class.
      Parameters:
      filePath - path to the imageFile.
      imageFormatType - format of the image
      Throws:
      RuntimeException - If an error occurs while reading the file or file not found.
    • ImageEmbeddingInput

      public ImageEmbeddingInput(String image)
      Creates an instance of ImageEmbeddingInput class.
      Parameters:
      image - the image value to set.
  • Method Details

    • getImage

      public String getImage()
      Get the image property: The input image encoded in base64 string as a data URL. Example: `data:image/{format};base64,{data}`.
      Returns:
      the image value.
    • getText

      public String getText()
      Get the text property: Optional. The text input to feed into the model (like DINO, CLIP). Returns a 422 error if the model doesn't support the value or parameter.
      Returns:
      the text value.
    • setText

      public ImageEmbeddingInput setText(String text)
      Set the text property: Optional. The text input to feed into the model (like DINO, CLIP). Returns a 422 error if the model doesn't support the value or parameter.
      Parameters:
      text - the text value to set.
      Returns:
      the ImageEmbeddingInput object itself.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<ImageEmbeddingInput>
      Throws:
      IOException
    • fromJson

      public static ImageEmbeddingInput fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of ImageEmbeddingInput from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of ImageEmbeddingInput if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
      Throws:
      IllegalStateException - If the deserialized JSON object was missing any required properties.
      IOException - If an error occurs while reading the ImageEmbeddingInput.