Package dev.langchain4j.model.openai
Class OpenAiImageModel
java.lang.Object
dev.langchain4j.model.openai.OpenAiImageModel
- All Implemented Interfaces:
dev.langchain4j.model.image.ImageModel
Represents an OpenAI DALL·E models to generate artistic images. Versions 2 and 3 (default) are supported.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionOpenAiImageModel
(String baseUrl, String apiKey, String organizationId, String modelName, String size, String quality, String style, String user, String responseFormat, Duration timeout, Integer maxRetries, Proxy proxy, Boolean logRequests, Boolean logResponses, Boolean withPersisting, Path persistTo) Instantiates OpenAI DALL·E image processing model. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
dev.langchain4j.model.output.Response
<dev.langchain4j.data.image.Image> dev.langchain4j.model.output.Response
<List<dev.langchain4j.data.image.Image>> static OpenAiImageModel
withApiKey
(String apiKey) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.langchain4j.model.image.ImageModel
edit, edit
-
Constructor Details
-
OpenAiImageModel
public OpenAiImageModel(String baseUrl, String apiKey, String organizationId, String modelName, String size, String quality, String style, String user, String responseFormat, Duration timeout, Integer maxRetries, Proxy proxy, Boolean logRequests, Boolean logResponses, Boolean withPersisting, Path persistTo) Instantiates OpenAI DALL·E image processing model. Find the parameters description here.- Parameters:
modelName
- dall-e-3 is default onewithPersisting
- generated response will be persisted underjava.io.tmpdir
. The URL withindev.ai4j.openai4j.image.GenerateImagesResponse
will contain the URL to local images then.persistTo
- specifies the local path where the generated image will be downloaded to (in case provided). The URL withindev.ai4j.openai4j.image.GenerateImagesResponse
will contain the URL to local images then.
-
-
Method Details
-
modelName
-
generate
public dev.langchain4j.model.output.Response<dev.langchain4j.data.image.Image> generate(String prompt) - Specified by:
generate
in 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:
generate
in interfacedev.langchain4j.model.image.ImageModel
-
builder
-
withApiKey
-