This prompt is designed for a single, critical job inside a document ingestion router: classifying a page that has already been flagged as containing zero extractable text characters. The OCR engine has returned an empty string, and the system must decide what to do next. The prompt's job is not to describe the image in freeform prose but to produce a structured routing decision. It must classify the image type (e.g., photograph, chart, blank page, corrupted scan), extract any content hints visible in the visual features (such as chart titles, axis labels, or handwritten notes), and recommend a processing path—such as sending the page to a specialized diagram extractor, flagging it for human review, or discarding it as a blank separator page. The ideal user is an ingestion pipeline engineer who needs a deterministic, testable classification step before downstream extraction.
Prompt
Image-Only Page Triage and Routing Prompt Template

When to Use This Prompt
Defines the precise job, required context, and boundaries for the image-only page triage prompt inside a production document ingestion pipeline.
Use this prompt only when two preconditions are met: the page has been confirmed to have zero extractable text by the OCR engine, and a multimodal model with vision capabilities is available for the classification call. Do not use this prompt as a general-purpose image describer or for pages that contain even a small amount of machine-readable text—those pages should follow the standard text extraction path. The prompt assumes the image is passed as a base64-encoded data URL or a cloud storage reference that the model can access. It also assumes that the routing taxonomy (the list of valid image types and processing paths) is defined by your pipeline architecture and supplied via the [ROUTING_TAXONOMY] placeholder. Without a clear taxonomy, the model will invent categories that don't map to your downstream handlers.
The primary failure mode to avoid is misrouting a page that actually contains text but was missed by OCR—for example, a page with white text on a dark background or very small font sizes. The prompt must include explicit instructions to check for any text-like visual features and to flag pages where text may be present but unreadable by the OCR engine. A secondary failure mode is treating every image-only page as requiring expensive human review; the prompt should distinguish between blank pages (which can be safely discarded), standard image types (which can be routed to automated processors), and genuinely ambiguous cases (which should be queued for human review). Before deploying, test the prompt against a golden set of known image-only pages including blank pages, photographs, charts, diagrams, corrupted scans, and pages with hidden or unusual text rendering.
Use Case Fit
This prompt is designed for ingestion routers that must decide what to do with a page when no extractable text exists. It works best as a deterministic pre-filter before extraction pipelines and fails when asked to perform the extraction itself.
Good Fit: Pre-Extraction Triage
Use when: a page returns zero or near-zero extractable text from OCR or digital text extraction. Guardrail: Run this prompt before any extraction prompt to route the page to the correct downstream processor (OCR enhancement, handwriting recognition, or human review).
Bad Fit: Direct Text Extraction
Avoid when: you need the actual text content of the image. This prompt classifies and routes; it does not transcribe. Guardrail: Chain this prompt's output to a dedicated extraction prompt (e.g., handwriting extraction or OCR cleanup) rather than asking it to do both jobs.
Required Inputs
Requires: the raw image bytes or a high-resolution page render, plus any available metadata (page number, document type, neighboring page text). Guardrail: If metadata is missing, the prompt should still function but must flag lower confidence in its classification.
Operational Risk: Text-as-Image Misrouting
Risk: pages with rendered text (scanned PDFs, screenshots of documents) may be classified as 'no text' if OCR wasn't attempted first. Guardrail: Always run a lightweight OCR pass before this prompt. Route only pages with confirmed zero extractable characters to this triage step.
Operational Risk: Blank Page False Positives
Risk: pages with very faint watermarks, stamps, or marginalia may be classified as blank, losing metadata. Guardrail: Include a 'marginal content' category in your classification schema and set a low threshold for routing to human review when confidence is below 90%.
Variant: Multi-Page Context
Use when: you need to disambiguate an image-only page by looking at surrounding pages. Guardrail: Provide the text of the preceding and following pages as additional context. This reduces misclassification of chapter-start images or full-page figures as blank or unprocessable.
Copy-Ready Prompt Template
A reusable prompt for classifying image-only pages and producing a routing decision with confidence, content hints, and recommended processing path.
The following template is designed to be dropped into an ingestion router that encounters pages with no extractable text. It forces the model to reason about visual features, classify the page type, and recommend a concrete downstream action. The square-bracket placeholders let you adapt the prompt to your specific document domain, risk tolerance, and available processing paths without rewriting the core logic.
textYou are a document ingestion router. You receive pages that contain no extractable text. Your job is to classify the page, describe what you see, and recommend a processing path. ## INPUT [IMAGE_PAGE] ## CONTEXT Document type: [DOCUMENT_TYPE] Expected content domain: [DOMAIN] Available processing paths: [PROCESSING_PATHS] ## INSTRUCTIONS 1. Determine if the page is truly blank or contains visual content. 2. If the page contains visual content, classify it into one of the following types: - photograph - chart_or_graph - diagram_or_schematic - scanned_text_as_image - handwritten_content - form_with_handwriting - stamp_seal_or_watermark - other_visual_content 3. For non-blank pages, provide a brief content hint describing what you see (1-2 sentences). 4. Recommend a processing path from the available list. If none fit, recommend "human_review". 5. Assign a confidence score from 0.0 to 1.0 for your classification. ## OUTPUT_SCHEMA Return ONLY valid JSON with this structure: { "is_blank": boolean, "classification": string | null, "content_hint": string | null, "recommended_path": string, "confidence": number, "flags": string[] } ## CONSTRAINTS - If is_blank is true, classification and content_hint must be null. - If the page appears to contain text rendered as an image, set classification to "scanned_text_as_image" and add "requires_ocr" to flags. - If you cannot determine the content with confidence above 0.5, set recommended_path to "human_review". - Do not hallucinate text content from blurry or illegible regions. - For pages with multiple content types, choose the dominant type and note secondary types in flags. ## EXAMPLES [FEW_SHOT_EXAMPLES] ## RISK_LEVEL [RISK_LEVEL]
To adapt this template, replace the placeholders with your specific context. [PROCESSING_PATHS] should list the actual downstream queues or pipelines available in your system, such as ["ocr_pipeline", "image_analysis", "human_review", "archive"]. [FEW_SHOT_EXAMPLES] should include 2-4 annotated examples showing correct classification and routing decisions for pages typical in your document corpus. [RISK_LEVEL] controls how conservative the routing should be: for high-risk domains like healthcare or legal, add explicit instructions to route any uncertain classification to human review and set a higher confidence threshold.
Before deploying, validate that the output JSON matches the schema exactly. Common failures include returning classification as an empty string instead of null for blank pages, or omitting the flags array. Add a post-processing validator that rejects malformed outputs and triggers a retry with the error message appended to the prompt. For high-stakes ingestion pipelines, log every routing decision with the page image, model response, and final processing path for audit and eval regression testing.
Prompt Variables
Required and optional inputs for the Image-Only Page Triage and Routing prompt. Each placeholder must be populated before the prompt is sent to the model. Validation notes describe how to check that the input is well-formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[PAGE_IMAGE_BASE64] | Base64-encoded representation of the single document page to triage | iVBORw0KGgoAAAANSUhEUgAA... | Must be a valid base64 string. Decoded size should be under 20MB. Check that the string is not empty and decodes without error. |
[PAGE_NUMBER] | Sequential page number within the parent document, used for logging and routing context | 42 | Must be a positive integer. If unknown, use null. Validate that the value is not negative or zero. |
[DOCUMENT_ID] | Unique identifier for the parent document, used for traceability in routing logs | doc_2024-11-15_invoice_scan_001 | Must be a non-empty string. Should match the document ID used in upstream ingestion systems for audit trail consistency. |
[PREVIOUS_PAGE_CLASSIFICATION] | Classification of the immediately preceding page, used to detect context switches | digital_text | Must be one of the allowed page classification labels from the pipeline taxonomy. Use null for the first page of a document. Validate against the allowed enum. |
[ROUTING_TARGETS] | List of available downstream processing pipelines with descriptions, used to select the correct route | ['ocr_pipeline', 'image_analysis_pipeline', 'blank_page_handler', 'manual_review_queue'] | Must be a non-empty array of strings. Each target should correspond to an active pipeline endpoint. Validate that the list is parseable JSON and contains at least one entry. |
[BLANK_PAGE_THRESHOLD] | Minimum percentage of white or near-white pixels to classify a page as blank | 0.98 | Must be a float between 0.0 and 1.0. Validate range. If not provided, the prompt should use a documented default of 0.95. |
[ALLOWED_IMAGE_TYPES] | Enum of image type classifications the model is permitted to use in its output | ['photograph', 'scanned_document', 'chart_or_graph', 'screenshot', 'blank', 'unknown'] | Must be a non-empty array of strings. Validate that the output classification matches one of these values. If the model returns an unlisted type, the routing decision should fall back to manual_review_queue. |
Implementation Harness Notes
How to wire the image-only page triage prompt into a production document ingestion pipeline with validation, retries, and routing logic.
This prompt operates as a pre-extraction router inside a document processing pipeline. It receives a page image (or a reference to one) and returns a structured routing decision. The application layer is responsible for image delivery, output validation, and downstream dispatch. Do not send raw base64-encoded images inline unless your model and context window support it reliably; prefer passing a cloud storage URI or a pre-signed URL that the model's vision capabilities can access. The prompt expects a single page at a time. For multi-page documents, call this prompt once per page and aggregate the routing decisions before dispatching the document to the appropriate processing path.
Validation and retry logic is critical because misrouting a page can silently corrupt downstream extraction. After receiving the JSON response, validate that the routing_decision field matches one of your allowed enum values (e.g., ocr_pipeline, human_review, discard_blank, image_analysis). If the confidence score falls below your threshold (start with 0.7 and calibrate based on production data), route to human review. If the model returns malformed JSON, retry once with a repair prompt that includes the raw output and the expected schema. If the retry also fails, log the failure and route the page to a manual triage queue. For high-volume pipelines, implement a circuit breaker that halts automated routing if the error rate exceeds 5% in a rolling window.
Model selection matters for this task. Vision-capable models (GPT-4o, Claude 3.5 Sonnet, Gemini 1.5 Pro) are required. Do not use text-only models for image triage. If cost is a concern, consider a two-tier approach: use a smaller, faster vision model for blank-page detection and obvious text-as-image classification, then escalate ambiguous pages to a more capable model. Logging should capture the page identifier, the model's routing decision, confidence score, detected image type, content hints, and the full prompt and response for audit. This log becomes essential when debugging misrouted documents or calibrating confidence thresholds.
Downstream dispatch should be implemented as a deterministic switch statement in your application code, not as another LLM call. Map each routing_decision value to a specific pipeline function: ocr_pipeline sends the page to your OCR engine, human_review places it in a review queue with the content hints attached, discard_blank removes the page from processing and logs the action, and image_analysis routes to a vision model for detailed extraction. Never trust the model's routing label to directly trigger destructive actions (like deletion) without application-layer confirmation. For pages classified as text_as_image, verify that the page truly contains no extractable text before routing to OCR; a common failure mode is the model misclassifying pages with embedded text layers as image-only.
Expected Output Contract
Define the exact shape, types, and validation rules for the routing decision produced by the Image-Only Page Triage prompt. Use this contract to build downstream parsers and quality gates.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
routing_decision | string (enum) | Must be one of: 'OCR_RECOMMENDED', 'HUMAN_REVIEW', 'DISCARD_BLANK', 'DISCARD_NON_DOCUMENT', 'ROUTE_TO_ALT_PIPELINE' | |
image_type_classification | string (enum) | Must be one of: 'PHOTOGRAPH', 'SCANNED_DOCUMENT', 'SCREENSHOT', 'CHART_OR_DIAGRAM', 'BLANK_PAGE', 'UNKNOWN' | |
content_hints | array of strings | Each string must be a short, discrete visual feature observed (e.g., 'handwriting', 'faces', 'bar_chart'). Array must not be empty unless image_type is 'BLANK_PAGE'. | |
confidence_score | number | Must be a float between 0.0 and 1.0. A score below [CONFIDENCE_THRESHOLD] must force routing_decision to 'HUMAN_REVIEW'. | |
recommended_processing_path | string | Must be a valid pipeline identifier matching the system config (e.g., 'ocr_v2', 'alt_text_extraction', 'manual_review_queue'). Cannot be null. | |
rationale | string | A concise, natural language explanation of the decision. Must reference specific visual features from content_hints. Cannot be an empty string. | |
blank_page_detected | boolean | If true, routing_decision must be 'DISCARD_BLANK' and content_hints must be empty. If false, content_hints must not be empty. |
Common Failure Modes
What breaks first when triaging image-only pages and how to prevent misrouting, blank-page confusion, and text-as-image failures before they reach downstream extraction.
Text-as-Image Misclassification
What to watch: Pages containing rendered text saved as images (scanned PDFs, faxes, screenshots) are classified as non-text and routed away from OCR pipelines. The model sees visual text but the triage prompt may not instruct it to distinguish rendered text from photographs. Guardrail: Add explicit instruction to check for visible text characters in the image before classifying. Require the model to report whether text is present visually, even if no machine-readable text layer exists. Test with screenshots of documents, faxed pages, and text-heavy infographics.
Blank Page False Positives
What to watch: Near-blank pages with faint watermarks, scanner noise, or marginal artifacts are classified as content-bearing and routed to extraction, producing garbage output. Conversely, intentionally blank pages with printed 'This page intentionally left blank' are misclassified as empty. Guardrail: Set a minimum content threshold in the prompt. Require the model to distinguish between scanner artifacts and intentional marks. Include explicit handling for 'intentionally blank' boilerplate text. Test with degraded blank pages and intentionally blank pages with printed notices.
Photograph vs. Document Confusion
What to watch: Photographs embedded in documents (product photos in manuals, ID photos on forms) are classified as the primary page type, routing the entire page to an image-only pipeline that discards surrounding text. Guardrail: Instruct the model to identify the dominant content type of the page, not the presence of any image. Require classification based on page purpose, not pixel content alone. Test with mixed-content pages: forms with photo fields, manuals with product images, reports with embedded charts.
Routing Decision Without Confidence
What to watch: The model returns a routing label without indicating uncertainty, causing ambiguous pages to silently follow the wrong path. A page with faint handwriting and machine text gets routed to digital extraction, losing the handwritten content. Guardrail: Require a confidence score with every routing decision. Set a threshold below which pages are routed to a human review queue or a multi-engine processing path. Test with deliberately ambiguous pages: mixed handwriting and print, low-contrast scans, pages with both text and complex diagrams.
Multi-Page Context Blindness
What to watch: The triage prompt processes each page independently, missing that page 3 of a scanned contract belongs to the same document as pages 1-2, which were classified as text. The isolated page gets routed differently, breaking document continuity. Guardrail: Pass document-level context when available. Include the preceding page's classification and the document's overall type in the prompt. Test with multi-page documents where some pages are image-only and others contain extractable text.
Overly Granular Type Proliferation
What to watch: The prompt allows too many image type categories, and the model inconsistently assigns similar pages to different types, fragmenting downstream processing and making pipeline behavior unpredictable. Guardrail: Limit the classification taxonomy to 4-6 routing-relevant categories that map directly to distinct processing paths. Validate that each category triggers a different downstream action. Test with a representative sample to measure inter-rater consistency across similar pages.
Evaluation Rubric
Criteria for evaluating the quality of the Image-Only Page Triage and Routing Prompt before deploying it to a production ingestion pipeline. Each criterion includes a pass standard, a failure signal, and a test method.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Routing Decision Accuracy | Correctly classifies text-as-image, blank, photo, chart, and true-scanned-document pages with >95% accuracy on a 100-page golden dataset. | Misclassifies a text-as-image page as a photo, or routes a blank page to the OCR pipeline. | Run prompt against a labeled golden dataset of 100 pages. Calculate precision and recall for each class. Flag any class with F1 score below 0.95. |
Blank Page Detection | Identifies 100% of blank or near-blank pages (e.g., pages with only a single speck or faint scanner noise) and sets | Routes a blank page to the | Create a test set of 20 blank and near-blank images. Assert that |
Text-as-Image Misrouting Prevention | Flags any page containing rendered text (screenshots, diagrams with labels, scanned text) with | Sets | Use a test set of 30 text-as-image pages. Assert that |
Image Type Classification Granularity | Correctly distinguishes between | Classifies a photo of a product as a | Use a balanced test set with 10 examples of each type. Assert that |
Content Hints Completeness | Populates | Returns an empty or null | Run prompt against 50 diverse non-blank images. Assert that |
Confidence Score Calibration | Assigns a | Assigns a confidence score of 0.99 to an ambiguous, low-quality scan that is misrouted. | Bin predictions by confidence decile. Plot accuracy per bin. The highest decile should have near-perfect accuracy. Flag any systematic overconfidence. |
Output Schema Compliance | Returns valid JSON that strictly conforms to the defined schema: | Missing | Validate every output against the JSON Schema using a programmatic validator. A single schema violation in a 100-page run is a failure. |
Processing Path Consistency | The | Routing decision is | Define a mapping table of valid decision-to-path pairs. Assert that every output pair is in the allowed set. Flag any inconsistency. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base prompt and a simple JSON schema. Use a single model call with no retries. Accept the raw output and log it for review. Focus on getting the routing decision and image type classification right before adding pipeline integration.
codeYou are a document page triage agent. Analyze the provided image of a document page and return a JSON routing decision. Image: [IMAGE] Return JSON with: - "has_text": boolean - "image_type": string (one of: "photo", "chart", "diagram", "scanned_text", "blank", "unknown") - "content_hints": string (brief visual description) - "recommended_path": string (one of: "ocr_pipeline", "image_analysis", "skip", "human_review")
Watch for
- Missing schema checks on the output
- Overly broad
image_typeclassifications - Blank pages classified as
unknowninstead ofblank - No confidence scores to flag ambiguous cases

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us