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 enum
ImageContent.DetailLevel
The 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 Image
image()
Get the Image
.ImageContent.DetailLevel
detailLevel()
Get the DetailLevel
.ContentType
type()
Returns the type of content. boolean
equals(Object o)
int
hashCode()
String
toString()
static ImageContent
from(URI url)
Create a new ImageContent from the given url. static ImageContent
from(String url)
Create a new ImageContent from the given url. static ImageContent
from(URI url, ImageContent.DetailLevel detailLevel)
Create a new ImageContent from the given url and detail level. static ImageContent
from(String url, ImageContent.DetailLevel detailLevel)
Create a new ImageContent from the given url and detail level. static ImageContent
from(String base64Data, String mimeType)
Create a new ImageContent from the given base64 data and mime type. static ImageContent
from(String base64Data, String mimeType, ImageContent.DetailLevel detailLevel)
Create a new ImageContent from the given base64 data and mime type. static ImageContent
from(Image image)
Create a new ImageContent from the given image. static ImageContent
from(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.LOW
detail.- 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.LOW
detail.- 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.LOW
detail.- 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.LOW
detail.- 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.
-
-
-
-