@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
96 lines (95 loc) • 3.2 kB
TypeScript
/**
* RAG Retry Handler
*
* Provides retry logic with exponential backoff and jitter
* specifically designed for RAG operations including embeddings,
* vector queries, and LLM-based extraction.
*/
import type { RAGRetryConfig } from "../../types/index.js";
/**
* Default retry configuration
*/
export declare const DEFAULT_RAG_RETRY_CONFIG: RAGRetryConfig;
/**
* Check if an error is retryable based on configuration
*/
export declare function isRetryable(error: unknown, config?: RAGRetryConfig): boolean;
/**
* Execute a RAG operation with retry logic
*
* Implements exponential backoff with jitter to prevent thundering herd.
* Only retries on errors that are considered retryable.
*
* @param operation - Async operation to execute with retries
* @param config - Partial retry configuration (merged with defaults)
* @returns Result of the operation
* @throws Last error if all retry attempts fail
*/
export declare function withRAGRetry<T>(operation: () => Promise<T>, config?: Partial<RAGRetryConfig>): Promise<T>;
/**
* RAG Retry Handler class for more complex retry scenarios
*/
export declare class RAGRetryHandler {
private config;
constructor(config?: Partial<RAGRetryConfig>);
/**
* Execute an operation with retry logic
*/
executeWithRetry<T>(operation: () => Promise<T>, maxRetries?: number): Promise<T>;
/**
* Execute multiple operations with retry, collecting results
* Returns successful results and failed operations with their errors
*/
executeBatch<T, R>(items: T[], operation: (item: T, index: number) => Promise<R>, options?: {
concurrency?: number;
continueOnError?: boolean;
}): Promise<{
successful: Array<{
item: T;
result: R;
index: number;
}>;
failed: Array<{
item: T;
error: Error;
index: number;
}>;
successRate: number;
}>;
/**
* Get current configuration
*/
getConfig(): RAGRetryConfig;
/**
* Update configuration
*/
updateConfig(config: Partial<RAGRetryConfig>): void;
}
/**
* Specialized retry handler for embedding operations
*/
export declare class EmbeddingRetryHandler extends RAGRetryHandler {
constructor(config?: Partial<RAGRetryConfig>);
}
/**
* Specialized retry handler for vector store operations
*/
export declare class VectorStoreRetryHandler extends RAGRetryHandler {
constructor(config?: Partial<RAGRetryConfig>);
}
/**
* Specialized retry handler for metadata extraction
*/
export declare class MetadataExtractionRetryHandler extends RAGRetryHandler {
constructor(config?: Partial<RAGRetryConfig>);
}
/**
* Create a retry handler with the core infrastructure withRetry
*/
export declare function createRetryHandler(config?: Partial<RAGRetryConfig>): (operation: () => Promise<unknown>) => Promise<unknown>;
/**
* Global retry handlers for common RAG operations
*/
export declare const embeddingRetryHandler: EmbeddingRetryHandler;
export declare const vectorStoreRetryHandler: VectorStoreRetryHandler;
export declare const metadataExtractionRetryHandler: MetadataExtractionRetryHandler;