Package dev.langchain4j.data.message
Class ImageContent
java.lang.Object
dev.langchain4j.data.message.ImageContent
- All Implemented Interfaces:
Content
Represents an image with a DetailLevel.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The detail level of anImage
. -
Constructor Summary
ConstructorDescriptionImageContent
(Image image) Create a newImageContent
from the given image.ImageContent
(Image image, ImageContent.DetailLevel detailLevel) Create a newImageContent
from the given image.ImageContent
(String url) Create a newImageContent
from the given url.ImageContent
(String url, ImageContent.DetailLevel detailLevel) Create a newImageContent
from the given url and detail level.ImageContent
(String base64Data, String mimeType) Create a newImageContent
from the given base64 data and mime type.ImageContent
(String base64Data, String mimeType, ImageContent.DetailLevel detailLevel) Create a newImageContent
from the given base64 data and mime type.ImageContent
(URI url) Create a newImageContent
from the given url.ImageContent
(URI url, ImageContent.DetailLevel detailLevel) Create a newImageContent
from the given url and detail level. -
Method Summary
Modifier and TypeMethodDescriptionGet theDetailLevel
.boolean
static ImageContent
Create a newImageContent
from the given image.static ImageContent
from
(Image image, ImageContent.DetailLevel detailLevel) Create a newImageContent
from the given image.static ImageContent
Create a newImageContent
from the given url.static ImageContent
from
(String url, ImageContent.DetailLevel detailLevel) Create a newImageContent
from the given url and detail level.static ImageContent
Create a newImageContent
from the given base64 data and mime type.static ImageContent
from
(String base64Data, String mimeType, ImageContent.DetailLevel detailLevel) Create a newImageContent
from the given base64 data and mime type.static ImageContent
Create a newImageContent
from the given url.static ImageContent
from
(URI url, ImageContent.DetailLevel detailLevel) Create a newImageContent
from the given url and detail level.int
hashCode()
image()
Get theImage
.toString()
type()
Returns the type of content.
-
Constructor Details
-
ImageContent
Create a newImageContent
from the given url.The image will be created with
DetailLevel.LOW
detail.- Parameters:
url
- the url of the image.
-
ImageContent
Create a newImageContent
from the given url.The image will be created with
DetailLevel.LOW
detail.- Parameters:
url
- the url of the image.
-
ImageContent
Create a newImageContent
from the given url and detail level.- Parameters:
url
- the url of the image.detailLevel
- the detail level of the image.
-
ImageContent
Create a newImageContent
from the given url and detail level.- Parameters:
url
- the url of the image.detailLevel
- the detail level of the image.
-
ImageContent
Create a newImageContent
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.
-
ImageContent
Create a newImageContent
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
Create a newImageContent
from the given image.The image will be created with
DetailLevel.LOW
detail.- Parameters:
image
- the image.
-
ImageContent
Create a newImageContent
from the given image.- Parameters:
image
- the image.detailLevel
- the detail level of the image.
-
-
Method Details
-
image
Get theImage
.- Returns:
- the
Image
.
-
detailLevel
Get theDetailLevel
.- Returns:
- the
DetailLevel
.
-
type
Description copied from interface:Content
Returns the type of content.Can be used to cast the content to the correct type.
-
equals
-
hashCode
public int hashCode() -
toString
-
from
Create a newImageContent
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
Create a newImageContent
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
Create a newImageContent
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
Create a newImageContent
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
Create a newImageContent
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
public static ImageContent from(String base64Data, String mimeType, ImageContent.DetailLevel detailLevel) Create a newImageContent
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
Create a newImageContent
from the given image.The image will be created with
DetailLevel.LOW
detail.- Parameters:
image
- the image.- Returns:
- the new
ImageContent
.
-
from
Create a newImageContent
from the given image.- Parameters:
image
- the image.detailLevel
- the detail level of the image.- Returns:
- the new
ImageContent
.
-