Interface OCRResult

Result returned by performOCR.

interface OCRResult {
    text: string;
    confidence: number;
    tier: VisionTier;
    category?: string;
    provider: string;
    regions?: {
        text: string;
        bbox?: {
            x: number;
            y: number;
            width: number;
            height: number;
        };
        confidence: number;
    }[];
}

Properties

text: string

Extracted text content.

confidence: number

Overall confidence score (0 = no confidence, 1 = certain).

Which processing tier produced the winning result.

  • 'ocr' — PaddleOCR or Tesseract.js (fast, local, free).
  • 'handwriting' — TrOCR handwriting recognition (local).
  • 'document-ai' — Florence-2 document understanding (local).
  • 'cloud-vision' — Cloud LLM (GPT-4o, Claude, Gemini).
category?: string

Content category detected by the pipeline (e.g. 'printed-text').

provider: string

Provider name that produced the winning result (e.g. 'paddle', 'openai').

regions?: {
    text: string;
    bbox?: {
        x: number;
        y: number;
        width: number;
        height: number;
    };
    confidence: number;
}[]

Text regions with bounding boxes, when the winning tier provides spatial information. Not all tiers return region data.

Type declaration

  • text: string
  • Optional bbox?: {
        x: number;
        y: number;
        width: number;
        height: number;
    }
    • x: number
    • y: number
    • width: number
    • height: number
  • confidence: number