Class ImageContent
-
- All Implemented Interfaces:
-
dev.langchain4j.data.message.Content
public class ImageContent implements Content
Represents an image with a DetailLevel.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumImageContent.DetailLevelThe detail level of an
Image.
-
Constructor Summary
Constructors Constructor Description ImageContent(URI url)Create a new ImageContent from the given url. ImageContent(String url)Create a new ImageContent from the given url. ImageContent(URI url, ImageContent.DetailLevel detailLevel)Create a new ImageContent from the given url and detail level. ImageContent(String url, ImageContent.DetailLevel detailLevel)Create a new ImageContent from the given url and detail level. ImageContent(String base64Data, String mimeType)Create a new ImageContent from the given base64 data and mime type. ImageContent(String base64Data, String mimeType, ImageContent.DetailLevel detailLevel)Create a new ImageContent from the given base64 data and mime type. ImageContent(Image image)Create a new ImageContent from the given image. ImageContent(Image image, ImageContent.DetailLevel detailLevel)Create a new ImageContent from the given image.
-
Method Summary
Modifier and Type Method Description Imageimage()Get the Image.ImageContent.DetailLeveldetailLevel()Get the DetailLevel.ContentTypetype()Returns the type of content. booleanequals(Object o)inthashCode()StringtoString()static ImageContentfrom(URI url)Create a new ImageContent from the given url. static ImageContentfrom(String url)Create a new ImageContent from the given url. static ImageContentfrom(URI url, ImageContent.DetailLevel detailLevel)Create a new ImageContent from the given url and detail level. static ImageContentfrom(String url, ImageContent.DetailLevel detailLevel)Create a new ImageContent from the given url and detail level. static ImageContentfrom(String base64Data, String mimeType)Create a new ImageContent from the given base64 data and mime type. static ImageContentfrom(String base64Data, String mimeType, ImageContent.DetailLevel detailLevel)Create a new ImageContent from the given base64 data and mime type. static ImageContentfrom(Image image)Create a new ImageContent from the given image. static ImageContentfrom(Image image, ImageContent.DetailLevel detailLevel)Create a new ImageContent from the given image. -
-
Constructor Detail
-
ImageContent
ImageContent(URI url)
Create a new ImageContent from the given url.- Parameters:
url- the url of the image.
-
ImageContent
ImageContent(String url)
Create a new ImageContent from the given url.- Parameters:
url- the url of the image.
-
ImageContent
ImageContent(URI url, ImageContent.DetailLevel detailLevel)
Create a new ImageContent from the given url and detail level.- Parameters:
url- the url of the image.detailLevel- the detail level of the image.
-
ImageContent
ImageContent(String url, ImageContent.DetailLevel detailLevel)
Create a new ImageContent from the given url and detail level.- Parameters:
url- the url of the image.detailLevel- the detail level of the image.
-
ImageContent
ImageContent(String base64Data, String mimeType)
Create a new ImageContent from the given base64 data and mime type.- Parameters:
base64Data- the base64 data of the image.mimeType- the mime type of the image.
-
ImageContent
ImageContent(String base64Data, String mimeType, ImageContent.DetailLevel detailLevel)
Create a new ImageContent from the given base64 data and mime type.- Parameters:
base64Data- the base64 data of the image.mimeType- the mime type of the image.detailLevel- the detail level of the image.
-
ImageContent
ImageContent(Image image)
Create a new ImageContent from the given image.- Parameters:
image- the image.
-
ImageContent
ImageContent(Image image, ImageContent.DetailLevel detailLevel)
Create a new ImageContent from the given image.- Parameters:
image- the image.detailLevel- the detail level of the image.
-
-
Method Detail
-
detailLevel
ImageContent.DetailLevel detailLevel()
Get the
DetailLevel.- Returns:
the
DetailLevel.
-
type
ContentType type()
Returns the type of content.
Can be used to cast the content to the correct type.
- Returns:
The type of content.
-
hashCode
int hashCode()
-
from
static ImageContent from(URI url)
Create a new ImageContent from the given url.
The image will be created with
DetailLevel.LOWdetail.- Parameters:
url- the url of the image.- Returns:
the new ImageContent.
-
from
static ImageContent from(String url)
Create a new ImageContent from the given url.
The image will be created with
DetailLevel.LOWdetail.- Parameters:
url- the url of the image.- Returns:
the new ImageContent.
-
from
static ImageContent from(URI url, ImageContent.DetailLevel detailLevel)
Create a new ImageContent from the given url and detail level.
- Parameters:
url- the url of the image.detailLevel- the detail level of the image.- Returns:
the new ImageContent.
-
from
static ImageContent from(String url, ImageContent.DetailLevel detailLevel)
Create a new ImageContent from the given url and detail level.
- Parameters:
url- the url of the image.detailLevel- the detail level of the image.- Returns:
the new ImageContent.
-
from
static ImageContent from(String base64Data, String mimeType)
Create a new ImageContent from the given base64 data and mime type.
The image will be created with
DetailLevel.LOWdetail.- Parameters:
base64Data- the base64 data of the image.mimeType- the mime type of the image.- Returns:
the new ImageContent.
-
from
static ImageContent from(String base64Data, String mimeType, ImageContent.DetailLevel detailLevel)
Create a new ImageContent from the given base64 data and mime type.
- Parameters:
base64Data- the base64 data of the image.mimeType- the mime type of the image.detailLevel- the detail level of the image.- Returns:
the new ImageContent.
-
from
static ImageContent from(Image image)
Create a new ImageContent from the given image.
The image will be created with
DetailLevel.LOWdetail.- Parameters:
image- the image.- Returns:
the new ImageContent.
-
from
static ImageContent from(Image image, ImageContent.DetailLevel detailLevel)
Create a new ImageContent from the given image.
- Parameters:
image- the image.detailLevel- the detail level of the image.- Returns:
the new ImageContent.
-
-
-
-