Closed pvieito closed 1 year ago
Very good catch. Basically, the whole error handling is useless without it.
Great catch 👏🏼
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.
This fixes the implementation of #43:
param
andcode
error fields are optional.ChatError
before we try to decode theOpenAI
response, as the later always succeds due to this change.