Prompt Details
Model
Chat - (gpt-5.6)
Token size
2,641
Example input
[
- Invoice
- Receipt
- Form
- Purchase Order
- Bill
- Statement
- Unknown
If unknown, classify it automatically.]: Invoice
[
Preserve:
- Line breaks
- Symbols
- Spacing
- OCR errors
- Repeated text
- Page separators]: TAX INVOlCE TECHNOVA ELECTRONlCS PVT. LTD. Shop No. 18, City Centre, Durgapur, West Bengal 713216 GSTIN: 19AABCT1234K1Z8 Ph: +91 98765 43210 lnvoice No: TN-INV-2026-00871 lnvoice Date: 02/09/2026 Due Date: 17/09/2026 PO No: PO-45821 BILL TO: ROYAL RETAIL MART 23 Benachity Road, Durgapur, WB 713213 GSTIN: 19AAECR5678P1Z4 ------------------------------------------------ Description Qty Rate Amount ------------------------------------------------ Wireless Mouse 2 749.50 1,499.00 USB Keybord 1 1,199.00 1,199.00 HDMl Cable 3 399.00 1,197.00 Laptop Stand 1 1,299.00 1,299.00 Sub Tota1 5,194.00 Discount 194.00 Taxab1e Amount 5,000.00 CGST @ 9% 450.00 SGST @ 9% 450.00 Grand Tota1 5,900.00 Paid 2,000.00 Ba1ance Due 3,900.00 Payment Method: UPI Currency: INR Thank you for your business.
[
- Invoice number
- Vendor
- Customer
- Date
- Tax
- Total
- Currency
- Line items
- Address
- Payment method]: Invoice number, Vendor, Customer, Invoice date, Due date, PO number, Vendor GSTIN, Customer GSTIN, Vendor phone, Line items, Subtotal, Discount, Taxable amount, CGST, SGST, Total, Paid amount, Balance due, Payment method, Currency
[
- Subtotal + tax = total
- Quantity Γ unit price = line total
- Required fields
- Allowed currencies
- Date constraints]: Subtotal = sum of line totals, Taxable amount = subtotal - discount, CGST + SGST = total tax, Taxable amount + total tax = total, Paid + balance due = total, Quantity Γ unit price = line total, Invoice date β€ due date, required fields must be present
[
- Country
- Business type
- Vendor format
- Expected schema
- Language
- Known abbreviations
- Document-specific rules ]: Country: India, Business type: electronics retailer/supplier, Language: English, GST invoice, currency should only be normalized to INR because the document explicitly states Currency: INR
Example output
PHASE 1 β DOCUMENT TYPE CLASSIFICATION
Document Type
Invoice
Confidence
π’ High
Supporting Evidence
TAX INVOlCE
lnvoice No
lnvoice Date
Due Date
BILL TO
Itemized product table
Subtotal
Discount
CGST and SGST
Grand Total
Payment Method
The document has multiple independent indicators of an invoice.
Result
Classification: Valid
---
PHASE 2 β OCR TEXT CLEANING
The OCR contains several obvious character substitutions.
Raw OCR Cleaned Value Reason
INVOlCE INVOICE l β I
ELECTRONlCS ELECTRONICS l β I
lnvoice No Invoice No OCR capitalization/substitution
lnvoice Date Invoice Date OCR substitution
Keybord Keyboard Obvious word corruption
HDMl HDMI OCR character substitution
Sub Tota1 Subtotal 1 β l
Taxab1e Amount Taxable Amount 1 β l
Grand Tota1 Grand Total 1 β l
Ba1ance Due Balance Due 1 β l
Important
The system should not blindly correct every suspicious character.
For example:
TN-INV-2026-00871
is preserved because the value is an invoice identifier and the digits are structurally valid.
Cleaning Result
π’ Cleaned successfully
---
PHASE 3 β DOCUMENT STRUCTURE RECONSTRUCTION
The OCR is already mostly ordered, but the logical business structure is reconstructed as follows:
DOCUMENT
β
βββ Header
β βββ Vendor Name
β βββ Vendor Address
β βββ Vendor GSTIN
β βββ Vendor Phone
β
βββ Document Metadata
β βββ Invoice Number
β βββ Invoice Date
β βββ Due Date
β βββ PO Number
β
βββ Customer
β βββ Customer Name
β βββ Customer Address
β βββ Customer GSTIN
β
βββ Line Items
β βββ Wireless Mouse
β βββ USB Keyboard
β βββ HDMI Cable
β βββ Laptop Stand
β
βββ Financial Section
β βββ Subtotal
β βββ Discount
β βββ Taxable Amount
β βββ CGST
β βββ SGST
β βββ Grand Total
β βββ Paid
β βββ Balance Due
β
βββ Payment
β βββ Payment Method
β βββ Currency
β
βββ Footer
βββ Thank-you message
Result
π’ Structure reconstructed successfully
---
PHASE 4 β FIELD DISCOVERY
Field Raw Value Normalized Value Confidence Status
Invoice Number TN-INV-2026-00871 TN-INV-2026-00871 π’ High β
Valid
Vendor TECHNOVA ELECTRONlCS PVT. LTD. TECHNOVA ELECTRONICS PVT. LTD. π’ High β
Valid
Customer ROYAL RETAIL MART ROYAL RETAIL MART π’ High β
Valid
Invoice Date 02/09/2026 2026-09-02 π’ High β
Valid
Due Date 17/09/2026 2026-09-17 π’ High β
Valid
PO Number PO-45821 PO-45821 π’ High β
Valid
Vendor GSTIN 19AABCT1234K1Z8 19AABCT1234K1Z8 π’ High β
Valid
Customer GSTIN 19AAECR5678P1Z4 19AAECR5678P1Z4 π’ High β
Valid
Vendor Phone +91 98765 43210 +919876543210 π’ High β
Valid
Payment Method UPI UPI π’ High β
Valid
Currency INR INR π’ High β
Valid
---
PHASE 5 β HEADER & ENTITY EXTRACTION
Vendor
Raw:
TECHNOVA ELECTRONlCS PVT. LTD.
Normalized:
TECHNOVA ELECTRONICS PVT. LTD.
Confidence: π’ High
Evidence: Appears in document header before GSTIN and phone number.
Vendor Address
Shop No. 18, City Centre, Durgapur, West Bengal 713216
Confidence: π’ High
Vendor GSTIN
19AABCT1234K1Z8
Confidence: π’ High
Vendor Phone
Raw:
+91 98765 43210
Normalized:
+919876543210
Confidence: π’ High
Customer
ROYAL RETAIL MART
Confidence: π’ High
Evidence: Appears immediately after BILL TO.
Customer GSTIN
19AAECR5678P1Z4
Confidence: π’ High
Invoice Number
TN-INV-2026-00871
Confidence: π’ High
PO Number
PO-45821
Confidence: π’ High
---
PHASE 6 β NUMBER & AMOUNT EXTRACTION
Extracted Financial Values
Field Raw Value Normalized
Subtotal 5,194.00 5194.00
Discount 194.00 194.00
Taxable Amount 5,000.00 5000.00
CGST 450.00 450.00
SGST 450.00 450.00
Grand Total 5,900.00 5900.00
Paid 2,000.00 2000.00
Balance Due 3,900.00 3900.00
Currency
Explicitly stated:
Currency: INR
Therefore:
Normalized currency: INR
No currency assumption was required.
---
PHASE 7 β LINE-ITEM & TABLE RECONSTRUCTION
Four line items are detected.
Item 1
Description: Wireless Mouse
Quantity: 2
Unit Price: 749.50
Line Total: 1,499.00
Validation:
2 Γ 749.50 = 1,499.00
β
Valid
---
Item 2
Raw Description: USB Keybord
Normalized Description: USB Keyboard
Quantity: 1
Unit Price: 1,199.00
Line Total: 1,199.00
Validation:
1 Γ 1,199.00 = 1,199.00
β
Valid
OCR correction:
Keybord β Keyboard
Confidence:
π’ High
---
Item 3
Raw Description: HDMl Cable
Normalized Description: HDMI Cable
Quantity: 3
Unit Price: 399.00
Line Total: 1,197.00
Validation:
3 Γ 399.00 = 1,197.00
β
Valid
---
Item 4
Description: Laptop Stand
Quantity: 1
Unit Price: 1,299.00
Line Total: 1,299.00
Validation:
1 Γ 1,299.00 = 1,299.00
β
Valid
---
PHASE 8 β VALUE NORMALIZATION
Dates
Raw:
02/09/2026
Normalized:
2026-09-02
Raw:
17/09/2026
Normalized:
2026-09-17
Currency
INR β INR
Amounts
5,194.00 β 5194.00
194.00 β 194.00
5,000.00 β 5000.00
5,900.00 β 5900.00
Phone
+91 98765 43210
β
+919876543210
Tax
CGST @ 9%
β
9.0%
SGST @ 9%
β
9.0%
Result
π’ Normalization successful
---
PHASE 9 β ENTITY & SEMANTIC DISAMBIGUATION
Several OCR substitutions require interpretation.
Case 1: INVOlCE
Possible interpretation:
INVOlCE
INVOICE
Context strongly supports:
INVOICE
π’ High confidence
---
Case 2: Keybord
Context:
USB Keybord
This is clearly intended to represent:
USB Keyboard
π’ High confidence
---
Case 3: HDMl
Context:
HDMl Cable
Common electronics terminology strongly supports:
HDMI Cable
π’ High confidence
---
Case 4: Tota1
Context:
Grand Tota1
The final 1 is interpreted as lowercase l.
Normalized:
Grand Total
π’ High confidence
---
Case 5: Financial numbers
No ambiguous numeric substitutions were found in the financial fields.
The numbers also pass independent arithmetic checks.
Therefore, no financial value needs human interpretation.
---
PHASE 10 β DATA VALIDATION
Check 1 β Quantity Γ Unit Price
Wireless Mouse:
2 Γ 749.50 = 1,499.00
β
Valid
USB Keyboard:
1 Γ 1,199.00 = 1,199.00
β
Valid
HDMI Cable:
3 Γ 399.00 = 1,197.00
β
Valid
Laptop Stand:
1 Γ 1,299.00 = 1,299.00
β
Valid
---
Check 2 β Subtotal
1,499 + 1,199 + 1,197 + 1,299
= 5,194
OCR subtotal:
5,194
β
Valid
---
Check 3 β Taxable Amount
Subtotal - Discount
5,194 - 194
= 5,000
OCR taxable amount:
5,000
β
Valid
---
Check 4 β CGST + SGST
450 + 450
= 900
Total tax:
900
β
Valid
---
Check 5 β Grand Total
Taxable Amount + Total Tax
5,000 + 900
= 5,900
OCR Grand Total:
5,900
β
Valid
---
Check 6 β Paid + Balance
2,000 + 3,900
= 5,900
Invoice Total:
5,900
β
Valid
---
Check 7 β Date Consistency
Invoice Date:
2026-09-02
Due Date:
2026-09-17
Invoice Date β€ Due Date
β
Valid
---
PHASE 11 β CROSS-FIELD CONSISTENCY
Relationship 1
Subtotal - Discount = Taxable Amount
5,194 - 194 = 5,000
β
Passed
Relationship 2
CGST + SGST = Total Tax
450 + 450 = 900
β
Passed
Relationship 3
Taxable Amount + Tax = Total
5,000 + 900 = 5,900
β
Passed
Relationship 4
Paid + Balance = Total
2,000 + 3,900 = 5,900
β
Passed
Relationship 5
Quantity Γ Unit Price = Line Total
All four line items pass.
β
Passed
Duplicate Field Check
No conflicting duplicate values detected.
β
Passed
---
PHASE 12 β CONFIDENCE SCORING
Overall Confidence
π’ High
Category Confidence
Document Type π’ High
Vendor π’ High
Customer π’ High
Invoice Number π’ High
Dates π’ High
GSTINs π’ High
PO Number π’ High
Phone π’ High
Line Items π’ High
Financial Values π’ High
Currency π’ High
Payment Method π’ High
Why High?
Clear document labels
Strong field-to-value proximity
Clear invoice structure
All arithmetic checks pass
Currency explicitly provided
OCR errors are recognizable and contextually resolvable
No conflicting duplicate values
---
PHASE 13 β ERROR & ANOMALY DETECTION
Detected OCR Anomalies
1. INVOlCE β INVOICE
2. ELECTRONlCS β ELECTRONICS
3. lnvoice β Invoice
4. Keybord β Keyboard
5. HDMl β HDMI
6. Sub Tota1 β Subtotal
7. Taxab1e β Taxable
8. Grand Tota1 β Grand Total
9. Ba1ance β Balance
Missing Fields
None among the requested fields.
Contradictory Values
None.
Suspicious Totals
None.
Broken Line Items
None.
Impossible Values
None.
---
PHASE 14 β EXTRACTION QUALITY AUDIT
Requested Field Coverage
20/20 requested fields attempted and extracted.
OCR Correction Quality
π’ High
All corrected words have strong contextual evidence.
Line-Item Reconstruction
π’ High
All four rows have valid quantity Γ price calculations.
Financial Validation
π’ Passed
All major financial relationships are mathematically consistent.
Uncertainty Handling
π’ Passed
No ambiguous field was silently converted into a definitive value without supporting evidence.
Invention Check
π’ Passed
No unsupported business information was added.
Missing Fields
None
Low-Confidence Fields
None
Validation Failures
None
Extraction Quality Score
99/100
The one-point deduction is due to the presence of multiple OCR corruptions requiring normalization, even though they were successfully resolved.
---
PHASE 15 β OUTPUT SCHEMA GENERATION
The final schema should separate:
Document metadata
Vendor
Customer
Line items
Financial information
Payment information
Validation
Confidence
Anomalies
Review requirements
This makes the result suitable for:
API responses
Databases
ETL pipelines
Accounting systems
ERP integration
Automated invoice processing
Schema Design
document
βββ type
βββ extraction_status
βββ confidence
βββ quality_score
vendor
βββ name
βββ address
βββ gstin
βββ phone
customer
βββ name
βββ address
βββ gstin
metadata
βββ invoice_number
βββ invoice_date
βββ due_date
βββ po_number
line_items[]
βββ description
βββ quantity
βββ unit_price
βββ line_total
βββ confidence
βββ validation_status
financial_summary
βββ subtotal
βββ discount
βββ taxable_amount
βββ cgst
βββ sgst
βββ total_tax
βββ total
βββ paid
βββ balance_due
βββ currency
payment
βββ method
validation
βββ passed_checks
βββ failed_checks
βββ warnings
βββ uncertain_fields
review_required[]
anomalies[]
---
PHASE 16 β FINAL STRUCTURED EXTRACTION
π DOCUMENT SUMMARY
Document Type: Invoice
Extraction Status: Successfully Extracted
Overall Confidence: π’ High
Extraction Quality Score: 99/100
π― EXTRACTED FIELDS
Field Raw OCR Normalized Status
Invoice Number TN-INV-2026-00871 TN-INV-2026-00871 β
Valid
Vendor TECHNOVA ELECTRONlCS PVT. LTD. TECHNOVA ELECTRONICS PVT. LTD. β
Valid
Customer ROYAL RETAIL MART ROYAL RETAIL MART β
Valid
Invoice Date 02/09/2026 2026-09-02 β
Valid
Due Date 17/09/2026 2026-09-17 β
Valid
PO Number PO-45821 PO-45821 β
Valid
Vendor GSTIN 19AABCT1234K1Z8 19AABCT1234K1Z8 β
Valid
Customer GSTIN 19AAECR5678P1Z4 19AAECR5678P1Z4 β
Valid
Vendor Phone +91 98765 43210 +919876543210 β
Valid
Payment Method UPI UPI β
Valid
Currency INR INR β
Valid
π¦ LINE ITEMS
Description Qty Unit Price Line Total Confidence
Wireless Mouse 2 749.50 1499.00 π’ High
USB Keyboard 1 1199.00 1199.00 π’ High
HDMI Cable 3 399.00 1197.00 π’ High
Laptop Stand 1 1299.00 1299.00 π’ High
π° FINANCIAL SUMMARY
Subtotal: 5194.00
Discount: 194.00
Taxable Amount: 5000.00
CGST: 9% = 450.00
SGST: 9% = 450.00
Total Tax: 900.00
Shipping/Fees: null
Total: 5900.00
Paid: 2000.00
Balance: 3900.00
Currency: INR
π§ͺ VALIDATION RESULTS
Passed Checks
β
All required fields extracted
β
All four line-item calculations
β
Subtotal calculation
β
Discount calculation
β
Taxable amount calculation
β
CGST + SGST calculation
β
Grand total calculation
β
Paid + balance calculation
β
Invoice date and due date consistency
β
Currency consistency
β
No conflicting duplicate values
Failed Checks
None
Warnings
β οΈ Multiple OCR character substitutions detected.
β οΈ Product names required contextual OCR correction.
Uncertain Fields
None
β οΈ REVIEW REQUIRED
No human verification required.
All requested fields have sufficient evidence and pass cross-field validation.
π¦ FINAL MACHINE-READABLE JSON
{
"document": {
"type": "invoice",
"extraction_status": "success",
"classification_confidence": "high",
"overall_confidence": "high",
"quality_score": 99
},
"vendor": {
"name": {
"raw": "TECHNOVA ELECTRONlCS PVT. LTD.",
"normalized": "TECHNOVA ELECTRONICS PVT. LTD.",
"confidence": "high",
"status": "valid"
},
"address": "Shop No. 18, City Centre, Durgapur, West Bengal 713216",
"gstin": "19AABCT1234K1Z8",
"phone": "+919876543210"
},
"customer": {
"name": "ROYAL RETAIL MART",
"address": "23 Benachity Road, Durgapur, WB 713213",
"gstin": "19AAECR5678P1Z4"
},
"metadata": {
"invoice_number": "TN-INV-2026-00871",
"invoice_date": "2026-09-02",
"due_date": "2026-09-17",
"po_number": "PO-45821"
},
"line_items": [
{
"description": {
"raw": "Wireless Mouse",
"normalized": "Wireless Mouse"
},
"quantity": 2,
"unit_price": 749.50,
"line_total": 1499.00,
"confidence": "high",
"validation_status": "valid"
},
{
"description": {
"raw": "USB Keybord",
"normalized": "USB Keyboard"
},
"quantity": 1,
"unit_price": 1199.00,
"line_total": 1199.00,
"confidence": "high",
"validation_status": "valid",
"ocr_correction": "Keybord -> Keyboard"
},
{
"description": {
"raw": "HDMl Cable",
"normalized": "HDMI Cable"
},
"quantity": 3,
"unit_price": 399.00,
"line_total": 1197.00,
"confidence": "high",
"validation_status": "valid",
"ocr_correction": "HDMl -> HDMI"
},
{
"description": {
"raw": "Laptop Stand",
"normalized": "Laptop Stand"
},
"quantity": 1,
"unit_price": 1299.00,
"line_total": 1299.00,
"confidence": "high",
"validation_status": "valid"
}
],
"financial_summary": {
"subtotal": 5194.00,
"discount": 194.00,
"taxable_amount": 5000.00,
"cgst": {
"rate": 9.0,
"amount": 450.00
},
"sgst": {
"rate": 9.0,
"amount": 450.00
},
"total_tax": 900.00,
"shipping_and_fees": null,
"total": 5900.00,
"paid": 2000.00,
"balance_due": 3900.00,
"currency": "INR"
},
"payment": {
"method": "UPI"
},
"validation": {
"status": "passed",
"passed_checks": [
"Required fields present",
"Quantity multiplied by unit price equals line total",
"Subtotal equals sum of line totals",
"Taxable amount equals subtotal minus discount",
"CGST plus SGST equals total tax",
"Taxable amount plus total tax equals total",
"Paid amount plus balance due equals total",
"Invoice date is before due date",
"Currency is explicitly supported by document evidence"
],
"failed_checks": [],
"warnings": [
"OCR character substitutions detected",
"Product descriptions required contextual correction"
],
"uncertain_fields": []
},
"review_required": [],
"anomalies": [
"INVOlCE -> INVOICE",
"ELECTRONlCS -> ELECTRONICS",
"lnvoice -> Invoice",
"Keybord -> Keyboard",
"HDMl -> HDMI",
"Sub Tota1 -> Subtotal",
"Taxab1e -> Taxable",
"Grand Tota1 -> Grand Total",
"Ba1ance -> Balance"
]
}
π FINAL TEST SCORECARD
Phase Result
Phase 1 β Classification β
Passed
Phase 2 β OCR Cleaning β
Passed
Phase 3 β Structure Reconstruction β
Passed
Phase 4 β Field Discovery β
Passed
Phase 5 β Entity Extraction β
Passed
Phase 6 β Number & Amount Extraction β
Passed
Phase 7 β Line-Item Reconstruction β
Passed
Phase 8 β Normalization β
Passed
Phase 9 β Disambiguation β
Passed
Phase 10 β Validation β
Passed
Phase 11 β Cross-Field Consistency β
Passed
Phase 12 β Confidence Scoring β
Passed
Phase 13 β Anomaly Detection β
Passed
Phase 14 β Quality Audit β
Passed
Phase 15 β Schema Generation β
Passed
Phase 16 β Final Output β
Passed
Overall Test Result: PASSED β
Key demonstration: The system successfully handled OCR corruption + semantic correction + structured extraction + line-item reconstruction + financial arithmetic validation + confidence scoring + anomaly reporting + machine-readable JSON, without inventing missing information.
By purchasing this prompt, you agree to our terms of service
GPT-5.6
Raw OCR output is messy, inconsistent, and difficult to use directly in business workflows.
This advanced AI extractor converts raw OCR text from invoices, receipts, forms, and business documents into clean, validated, structured JSON or table-ready data.
π Clean noisy OCR text
π§Ύ Detect document type automatically
π― Extract relevant fields
π§Ή Normalize dates, amounts & names
π’ Reconstruct line items & tables
β οΈ Flag missing or uncertain values
π§ͺ Validate extracted data
π¦ Generate JSON
...more
Added 6 days ago
