Package dev.langchain4j.model.vertexai
Class VertexAiImageModel
java.lang.Object
dev.langchain4j.model.vertexai.VertexAiImageModel
- All Implemented Interfaces:
dev.langchain4j.model.image.ImageModel
Image model for the Google Cloud Vertex AI Imagen image generation models.
Supports both versions of Imagen v1 and v2, respectively identified by the model names
imagegeneration@002 and imagegeneration@005.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumImage style can be specified for imagen@002. -
Constructor Summary
ConstructorsConstructorDescriptionVertexAiImageModel(String endpoint, String project, String location, String publisher, String modelName, Long seed, String language, Integer guidanceScale, String negativePrompt, VertexAiImageModel.ImageStyle sampleImageStyle, Integer sampleImageSize, Integer maxRetries, Boolean withPersisting, Path persistTo) Constructor of the Imagen image generation model. -
Method Summary
Modifier and TypeMethodDescriptionstatic VertexAiImageModel.Builderbuilder()dev.langchain4j.model.output.Response<dev.langchain4j.data.image.Image> dev.langchain4j.model.output.Response<dev.langchain4j.data.image.Image> dev.langchain4j.model.output.Response<dev.langchain4j.data.image.Image> dev.langchain4j.model.output.Response<List<dev.langchain4j.data.image.Image>>
-
Constructor Details
-
VertexAiImageModel
public VertexAiImageModel(String endpoint, String project, String location, String publisher, String modelName, Long seed, String language, Integer guidanceScale, String negativePrompt, VertexAiImageModel.ImageStyle sampleImageStyle, Integer sampleImageSize, Integer maxRetries, Boolean withPersisting, Path persistTo) Constructor of the Imagen image generation model.- Parameters:
endpoint- the base URL of the API (eg.https://us-central1-aiplatform.googleapis.com/v1/)project- the Google Cloud Project IDlocation- the cloud region (eg.us-central1)publisher- the publisher of the model (googlefor Imagen)modelName- the name of the image model (imagegeneration@002orimagegeneration@005)seed- a fixed random seed number between 0 and 2^32-1language- the spoken language used for the promptguidanceScale- an integer that represents the strength of the edit to make (0-9: low, 10-20: medium, 21+: high)negativePrompt- a negative prompt to specify what you don't want to see in the generated imagesampleImageStyle- the style of the image for Imagen v1, see theImageStyleenum for referencesampleImageSize- the size of the images to generatemaxRetries- number of times to retry in case of error (default: 3)withPersisting- true if the generated images should be persisted on the local file systempersistTo- thePathof the directory that should contain the generated images
-
-
Method Details
-
generate
public dev.langchain4j.model.output.Response<dev.langchain4j.data.image.Image> generate(String prompt) - Specified by:
generatein interfacedev.langchain4j.model.image.ImageModel
-
generate
public dev.langchain4j.model.output.Response<List<dev.langchain4j.data.image.Image>> generate(String prompt, int n) - Specified by:
generatein interfacedev.langchain4j.model.image.ImageModel
-
edit
public dev.langchain4j.model.output.Response<dev.langchain4j.data.image.Image> edit(dev.langchain4j.data.image.Image image, String prompt) - Specified by:
editin interfacedev.langchain4j.model.image.ImageModel
-
edit
public dev.langchain4j.model.output.Response<dev.langchain4j.data.image.Image> edit(dev.langchain4j.data.image.Image image, dev.langchain4j.data.image.Image mask, String prompt) - Specified by:
editin interfacedev.langchain4j.model.image.ImageModel
-
builder
-