OpenAISwift
OpenAISwift copied to clipboard
BUG: OpenAISwift sendCompletion returns nils
I updated the packages and the decoding error is now gone but when I make a request I get the following:
OpenAI<TextResult>(object: nil, model: nil, choices: nil, usage: nil, data: nil)
openAI.sendCompletion(with: chatText, maxTokens: 500) { result in
switch result {
case .success(let success):
// OpenAI<TextResult>(object: nil, model: nil, choices: nil, usage: nil, data: nil)
print(success)
The success contains all nil values.
Interesting! Looking now 👍🏼
@azamsharp can you stick a breakpoint LOC 209 inside OpenAISwift.swift file? Then print out the response from the API? This is likely to be caused by an error from the API. For example, my account is giving me a 429 for rate limit on the free account.
Found the solution. I used a different openChat function and read the actual error. It was related to quote limit expired. I put in my credit card with some limit and now everything worked. Thanks for your help!
The library can definitely improve the way it communicates errors. I had to do a little bit of browsing to figure out error 429 was holding me back, too.
I think I can work on this over these few days, would you be interested in a PR? Or would you rather work on this on your own?
@azamsharp can you stick a breakpoint LOC 209 inside OpenAISwift.swift file? Then print out the response from the API? This is likely to be caused by an error from the API. For example, my account is giving me a 429 for rate limit on the free account.
How do you fix this error?