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

Feature/throw bad responses #60

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ConfusedVorlon
Copy link
Contributor

Currently, "error responses" from OpenAI (such as when a bad API token is used) are not treated as errors.
This means that the response is fed through to the parser, and fails to decode.

The coder sees a decoding error, rather than the actual problem.

By throwing earlier - we can give a more helpful response in the console.

e.g.
RequestFailed: genericError(error: OpenAISwift.OpenAIError.badResponse(code: 401, response: Optional("{\n \"error\": {\n \"message\": \"Incorrect API key provided: ##YOUR C******************EY##. You can find your API key at https://platform.openai.com/account/api-keys.\",\n \"type\": \"invalid_request_error\",\n \"param\": null,\n \"code\": \"invalid_api_key\"\n }\n}\n")))

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

1 participant