Skip to content

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.

1 participant