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, Map<String, String> customHeaders) 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 OpenAiImageModelwithApiKey(String apiKey) Deprecated, for removal: This API element is subject to removal in a future version.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, Map<String, String> customHeaders) 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.GenerateImagesResponsewill 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.GenerateImagesResponsewill 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:
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
-
builder
-
withApiKey
Deprecated, for removal: This API element is subject to removal in a future version.Please usebuilder()instead, and explicitly set the model name and, if necessary, other parameters. The default value for the model name will be removed in future releases!
-
builder()instead, and explicitly set the model name and, if necessary, other parameters.