Build An AI ChatBot with OpenAI (Swift, Xcode 14, 2023)

preview_player
Показать описание
In this video we will learn how to leverage the OpenAI API to build a conversational chat bot app in Xcode – with Swift. We will set up an API Client, create the user interface, and see how to use a variety of AI models in our app.

** Popular Series

** Get Skillshare free for 2 Months and learn iOS

** Manage all your investments from app earnings on Betterment!

** Grow your own Youtube tech channel with TubeBuddy:

#swift #ChatGPT #openAI
Рекомендации по теме
Комментарии
Автор

For anyone having an issue with "authToken" and Xcode asking to replace it with "config", this was not updated in the docs yet in v1.4 of OpenAISwift.
Here is the fix. Change your:
OpenAISwift(authToken: Constants.key)
to:
OpenAISwift(config: Constants.key))
Hope that helps!

nullptryt
Автор

definitely a more advanced tutorial, would love if you provided a little bit more explanation behind why you use certain things as if a beginner was encountering it ... gotta go thru the rest of ur videos I suppose

opensourceideas
Автор

Solution: let config = OpenAISwift(config: .makeDefaultOpenAI(apiKey: Constants.key))

merakshot
Автор

The short answers were because maxTokens = 16 default. If you change it, the answers will be more.

Andrew-vg
Автор

Great video Sir!
still can't believe the AI thinks android is better than iOS just because of more RAM !
gotta bring him to iOS Academy

cozybazaar
Автор

After looking into this (in May 2023), it seems this API doesn't work as the video suggests. The OpenAI API requires that a user goes through a backend, to handle the API keys. "OpenAI’s usage policies do not allow developers to embed their API keys directly in a client-side application."

It would be great if you could do an update to this video. Otherwise, anyone who comes across this video now or in the future should understand that they will get a "nil" response back from the sendCompletion function.

OnionKnight
Автор

Is your OpenAI API key secure if built into an App Store app like you’ve done in this video - or are there other steps you’d need to take to protect it before uploading your app?

Tenly
Автор

having issues running it says APICaller no member of client and cannot not use non optional value of string

SwatiChoudhary-gfut
Автор

hi, I think OpenAI change there model for now is :
public struct OpenAI: Codable {

public let object: String
public let model: String
public let choices: [Choice]
}
But i have a .decode error when call api

RyanProphet
Автор

Hi, do you have a video about how to integrate gpt-4o API?

Ronald-vd
Автор

October 2023

--
I was able to fix the issue by just adding $5 to my OpenID account (and wait 5 minutes). Setup function should look like this

private var client: OpenAISwift?

public func setup() {
let config: OpenAISwift.Config = .makeDefaultOpenAI(apiKey: “YOUR-ID-KEY")
client = OpenAISwift(config: config) // Initialize OpenAI
}

AnthonyMarchenko
Автор

Great video. I wrote the code identical to yours, but the model is returning "nil." Is this because I don't have any credits in my OpenAI account?

AnthonyQin
Автор

You should make a video now where you see how much ChatGPT can make this app for you.. I'm sure it won't be totally correct but it would be interesting to see how much you could get from it.

JeromePullenJr
Автор

Hello? I have a question because there is a problem. If I add .codex, I won't see the answer to the GPT. It looks like the answer in the video before I add it. May I know the solution?

홍준영-sq
Автор

I got stuck with a strange error :Type 'ViewController' does not conform to protocol 'UITableViewDataSource' and can't find hot to fix it :/

Seems like i did everything identical to the code on the video

ribosome
Автор

Is there a way to feed a collection of data for the AI to learn from?

SwimnBird
Автор

My print result Always shows nil. In apicaller.😔

md.tipusultan
Автор

it is not responding, I think it could not set up a request with the api, how can I fix it, it gives failed output when it works.

zeynepsevgi
Автор

What is this technique called (where you initialize and customize an object before assigning it)?

private let field: UITextField = {
let textField = UITextField()
// Customize text field.
return textField
}()

foxster.mp
Автор

When i try to add package there is problem: "OpenAISwift could not be resolved". Does anyone know how to fix this problem?

adilbektursunov