Skip to content

Commit

Permalink
Merge pull request #163 from kalafus/MacPaw.missing_enums
Browse files Browse the repository at this point in the history
Size enum for ImagesQuery
  • Loading branch information
ingvarus-bc committed Feb 21, 2024
2 parents edf8830 + ee0885f commit f1c05f5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
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

0 comments on commit f1c05f5

Please sign in to comment.