@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
28 lines (27 loc) • 1.55 kB
TypeScript
/**
* Shared HTTP retryability constants.
*
* Centralises the status-code lists that were duplicated across
* httpRetryHandler, neurolink.ts, fileDetector.ts, and errorHelpers.
*/
/** Server-side and rate-limiting codes worth retrying. */
export declare const RETRYABLE_HTTP_STATUS_CODES: readonly number[];
/** Client-error codes where retrying is pointless. */
export declare const NON_RETRYABLE_HTTP_STATUS_CODES: readonly number[];
/** Check whether an HTTP status code is retryable. */
export declare function isRetryableStatusCode(code: number): boolean;
/** Check whether an HTTP status code is non-retryable. */
export declare function isNonRetryableStatusCode(code: number): boolean;
/**
* Detect a deterministic client-error (HTTP 400 / malformed request) signature
* embedded in a provider error MESSAGE, for cases where the numeric status is
* not exposed as a structured `status`/`statusCode` field. Vertex/Gemini wrap a
* 400 INVALID_ARGUMENT inside the message string (e.g. `Google Vertex AI Invalid
* Request: {"error":{"code":400,"status":"INVALID_ARGUMENT", …}}`), so the
* object-level status check misses it and the fallback orchestrator keeps
* retrying the identical, malformed payload on every other provider — they
* reject it the same way. A 400 means the request itself is bad, so retrying is
* pointless regardless of provider. Matches only unambiguous markers to avoid
* misclassifying transient (5xx/429) failures.
*/
export declare function isDeterministicClientErrorMessage(message: string): boolean;