diff --git a/Examples/iOS_Example/iOS_Example/Audio/audio.mp3 b/Examples/iOS_Example/iOS_Example/Audio/Sound/audio.mp3 similarity index 100% rename from Examples/iOS_Example/iOS_Example/Audio/audio.mp3 rename to Examples/iOS_Example/iOS_Example/Audio/Sound/audio.mp3 diff --git a/Examples/iOS_Example/iOS_Example/Completion/EditExample.swift b/Examples/iOS_Example/iOS_Example/Completion/EditExample.swift deleted file mode 100644 index 05810cb..0000000 --- a/Examples/iOS_Example/iOS_Example/Completion/EditExample.swift +++ /dev/null @@ -1,92 +0,0 @@ -// -// EditExample.swift -// OpenAIKit -// -// Copyright (c) 2023 MarcoDotIO -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -import SwiftUI -import OpenAIKit - -struct EditExample: View { - @State private var edit: String? - @State private var isEditing: Bool = false - - let input = "What day of the wek is it?" - let instruction = "Fix the spelling mistakes" - - var body: some View { - if isEditing { - VStack { - Text("Input: \(input)") - Text("Instruction: \(instruction)") - if let edit = edit { - Text("Edit: \(edit)") - } else { - Text("Edit: ...") - } - } - .padding() - } else { - VStack { - Button { - isEditing = true - - Task { - do { - let config = Configuration( - organizationId: "INSERT-ORGANIZATION-ID", - apiKey: "INSERT-API-KEY" - ) - let openAI = OpenAI(config) - let editParameter = EditParameters( - model: "text-davinci-edit-001", - input: input, - instruction: instruction - ) - let editResponse = try await openAI.generateEdit(parameters: editParameter) - - self.edit = editResponse.choices[0].text - } catch { - print("ERROR WITH - \(error)") - } - } - } label: { - Text("Edit Input") - .font(.headline) - .foregroundColor(.white) - .frame(width: 270, height: 50) - .background(.blue) - .clipShape(Capsule()) - .padding(.top, 8) - } - } - } - } -} - -struct EditExample_Previews: PreviewProvider { - static var previews: some View { - NavigationStack { - EditExample() - } - } -} diff --git a/README.md b/README.md index 21b7b15..8690e27 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,190 @@ -# OpenAIKit - [![Swift](https://img.shields.io/badge/Swift-5.5_5.6_5.7-orange?style=flat-square)](https://img.shields.io/badge/Swift-5.5_5.6_5.7-Orange?style=flat-square) -[![Platforms](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS-green?style=flat-square)](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS-green?style=flat-square) +[![Platforms](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_visionOS-green?style=flat-square)](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_visionOS-green?style=flat-square) [![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square) [![Swift](https://github.com/MarcoDotIO/OpenAIKit/actions/workflows/swift.yml/badge.svg?branch=main)](https://github.com/MarcoDotIO/OpenAIKit/actions/workflows/swift.yml) -OpenAIKit is a community-maintained API for the OpenAI REST endpoint used to get output data from Dall-E 2 and GPT-3 models. +
+ + OpenAIKit Logo + +

OpenAIKit

+

+ A community-maintained Swift API for the OpenAI REST endpoint. +
+ Explore the docs » +
+
+ Report Bug + · + Request Feature +

+
+ + +## Table of Contents + +- [About the Project][#about-the-project] + + - [Motivation](#motivation) + - [Our Vision](#our-vision) +- [Features](#features) +- [Requirements](#requirements) +- [Installation](#installation) + - [Swift Package Manager](#swift-package-manager) + - [SPM Through Xcode Project](#spm-through-xcode-project) + - [SPM Through Xcode Package](#spm-through-xcode-package) +- [Using OpenAIKit](#using-openaikit) +- [Development and Testing](#development-and-testing) +- [Next Steps](#next-steps) +- [Credits](#credits) +- [License](#license) + +## About the Project + +(Insert Screenshot from visionOS template project) + +**OpenAIKit** is a community-driven Swift SDK designed to provide Swift developers with a seamless, efficient, and Swifty way to interact with the OpenAI REST endpoint. Our aim is to lower the barrier for Swift developers, enabling them to integrate the power of OpenAI into their apps without delving deep into the intricacies of RESTful services. + +### Motivation + +With the increasing demand for AI-powered features in modern applications, it's crucial for developers to have access to tools that simplify the integration process. While OpenAI offers an incredible suite of capabilities, there was a clear need for a dedicated Swift SDK that aligns with the idiomatic practices of the language and the expectations of the Swift developer community. + +### Our Vision + +As the lead developer for OpenAIKit, I envisioned a tool that not only provides raw access to OpenAI functionalities but also enhances the developer experience with a clear and intuitive API. Our ultimate goal is to foster innovation by providing the Swift community with the right tools to integrate AI capabilities into their applications effortlessly. + +## Features + +- [x] Generate new, edited, and variations of images using Dall-E 2 (Dall-E 3 coming soon). +- [x] Generate edits and completions using GPT-3 and GPT-4. +- [x] List avaiable models for use with GPT-3 and GPT-4. +- [x] Retrieve embeddings for GPT-3 and GPT-4 prompts. +- [x] Stream data for GPT-3 and GPT-4 completions. +- [x] Generate Chat responses using ChatGPT. +- [x] View and Upload training files. +- [x] View whether a prompt is flagged by the Moderations endpoint or not. +- [x] Comprehensive Unit and Integration Test coverage. +- [x] Swift Concurrency compatibility back to iOS 13, macOS 10.15, tvOS 13, watchOS 6, and visionOS 1.0. +- [x] Complete documentation of OpenAIKit. + +## Requirements + +| Platform | Minimum Swift Version | Installation | Status | +| ------------------------------------------------------------ | --------------------- | ----------------------------------------------- | ------------ | +| iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 6.0+ / visionOS 1.0+ | 5.5 | [Swift Package Manager](#swift-package-manager) | Fully Tested | + +## Installation + +### Swift Package Manager + +The [Swift Package Manager](https://swift.org/package-manager/) allows for developers to easily integrate packages into their Xcode projects and packages; and is also fully integrated into the `swift` compiler. + +#### SPM Through XCode Project + +* File > Swift Packages > Add Package Dependency +* Add `https://github.com/marcodotio/OpenAIKit.git` +* Select "Up to next Major" with "1.2" + +#### SPM Through Xcode Package + +Once you have your Swift package set up, add the Git link within the `dependencies` value of your `Package.swift` file. + +```swift +dependencies: [ + .package(url: "https://github.com/marcodotio/OpenAIKit.git", .upToNextMajor(from: "1.2")) +] +``` + +## Using OpenAIKit + +OpenAIKit is designed to be very easy to integrate into your own projects. The main method of utilizing OpenAIKit is to set a `OpenAI` class object: + +```swift +import OpenAIKit + +// An API key and Organization ID is required to use the API library. +let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY") + +// Create an `OpenAI` object using the Configuration object. +let openAI = OpenAI(config) +``` + +From there, it's as easy as calling one of the provided function members. The code below demonstrates how you can generate an image using `createImage()`: + +```swift +do { + let imageParam = ImageParameters( + prompt: "a red apple", + resolution: .small, + responseFormat: .base64Json + ) + let result = try await openAi.createImage( + parameters: imageParam + ) + let b64Image = result.data[0].image + let image = try openAi.decodeBase64Image(b64Image) +} catch { + // Insert your own error handling method here. +} +``` + +As well, you are able to generate completions using GPT-3: + +```swift +do { + let completionParameter = CompletionParameters( + model: "text-davinci-001", + prompt: ["Say this is a test ->"], + maxTokens: 4, + temperature: 0.98 + ) + let completionResponse = try await openAI.generateCompletion( + parameters: completionParameter + ) + let responseText = completionResponse.choices[0].text +} catch { + // Insert your own error handling method here. +} +``` + +## Development And Testing + +I welcome anyone to contribute to the project through posting issues, if they encounter any bugs / glitches while using OpenAIKit; and as well with creating pull issues that add any additional features to OpenAIKit. + +## Next Steps + +* In the near future, there will be full documentation outlining how a user can fully utilize OpenAIKit. +* As well, more features listed in [ToDo](#todo) will be fully implemented. +* More examples, from other platforms, will be uploaded for developers to be able to focus more on implementing the end user experience, and less time figuring out their project's architecture. + +## Credits + +I would like to personally thank the [OpenAI Team](https://openai.com) for implementing the REST endpoint and implementing the models themselves, as without them, this project wouldn't have been possible. + +As well, I would like to personally thank [YufeiG](https://github.com/YufeiG) for providing troubleshooting help on sending Image data for the Image Edit and Variations endpoints. + +## License + +OpenAIKit is released under the MIT license, and any use of OpenAI's REST endpoint will be under the [Usage policies](https://beta.openai.com/docs/usage-policies) set by them. [See LICENSE](https://github.com/MarcoDotIO/OpenAIKit/blob/main/LICENSE) for details. + + + + +[contributors-shield]: https://img.shields.io/github/contributors/othneildrew/Best-README-Template.svg?style=for-the-badge +[contributors-url]: https://github.com/MarcoDotIO/OpenAIKit/graphs/contributors +[forks-shield]: https://img.shields.io/github/forks/othneildrew/Best-README-Template.svg?style=for-the-badge +[forks-url]: https://github.com/MarcoDotIO/OpenAIKit/network/members +[stars-shield]: https://img.shields.io/github/stars/othneildrew/Best-README-Template.svg?style=for-the-badge +[stars-url]: https://github.com/MarcoDotIO/OpenAIKit/stargazers +[issues-shield]: https://img.shields.io/github/issues/othneildrew/Best-README-Template.svg?style=for-the-badge +[issues-url]: https://github.com/MarcoDotIO/OpenAIKit/issues +[license-shield]: https://img.shields.io/github/license/othneildrew/Best-README-Template.svg?style=for-the-badge +[license-url]: https://github.com/MarcoDotIO/OpenAIKit/blob/main/LICENSE.txt + +[![Swift](https://img.shields.io/badge/Swift-5.5_5.6_5.7-orange?style=flat-square)](https://img.shields.io/badge/Swift-5.5_5.6_5.7-Orange?style=flat-square) +[![Platforms](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_visionOS-green?style=flat-square)](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_visionOS-green?style=flat-square) +[![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square) +[![Swift](https://github.com/MarcoDotIO/OpenAIKit/actions/workflows/swift.yml/badge.svg?branch=main)](https://github.com/MarcoDotIO/OpenAIKit/actions/workflows/swift.yml) - [Features](#features) - [ToDo](#todo) @@ -40,9 +219,9 @@ OpenAIKit is a community-maintained API for the OpenAI REST endpoint used to get ## Requirements -| Platform | Minimum Swift Version | Installation | Status | -| --- | --- | --- | --- | -| iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 6.0+ / visionOS 1.0+ | 5.5 | [Swift Package Manager](#swift-package-manager) | Fully Tested | +| Platform | Minimum Swift Version | Installation | Status | +| ------------------------------------------------------------ | --------------------- | ----------------------------------------------- | ------------ | +| iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 6.0+ / visionOS 1.0+ | 5.5 | [Swift Package Manager](#swift-package-manager) | Fully Tested | ## Installation @@ -138,3 +317,17 @@ As well, I would like to personally thank [YufeiG](https://github.com/YufeiG) fo ## License OpenAIKit is released under the MIT license, and any use of OpenAI's REST endpoint will be under the [Usage policies](https://beta.openai.com/docs/usage-policies) set by them. [See LICENSE](https://github.com/MarcoDotIO/OpenAIKit/blob/main/LICENSE) for details. + + + + +[contributors-shield]: https://img.shields.io/github/contributors/othneildrew/Best-README-Template.svg?style=for-the-badge +[contributors-url]: https://github.com/MarcoDotIO/OpenAIKit/graphs/contributors +[forks-shield]: https://img.shields.io/github/forks/othneildrew/Best-README-Template.svg?style=for-the-badge +[forks-url]: https://github.com/MarcoDotIO/OpenAIKit/network/members +[stars-shield]: https://img.shields.io/github/stars/othneildrew/Best-README-Template.svg?style=for-the-badge +[stars-url]: https://github.com/MarcoDotIO/OpenAIKit/stargazers +[issues-shield]: https://img.shields.io/github/issues/othneildrew/Best-README-Template.svg?style=for-the-badge +[issues-url]: https://github.com/MarcoDotIO/OpenAIKit/issues +[license-shield]: https://img.shields.io/github/license/othneildrew/Best-README-Template.svg?style=for-the-badge +[license-url]: https://github.com/MarcoDotIO/OpenAIKit/blob/main/LICENSE.txt diff --git a/Resources/APIKeysPage.png b/Resources/APIKeysPage.png new file mode 100644 index 0000000..1dbd67f Binary files /dev/null and b/Resources/APIKeysPage.png differ diff --git a/Resources/AvocadoChair.png b/Resources/AvocadoChair.png new file mode 100644 index 0000000..7a6383f Binary files /dev/null and b/Resources/AvocadoChair.png differ diff --git a/Resources/InputTranscriptionAudio.mp3 b/Resources/InputTranscriptionAudio.mp3 new file mode 100644 index 0000000..3cc1386 Binary files /dev/null and b/Resources/InputTranscriptionAudio.mp3 differ diff --git a/Resources/Logo.png b/Resources/Logo.png new file mode 100644 index 0000000..76ccca8 Binary files /dev/null and b/Resources/Logo.png differ diff --git a/Resources/MonaLisaBeret.png b/Resources/MonaLisaBeret.png new file mode 100644 index 0000000..4c2335b Binary files /dev/null and b/Resources/MonaLisaBeret.png differ diff --git a/Resources/MonaLisaMask.png b/Resources/MonaLisaMask.png new file mode 100644 index 0000000..5b1b750 Binary files /dev/null and b/Resources/MonaLisaMask.png differ diff --git a/Resources/OriginalMonaLisa.png b/Resources/OriginalMonaLisa.png new file mode 100644 index 0000000..e702683 Binary files /dev/null and b/Resources/OriginalMonaLisa.png differ diff --git a/Resources/OriginalWave.png b/Resources/OriginalWave.png new file mode 100644 index 0000000..68eedd0 Binary files /dev/null and b/Resources/OriginalWave.png differ diff --git a/Resources/WaveVariation.png b/Resources/WaveVariation.png new file mode 100644 index 0000000..c01b313 Binary files /dev/null and b/Resources/WaveVariation.png differ diff --git a/Sources/OpenAIKit/OpenAI.swift b/Sources/OpenAIKit/OpenAI.swift index cbe0dfa..86f5dca 100644 --- a/Sources/OpenAIKit/OpenAI.swift +++ b/Sources/OpenAIKit/OpenAI.swift @@ -23,7 +23,7 @@ // THE SOFTWARE. // -#if os(iOS) || os(tvOS) || os(watchOS) +#if os(iOS) || os(tvOS) || os(watchOS) || os(visionOS) import UIKit import SwiftUI #endif @@ -47,7 +47,7 @@ public final class OpenAI { self.config = config } - #if os(iOS) || os(tvOS) || os(watchOS) + #if os(iOS) || os(tvOS) || os(watchOS) || os(visionOS) /// Input a `Base64` image binary `String` to receive an `UIImage` object. /// - Parameter b64Data: The `Base64` data itself in `String` form. /// - Returns: A `UIImage` object. @@ -145,15 +145,6 @@ extension OpenAI: OpenAIProtocol { ) } - public func generateEdit(parameters param: EditParameters) async throws -> EditResponse { - let serverUrl = try getServerUrl(path: "/edits") - return try await OpenAIKitSession.shared.decodeUrl( - with: serverUrl, - apiKey: config.apiKey, - body: param.body - ) - } - public func generateChatCompletion(parameters param: ChatParameters) async throws -> ChatResponse { let serverUrl = try getServerUrl(path: "/chat/completions") return try await OpenAIKitSession.shared.decodeUrl( diff --git a/Sources/OpenAIKit/Types/Structs/Parameters/Edits/EditParameters.swift b/Sources/OpenAIKit/Types/Structs/Parameters/Edits/EditParameters.swift deleted file mode 100644 index 9a80cf5..0000000 --- a/Sources/OpenAIKit/Types/Structs/Parameters/Edits/EditParameters.swift +++ /dev/null @@ -1,86 +0,0 @@ -// -// EditParameters.swift -// OpenAIKit -// -// Copyright (c) 2023 MarcoDotIO -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -/// Parameter struct for the Edit endpoint. -public struct EditParameters { - /// ID of the model to use. - /// - /// You can use the [List models](https://beta.openai.com/docs/api-reference/models/list) - /// API to see all of your available models, or see our [Model overview](https://beta.openai.com/docs/models/overview) - /// for descriptions of them. - public var model: String - - /// The input text to use as a starting point for the edit. - public var input: String - - /// The instruction that tells the model how to edit the prompt. - public var instruction: String - - /// How many edits to generate for the input and instruction. - public var numberOfEdits: Int - - /// What [sampling temperature](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277) - /// to use. - /// - /// Higher values means the model will take more risks. - /// Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. - /// - /// We generally recommend altering this or `top_p` but not both. - public var temperature: Double - - /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. - /// - /// So 0.1 means only the tokens comprising the top 10% probability mass are considered. - /// We generally recommend altering this or `temperature` but not both. - public var topP: Double - - public init( - model: String = "text-davinci-edit-001", - input: String = "\"", - instruction: String, - numberOfEdits: Int = 1, - temperature: Double = 1.0, - topP: Double = 1.0 - ) { - self.model = model - self.input = input - self.instruction = instruction - self.numberOfEdits = numberOfEdits - self.temperature = temperature - self.topP = topP - } - - /// The body of the URL used for OpenAI API requests. - internal var body: [String: Any] { - return [ - "model": self.model, - "input": self.input, - "instruction": self.instruction, - "n": self.numberOfEdits, - "temperature": self.temperature, - "top_p": self.topP - ] - } -} diff --git a/Sources/OpenAIKit/Types/Structs/Parameters/Images/ImageEditParameters.swift b/Sources/OpenAIKit/Types/Structs/Parameters/Images/ImageEditParameters.swift index 1e14e1f..b252ae7 100644 --- a/Sources/OpenAIKit/Types/Structs/Parameters/Images/ImageEditParameters.swift +++ b/Sources/OpenAIKit/Types/Structs/Parameters/Images/ImageEditParameters.swift @@ -23,7 +23,7 @@ // THE SOFTWARE. // -#if os(iOS) || os(tvOS) || os(watchOS) +#if os(iOS) || os(tvOS) || os(watchOS) || os(visionOS) import SwiftUI #endif diff --git a/Sources/OpenAIKit/Types/Structs/Parameters/Images/ImageVariationParameters.swift b/Sources/OpenAIKit/Types/Structs/Parameters/Images/ImageVariationParameters.swift index 8a1dab2..4a26741 100644 --- a/Sources/OpenAIKit/Types/Structs/Parameters/Images/ImageVariationParameters.swift +++ b/Sources/OpenAIKit/Types/Structs/Parameters/Images/ImageVariationParameters.swift @@ -23,7 +23,7 @@ // THE SOFTWARE. // -#if os(iOS) || os(tvOS) || os(watchOS) +#if os(iOS) || os(tvOS) || os(watchOS) || os(visionOS) import SwiftUI #endif @@ -76,7 +76,7 @@ public struct ImageVariationParameters { self.user = user } - #if os(iOS) || os(tvOS) || os(watchOS) + #if os(iOS) || os(tvOS) || os(watchOS) || os(visionOS) public init( image: UIImage, @Clamped(range: 1...10) numberOfImages: Int = 1, diff --git a/Sources/OpenAIKit/Types/Structs/Schemas/Edits/EditResponse.swift b/Sources/OpenAIKit/Types/Structs/Schemas/Edits/EditResponse.swift deleted file mode 100644 index b1206e1..0000000 --- a/Sources/OpenAIKit/Types/Structs/Schemas/Edits/EditResponse.swift +++ /dev/null @@ -1,39 +0,0 @@ -// -// EditResponse.swift -// OpenAIKit -// -// Copyright (c) 2023 MarcoDotIO -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -/// The Edit response sent from OpenAI -public struct EditResponse: Codable { - /// The type of `OpenAIObject` the Edit is. - public let object: OpenAIObject - - /// When the Edit was created. - public let created: Int - - /// The choice outputs for the Edit. - public let choices: [Choice] - - /// The amount of tokens used by the Edit. - public let usage: Usage -}