Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ERR_CONTEXT_LENGTH_EXCEEDED = NewApiError(400, "context_length_exceeded", "Please reduce the length of the messages.", "invalid_request_error", "messages") ERR_INVALID_API_KEY = NewApiError(401, "invalid_api_key", "Incorrect API key provided or has been disabled.", "invalid_request_error", "") ERR_MODEL_NOT_FOUND = NewApiError(404, "model_not_found", "The model does not exist or you do not have access to it.", "invalid_request_error", "") ERR_INSUFFICIENT_QUOTA = NewApiError(429, "insufficient_quota", "You exceeded your current quota.", "insufficient_quota", "") ERR_RATE_LIMIT_EXCEEDED = NewApiError(429, "rate_limit_exceeded", "Rate limit reached, Please try again later.", "requests", "") )
Functions ¶
func NewApiError ¶ added in v0.2.0
func NewRequestError ¶ added in v0.2.0
Types ¶
type ApiError ¶ added in v0.2.0
type ApiError struct { HttpStatusCode int `json:"-"` Code any `json:"code,omitempty"` Message string `json:"message"` Type string `json:"type"` Param *string `json:"param,omitempty"` }
ApiError provides error information returned by the OpenAI API. InnerError struct is only valid for Azure OpenAI Service.
func (*ApiError) UnmarshalJSON ¶ added in v0.2.0
type ErrorResponse ¶
type ErrorResponse struct {
Error *ApiError `json:"error,omitempty"`
}
type RequestError ¶
RequestError provides information about generic request sdkerr.
func (*RequestError) Error ¶
func (e *RequestError) Error() string
func (*RequestError) Unwrap ¶
func (e *RequestError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.