Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ChatError] Fixed implementation #65

Merged
merged 1 commit into from
Apr 4, 2023

Conversation

pvieito
Copy link
Contributor

@pvieito pvieito commented Mar 28, 2023

This fixes the implementation of #43:

  • The param and code error fields are optional.
  • We have to check if there is a ChatError before we try to decode the OpenAI response, as the later always succeds due to this change.

@pvieito pvieito marked this pull request as ready for review March 28, 2023 09:41
@bogdanf
Copy link
Contributor

bogdanf commented Mar 28, 2023

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

@pvieito pvieito mentioned this pull request Mar 30, 2023
@adamrushy adamrushy merged commit 4a82c97 into adamrushy:main Apr 4, 2023
@adamrushy
Copy link
Owner

Great catch 👏🏼

@azamsharp
Copy link

azamsharp commented Apr 4, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants