OpenAISwift
OpenAISwift copied to clipboard
Always returning nil
Describe the bug I write a function in Swift to search in ChatGpt here is my function
func performSearch() {
openAI.sendCompletion(with: "what is chat gpt", maxTokens: 500) { result in
switch result {
case .success(let response):
print("Response ",response)
let answer = response.choices?.first?.text.trimmingCharacters(in: .whitespacesAndNewlines)
case .failure(let failure):
print("Failed")
}
}
}
To Reproduce Steps to reproduce the behavior:
- Just call this
performSearch()
method
Expected behavior It should return with some response or error
Screenshots I added screenshot of printing the response
Desktop (please complete the following information):
- xCode 14.3.1
Smartphone (please complete the following information):
- iOS 16.4 (simulator)
Additional context Add any other context about the problem here.
@khandakerTR I'd recommend using something like Charles (with its SSL Proxy active and Certificate installed on the Simulator) to see exactly what the error is. It might give you more details.
I got the same issue
I fixed it by activating the openAI API account by entering the credit card info.....It is not the same as ChatGPT account