/** * OCR Provider Interfaces * Provides optical character recognition from images and PDFs */ export interface OCRResult { /** Extracted text content */ text: string; /** Confidence score (0-1) if available */ confidence?: number; /** Language detected */ language?: string; /** Word-level details if available */ words?: OCRWord[]; /** Line-level details if available */ lines?: OCRLine[]; /** Block-level details if available */ blocks?: OCRBlock[]; } export interface OCRWord { /** Word text */ text: string; /** Confidence score (0-1) */ confidence: number; /** Bounding box coordinates */ boundingBox?: BoundingBox; } export interface OCRLine { /** Line text */ text: string; /** Confidence score (0-1) */ confidence?: number; /** Words in this line */ words?: OCRWord[]; /** Bounding box coordinates */ boundingBox?: BoundingBox; } export interface OCRBlock { /** Block text */ text: string; /** Block type (paragraph, heading, etc.) */ type?: string; /** Confidence score (0-1) */ confidence?: number; /** Lines in this block */ lines?: OCRLine[]; /** Bounding box coordinates */ boundingBox?: BoundingBox; } export interface BoundingBox { x: number; y: number; width: number; height: number; } export interface OCRConfig { /** Language hints (e.g., 'eng', 'fra', 'deu') */ languages?: string[]; /** OCR engine mode (if applicable) */ engineMode?: number; /** Page segmentation mode (if applicable) */ pageSegMode?: number; /** Custom configuration options */ customConfig?: Record; } /** * OCR Provider types */ export declare enum OCRProvider { TESSERACT = "tesseract", GOOGLE_VISION = "google-vision", AZURE_COMPUTER_VISION = "azure-computer-vision" } /** * Base OCR Provider interface */ export interface IOCRProvider { /** Provider name */ readonly name: string; /** Check if provider is available (dependencies installed) */ isAvailable(): Promise; /** * Extract text from image buffer */ extractText(image: Buffer, config?: OCRConfig): Promise; /** * Extract text from image file */ extractTextFromFile(imagePath: string, config?: OCRConfig): Promise; /** * Extract text from multiple images */ extractTextFromImages(images: Buffer[], config?: OCRConfig): Promise; } /** * OCR Fallback configuration */ export interface OCRFallbackConfig { /** Enable OCR fallback */ enabled: boolean; /** OCR provider to use */ provider: OCRProvider | string; /** When to use OCR fallback */ trigger?: 'always' | 'on-error' | 'low-confidence'; /** Minimum confidence threshold for vision model (0-1) */ minConfidenceThreshold?: number; /** OCR configuration */ ocrConfig?: OCRConfig; /** Combine OCR with vision model results */ combineResults?: boolean; } /** * Combined result from vision model + OCR */ export interface CombinedResult { /** Vision model result */ visionResult: string; /** OCR result */ ocrResult: OCRResult; /** Combined/merged text */ combinedText: string; /** Source used: 'vision', 'ocr', or 'combined' */ source: 'vision' | 'ocr' | 'combined'; } //# sourceMappingURL=ocr-interfaces.d.ts.map