brave-browser
brave-browser copied to clipboard
[BYOM]: Display error messages in the UI (for OpenAI and more in general)
Description
If a request fails we currently show a standardized message and it's not easy for the user to understand the issue, i.e. missing credits in API.
Steps to reproduce
- Connect OpenAI API to Leo
- Put faulty key
- Make request
Actual result
General error message
Expected result
Error message with explanation
Channel information
- [ ] release (stable)
- [ ] beta
- [X] nightly
This is the error format:
{
"error": {
"message": "The model `gpt-4-turbo-preview` does not exist or you do not have access to it.",
"type": "invalid_request_error",
"param": null,
"code": "model_not_found"
}
}
I was looking into this today for Ollama as well. Ollama uses the same shape, but only fills the response object partially in some cases: