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

Update documentation to explain possible error codes from the model endpoint #24

Open
ElYaiko opened this issue Dec 17, 2023 · 3 comments
Labels
component:documentation Improvements or additions to documentation

Comments

@ElYaiko
Copy link

ElYaiko commented Dec 17, 2023

Reading the docs I can't find a section where specifies the possible API error codes, in the examples/references it would be helpful to know what are the possible errors the API can return for error handling.

I hope this can be implemented, thanks!.

@hsubox76 hsubox76 added the component:documentation Improvements or additions to documentation label Dec 18, 2023
@davidstackio
Copy link

Especially some info about how to handle the SAFETY errors. Right now I'm just filtering for the word SAFETY in the error response to handle that case as a warning. There must be a better way than this though.

I tried to do something like this using the typescript vs code hints, but it doesn't always work.

if (response?.promptFeedback?.blockReason === "SAFETY") {
  // Warning for SAFETY errors
  logger.warn(error, response);
} else {
  // Error for all others
  logger.error(error);
}

@erik-wayhaven
Copy link

Related, it doesn't appear that I can import GoogleGenerativeAIError so that I can do e instanceof GoogleGenerativeAIError. Also, guidance on how to differentiate errors would be nice. Currently I don't see a way to get the HTTP status code without parsing the message (e.g. [500 Internal Server Error], [503 Service Unavailable]).

@hsubox76
Copy link
Collaborator

Let's focus this issue on documentation improvements on how to deal with different errors from the model.

We'll use this issue for improvements to how the SDK handles errors: #82 as it's already got some detailed feedback.

I'll update the title here.

@hsubox76 hsubox76 changed the title Error handling Update documentation to explain possible error codes from the model endpoint Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants