Documentation
¶
Overview ¶
Package retrysched classifies the errors a model call can end in: the parsed Err shape, the timeout and context-overflow predicates the step loop consults, and the StatusError a failed provider response becomes. senior-dev issues one request per model call; nothing here schedules or re-issues a request.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HeaderPairs ¶
HeaderPairs flattens response headers into a lowercase-keyed map.
func IsContextOverflow ¶
IsContextOverflow reports whether a classified error says the prompt did not fit the model's context: a 413, a known overflow message, or a context_length_exceeded code in the response body.
func IsTimeoutError ¶
IsTimeoutError reports whether the classified error is timeout-shaped: an AbortError by name, or a timeout-shaped message. A missing message is not a match.
Types ¶
type Err ¶
Err is a classified error: a name plus the payload fields the predicates probe.
func FromStreamError ¶
func FromStreamError(raw json.RawMessage) Err
FromStreamError classifies an in-band error payload from a model stream.
func (Err) IsAPIError ¶
IsAPIError reports whether the classified error is a provider API error.
type ErrData ¶
type ErrData struct {
Message *string `json:"message,omitempty"`
StatusCode *float64 `json:"statusCode,omitempty"`
IsRetryable *bool `json:"isRetryable,omitempty"`
ResponseHeaders map[string]string `json:"responseHeaders,omitempty"`
ResponseBody *string `json:"responseBody,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
ErrData models the error payload for the keys the predicates probe. Every field is a pointer because a provider error can omit any of them, including the message.
type StatusError ¶
type StatusError struct {
Message string
Name string
Status *float64
Cause error
ResponseHeaders map[string]string
ResponseBody *string
}
StatusError is the error the OpenRouter path returns for a failed HTTP response: a message plus the status, headers and body the response carried. It exposes the status, name, body and cause through the small interfaces the adaptive router's classifiers probe.
func NewProviderError ¶
func NewProviderError(message string, status float64, headers map[string]string, body *string) *StatusError
NewProviderError builds the StatusError for a failed HTTP response.
func (*StatusError) Error ¶
func (e *StatusError) Error() string
func (*StatusError) ErrorDetail ¶
func (e *StatusError) ErrorDetail() string
ErrorDetail is the response body, so classifiers can match provider messages that only appear there.
func (*StatusError) ErrorName ¶
func (e *StatusError) ErrorName() string
ErrorName is the symbolic error name; it defaults to "Error".
func (*StatusError) ErrorStatusCode ¶
func (e *StatusError) ErrorStatusCode() (float64, bool)
ErrorStatusCode reports the HTTP status, when the error carries one.
func (*StatusError) RetryError ¶
func (e *StatusError) RetryError() Err
RetryError projects the failure into the classified Err shape: an APIError, or a ContextOverflowError when the message or body says the prompt did not fit.
func (*StatusError) Unwrap ¶
func (e *StatusError) Unwrap() error