From 691f4f3518780cd3e42870bfecfe6634a7ce038f Mon Sep 17 00:00:00 2001 From: slam Date: Tue, 13 Feb 2024 16:09:48 +0800 Subject: [PATCH] feat(images-api): implement images api - https://platform.openai.com/docs/api-reference/images add more parameters control for create --- .../openai/api/images/api/ImageCreate.kt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/openai-client/openai-client-core/src/commonMain/kotlin/com/tddworks/openai/api/images/api/ImageCreate.kt b/openai-client/openai-client-core/src/commonMain/kotlin/com/tddworks/openai/api/images/api/ImageCreate.kt index 5b97b53..887bea4 100644 --- a/openai-client/openai-client-core/src/commonMain/kotlin/com/tddworks/openai/api/images/api/ImageCreate.kt +++ b/openai-client/openai-client-core/src/commonMain/kotlin/com/tddworks/openai/api/images/api/ImageCreate.kt @@ -83,5 +83,27 @@ data class ImageCreate( prompt = prompt, model = model ) + + /** + * Create an instance of [ImageCreate]. + * @param prompt A text description of the desired image(s). The maximum length is 1000 characters for dall-e-2 and 4000 characters for dall-e-3. + * @param model The model to use for image generation. Defaults to dall-e-2 + * @param size The size of the generated images. Defaults to 1024x1024 + * @param style The style of the generated images. Must be one of vivid or natural. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. This param is only supported for dall-e-3. + * @param quality The quality of the image that will be generated. `Quality.HD` creates images with finer details and greater consistency across the image. This param is only supported for `dall-e-3`. + */ + fun create( + prompt: String, + model: Model? = null, + size: Size? = null, + style: Style? = null, + quality: Quality? = null, + ): ImageCreate = ImageCreate( + prompt = prompt, + model = model, + size = size, + style = style, + quality = quality + ) } } \ No newline at end of file