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
4 changes: 2 additions & 2 deletions Demo/DemoChat/Sources/UI/Images/ImageCreationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public struct ImageCreationView: View {

@State private var prompt: String = ""
@State private var n: Int = 1
@State private var size = ImagesQuery.Size.allCases.first!
@State private var size = ImagesQuery.Size._1024

private var sizes = ImagesQuery.Size.allCases
private var sizes = ImagesQuery.Size.allCases.dropLast(2)

public init(store: ImageStore) {
self.store = store
Expand Down
6 changes: 3 additions & 3 deletions Sources/OpenAI/Public/Models/ImagesQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public enum ResponseFormat: String, Codable, Equatable {
responseFormat: Self.ResponseFormat? = nil,
size: Size? = nil,
style: Self.Style? = nil,
user:String? = nil
user: String? = nil
) {
self.prompt = prompt
self.n = n
Expand Down Expand Up @@ -85,7 +85,7 @@ public enum ResponseFormat: String, Codable, Equatable {
case _256 = "256x256"
case _512 = "512x512"
case _1024 = "1024x1024"
// case _1792_1024 = "1792x1024" // for dall-e-3 models
// case _1024_1792 = "1024x1792" // for dall-e-3 models
case _1792_1024 = "1792x1024" // for dall-e-3 models
case _1024_1792 = "1024x1792" // for dall-e-3 models
}
}
6 changes: 3 additions & 3 deletions Sources/OpenAI/Public/Protocols/OpenAIProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public protocol OpenAIProtocol {

Example:
```
let query = ImagesQuery(prompt: "White cat with heterochromia sitting on the kitchen table", n: 1, size: "1024x1024")
let query = ImagesQuery(prompt: "White cat with heterochromia sitting on the kitchen table", n: 1, size: ImagesQuery.Size._1024)
openAI.images(query: query) { result in
//Handle result here
}
Expand All @@ -66,7 +66,7 @@ public protocol OpenAIProtocol {

Example:
```
let query = ImagesEditQuery(image: "@whitecat.png", prompt: "White cat with heterochromia sitting on the kitchen table with a bowl of food", n: 1, size: "1024x1024")
let query = ImagesEditQuery(image: "@whitecat.png", prompt: "White cat with heterochromia sitting on the kitchen table with a bowl of food", n: 1, size: ImagesQuery.Size._1024)
openAI.imageEdits(query: query) { result in
//Handle result here
}
Expand All @@ -83,7 +83,7 @@ public protocol OpenAIProtocol {

Example:
```
let query = ImagesVariationQuery(image: "@whitecat.png", n: 1, size: "1024x1024")
let query = ImagesVariationQuery(image: "@whitecat.png", n: 1, size: ImagesQuery.Size._1024)
openAI.imageVariations(query: query) { result in
//Handle result here
}
Expand Down
Loading