Saltar al contenido principal
Versión: 20 R9 BETA

OpenAIError Class

The OpenAIError class is designed to handle errors returned by the OpenAI API. It extracts relevant information from the error response and provides methods to access this information.

Propiedades

Error properties

PropiedadTipoDescripción
errCodeIntegerThe error code returned by the API or the HTTP status.
messageTextThe error message returned by the API or the HTTP status text.

Propiedades de respuesta HTTP

PropiedadTipoDescripción
responseObjectEl objeto de respuesta completo.
statusIntegerThe HTTP status code of the response.
statusTextTextThe status text of the HTTP response.
bodyObjectEl cuerpo de la respuesta de error.
headersObjectLos encabezados de la respuesta de error.
requestIDTextThe request ID from the error response headers.

OpenAI específico

PropiedadTipoDescripción
codeVariantEl código de error devuelto por la API.
tipoTextEl tipo de error devuelto por la API.
paramTextThe parameter that caused the error, if applicable.

Información sobre el código de estado HTTP

PropiedadTipoDescripción
isBadRequestErrorBooleanIndicates if the error is a 400 Bad Request error.
isAuthenticationErrorBooleanIndicates if the error is a 401 Authentication error.
isPermissionDeniedErrorBooleanIndicates ∏if the error is a 403 Permission Denied error.
isNotFoundErrorBooleanIndicates if the error is a 404 Not Found error.
isUnprocessableEntityErrorBooleanIndicates if the error is a 422 Unprocessable Entity error.
isRateLimitErrorBooleanIndica si el error es un error de límite de velocidad 429.
isInternalServerErrorBooleanIndicates if the error is a 500 or higher Internal Server error.