Slug: quality-gate Version: 1.0.0 Infer: Yes

Overview

Quality Gate Model

The Quality Gate model analyzes documents to detect quality issues that might interfere with downstream document processing. Currently, it specializes in detecting handwritten numeric values (such as invoice amounts, balances, etc.) that might require manual processing.

How It Works

  1. The model converts the input document to grayscale to optimize handwriting detection
  2. It uses AI to identify specific document types based on content and layout
  3. For qualifying documents, it analyzes each page to detect handwritten numeric values
  4. Documents with handwriting are labeled accordingly, allowing for special handling

Options Configuration

OptionDescription
should_check_for_handwritingEnables or disables handwriting detection (default: true)
included_document_typesDocument types to check for handwriting (e.g., “invoice, receipt”)
excluded_document_typesDocument types to exempt from handwriting checks (e.g., “bill of lading, weight slip”)
limited_to_first_pageWhen true, only checks the first page for handwriting (default: false)
handwriting_detector_modelThe AI model used for handwriting detection (default: “gemini-2.0-flash-001”)

Process Flow

Example Usage

The Quality Gate model is especially useful for:

  • Automated document processing pipelines that require high-quality machine-readable content
  • Identifying documents that need manual review versus those that can be fully automated
  • Creating quality control steps before document extraction
  • Filtering invoices with handwritten amounts that might lead to extraction errors

Configuration Example

To check only invoices and receipts for handwriting:

should_check_for_handwriting: true
included_document_types: "invoice, receipt"
excluded_document_types: "packing slip, bill of lading"
limited_to_first_page: false
handwriting_detector_model: "gemini-2.0-flash-001"

Handwriting Detection Logic

The handwriting detection algorithm:

  • Focuses specifically on numeric values (amounts, quantities, totals)
  • Ignores dates, times, and non-numeric handwritten text
  • Verifies multiple handwritten numeric values or the same value in multiple places
  • Uses a two-pass verification process to reduce false positives

Inference Options

The following options can be configured when using this model for inference:

NameLabelTypeDescriptionDefaultRequired
should_check_for_handwritingShould Check For HandwritingbooleanWhether to check for handwriting related to numeric data (e.g. invoice amounts, balances, or amounts paidTrueNo
included_document_typesIncluded Document TypesstringThe document types to check for handwriting (e.g. invoice, receipt, etc.)-Yes
excluded_document_typesExcluded Document TypesstringThe document types to specifically exclude from handwriting checking (e.g. bill of lading, weight slip, etc.)-No
limited_to_first_pageLimit to First PagebooleanWhether to limit the handwriting detection to just the first pageFalseNo
handwriting_detector_modelHandwriting Detector ModelstringThe model to use to identify pages with handwritten billing informationgemini-2.0-flash-001No

Model Details

  • Provider: Kodexa