SwiftyGPT

2.3.0

SwiftyGPT is a simple and lightweight wrapper around OpenAI API which exposes services provided by ChatGPT and DALL-E
antonio-war/SwiftyGPT

What's New

2.3.0

2023-04-15T14:09:03Z

Full Changelog: 2.2.0...2.3.0

SwiftyGPT is a simple and lightweight wrapper around OpenAI API which exposes services provided by ChatGPT and DALL-E. It was born with the aim of provide a Swift like interface around all OpenAI capabilities, so you can make requestes and get responses with minimal coding effort.

  • Easy to use: no configuration needed, SwiftyGPT is ready to go, you just need an API Key.
  • Configurable: you can choose some parameters like model, temperature or just use default values.
  • SwiftUI compatible: provides an elegant SwiftUI support that is very easy to use.

Installation

You can use Swift Package Manager to add SwiftyGPT to your project.

Add Package Dependency

In Xcode, select File > Add Packages...

Specify the Repository

Copy and paste the following into the search/input box.

https://github.com/antonio-war/SwiftyGPT

Specify options

Use Up to Next Major Version as dependency rule and enter the current SwiftyGPT version. Then click Add Package.


Setting Up

The first step to using SwiftyGPT is to create an instance, you an use the same to access all features.

let swiftyGPT = SwiftyGPT(apiKey: "YOUR_API_KEY")

Features


Error Handling

In case of failure methods return an error, it can be a system error in case something went wrong on the iOS side. For example, network-level issues or decoding issues. If instead the error is related to ChatGPT you will get a SwiftyGPTError.

if let error = error as? SwiftyGPTError {
    print(error.message)
}

License

SwiftyGPT is published under the Apache 2.0 license.

Description

  • Swift Tools 5.7.0
View More Packages from this Author

Dependencies

Last updated: Sun Apr 21 2024 11:01:18 GMT-0900 (Hawaii-Aleutian Daylight Time)