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

Ensure errors about invalid OpenAI API keys are properly surfaced #112

Closed
jlewi opened this issue May 22, 2024 · 1 comment · Fixed by #117
Closed

Ensure errors about invalid OpenAI API keys are properly surfaced #112

jlewi opened this issue May 22, 2024 · 1 comment · Fixed by #117

Comments

@jlewi
Copy link
Owner

jlewi commented May 22, 2024

If requests fail because of invalid OpenAI API keys (e.g #109) we ensure a clear actionable message is surfaced to the user.
See also #82

@jlewi
Copy link
Owner Author

jlewi commented May 24, 2024

This doesn't appear to be an issue with HashiCorp's retryable errors swallowing the errors.
If the APIKey is invalid OpenAI returns status code status code: 401.
https://platform.openai.com/docs/guides/error-codes/api-errors

It looks like HashiCorp's base retry polies retries on
StatusTooManyRequests - 429
StatusServiceUnavailable - 500 errors with the exception of NotImplemented
https://github.com/hashicorp/go-retryablehttp/blob/86e852df43aa0d94150c4629d74e5116d1ff3348/client.go#L495

One problem is that in the server in Agent we don't log the error if there is one for generate

return nil, err

jlewi added a commit that referenced this issue May 24, 2024
* Log Agent.Generate errors so we have clear error messages in the event
the OpenAI request fails.

Fix #112
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 a pull request may close this issue.

1 participant