Package com.azure.ai.inference.models
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 Summary
ConstructorsConstructorDescriptionImageEmbeddingInput
(String image) Creates an instance of ImageEmbeddingInput class.ImageEmbeddingInput
(Path filePath, String imageFormatType) Creates an instance of ImageEmbeddingInput class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ImageEmbeddingInput
fromJson
(com.azure.json.JsonReader jsonReader) Reads an instance of ImageEmbeddingInput from the JsonReader.getImage()
Get the image property: The input image encoded in base64 string as a data URL.getText()
Get the text property: Optional.Set the text property: Optional.com.azure.json.JsonWriter
toJson
(com.azure.json.JsonWriter jsonWriter) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.azure.json.JsonSerializable
toJson, toJson, toJsonBytes, toJsonString
-
Constructor Details
-
ImageEmbeddingInput
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
Creates an instance of ImageEmbeddingInput class.- Parameters:
image
- the image value to set.
-
-
Method Details
-
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
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
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
- Specified by:
toJson
in interfacecom.azure.json.JsonSerializable<ImageEmbeddingInput>
- Throws:
IOException
-
fromJson
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.
-