Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Size enum for ImagesQuery #163

Merged
merged 10 commits into from
Feb 21, 2024
Merged

Conversation

kalafus
Copy link
Contributor

@kalafus kalafus commented Feb 6, 2024

What

Size enum for ImagesQuery

Why

only certain magic strings are accepted by the endpoint, so use define them with an enum.

Affected Areas

ImagesQuery > openAI.images(...)

Copy link
Contributor Author

@kalafus kalafus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for merge compatibility with MacPaw.views_abstraction.
Ready for merge into main!

@SunburstEnzo
Copy link
Contributor

Good idea 👍 tempted to even suggest using small, medium, and large with dimensions in the documentation

@kalafus
Copy link
Contributor Author

kalafus commented Feb 10, 2024

i'm more prone to make it more specific with _256_256 _512_512 and _1024_1024, given that for dall-e-3 it's _1024_1024, _1792_1024, and _1024_1792 (commented out). small, medium, and large are fine for User Experience, but i think it's more helpful to the developer writing code to be presented accurate information by Xcode autocomplete.

@kalafus
Copy link
Contributor Author

kalafus commented Feb 10, 2024

oh, in the documentation... perhaps. i suppose for dall-e-3, could be square portrait and landscape.

@kalafus
Copy link
Contributor Author

kalafus commented Feb 10, 2024

@SunburstEnzo , I like your suggestion... To affect the User Experience, it would require context sensitivity to differentiate Query from View (I hope my meaning is clear), and I'm not sure how this could be accomplished at all, or especially in a straightforward way. Open to further suggestions!

    /// small: 256x256 pixels (dall-e-2)
    /// medium: 512x512 pixels (dall-e-2)
    /// large: 1024x1024 pixels (dall-e-2, dall-e-3)
    /// large_landscape: 1792x1024 pixels (dall-e-2, dall-e-3)
    /// large_portrait: 1024x1792 pixels (dall-e-2, dall-e-3)
    public enum Size: String, Codable, CaseIterable {
        case small = "256x256" // for dall-e-2 model
        case medium = "512x512" // for dall-e-2 model
        case large = "1024x1024" // for dall-e-2, dall-e-3 models
        case large_landscape = "1792x1024" // for dall-e-3 model
        case large_portrait = "1024x1792" // for dall-e-3 model

    }

@kalafus
Copy link
Contributor Author

kalafus commented Feb 15, 2024

@ingvarus-bc , resolved merge conflicts

Copy link

sonarcloud bot commented Feb 17, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
1.0% Duplication on New Code

See analysis details on SonarCloud

@ingvarus-bc ingvarus-bc merged commit f1c05f5 into MacPaw:main Feb 21, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants