aallam / openai-kotlin

OpenAI API client for Kotlin with multiplatform and coroutines capabilities.
MIT License
1.49k stars 179 forks source link

Add “standard” Quality Option to Quality Class #376

Open hubercode opened 3 months ago

hubercode commented 3 months ago

Feature Description

I would like to request the addition of a “standard” quality option to the Quality class in the openai-kotlin library. Currently, the Quality class only supports the “hd” quality, but the OpenAI API itself supports both “hd” and “standard” qualities.

Problem it Solves

The current implementation of the Quality class only allows for the “hd” quality, which may lead to confusion for developers who are unaware that the API also supports a “standard” quality. While setting the quality parameter to null implies “standard” quality, this is not immediately obvious, and could lead to unintended usage or confusion. Adding explicit support for the “standard” quality in the Quality class would make the API more intuitive and reduce potential errors.

Proposed Solution

I propose adding an additional entry for “standard” quality in the Quality enum class. This would allow developers to explicitly set the quality to “standard” when making API requests. The updated Quality class might look something like this:

@Serializable
@JvmInline
public value class Quality(public val value: String) {
    public companion object {
        public val STANDARD: Quality = Quality("standard")
        public val HD: Quality = Quality("hd")
    }
}

Additional Context

This feature aligns the openai-kotlin library more closely with the capabilities of the OpenAI API as documented here. It also enhances the clarity of the API, making it more user-friendly for developers who are integrating OpenAI’s image generation features into their Kotlin applications.