/** * 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(operation: () => Promise, config?: Partial): Promise; /** * RAG Retry Handler class for more complex retry scenarios */ export declare class RAGRetryHandler { private config; constructor(config?: Partial); /** * Execute an operation with retry logic */ executeWithRetry(operation: () => Promise, maxRetries?: number): Promise; /** * Execute multiple operations with retry, collecting results * Returns successful results and failed operations with their errors */ executeBatch(items: T[], operation: (item: T, index: number) => Promise, 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): void; } /** * Specialized retry handler for embedding operations */ export declare class EmbeddingRetryHandler extends RAGRetryHandler { constructor(config?: Partial); } /** * Specialized retry handler for vector store operations */ export declare class VectorStoreRetryHandler extends RAGRetryHandler { constructor(config?: Partial); } /** * Specialized retry handler for metadata extraction */ export declare class MetadataExtractionRetryHandler extends RAGRetryHandler { constructor(config?: Partial); } /** * Create a retry handler with the core infrastructure withRetry */ export declare function createRetryHandler(config?: Partial): (operation: () => Promise) => Promise; /** * Global retry handlers for common RAG operations */ export declare const embeddingRetryHandler: EmbeddingRetryHandler; export declare const vectorStoreRetryHandler: VectorStoreRetryHandler; export declare const metadataExtractionRetryHandler: MetadataExtractionRetryHandler;