adamrushy / OpenAISwift

This is a wrapper library around the ChatGPT and OpenAI HTTP API
MIT License
1.6k stars 242 forks source link

[ChatError] Fixed implementation #65

Closed pvieito closed 1 year ago

pvieito commented 1 year ago

This fixes the implementation of #43:

bogdanf commented 1 year ago

Very good catch. Basically, the whole error handling is useless without it.

adamrushy commented 1 year ago

Great catch 👏🏼

azamsharp commented 1 year ago

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.