[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
***********************************
  Robinson, Clark and Klein
  New Amy, SC
***********************************

Date: 11/02/2025  Time: 11:31
Receipt #: R-770030
Cashier: Michael

  Future Pair          5x $52.06  $403.33
  See Unit             8x $21.09  $168.72
  Business Box         5x $37.37  $186.85
  Sort Pack            3x $36.28  $108.84

  Subtotal:                   $724.71
  Tax (8.5%):                $61.60
  ──────────────────────────────
  TOTAL:                      $786.31

  Paid by: Google Pay

  Thank you for shopping with us!
***********************************
---

[Assistant] {"common":{"document_type":"receipt","date":"2025-11-02","issuer":{"name":"Robinson, Clark and Klein","address":"New Amy, SC"},"recipient":null,"total_amount":786.31,"currency":"USD"},"line_items":[{"description":"Future Pair","quantity":5,"unit_price":52.06,"amount":403.33},{"description":"See Unit","quantity":8,"unit_price":21.09,"amount":168.72},{"description":"Business Box","quantity":5,"unit_price":37.37,"amount":186.85},{"description":"Sort Pack","quantity":3,"unit_price":36.28,"amount":108.84}],"type_specific":{"receipt_number":"R-770030","payment_method":"Google Pay","store_location":"New Amy, SC","cashier":"Michael"},"flags":[{"category":"arithmetic_error","field":"line_items[0].amount","severity":"high","description":"Line item 'Future Pair': amount $403.33 does not equal quantity (5) × unit price ($52.06) = $260.30."}],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
==================================================
INVOICE
==================================================

Invoice Number: INV-2025-4155
Date: 2026-02-17

From:
  Moore PLC
  7679 Perry Forge, West Russellport, TX 89431

Bill To:
  Tucker, Estrada and Williams
  34324 Murphy Avenue, Burgessburgh, DC 50335

──────────────────────────────────────────────────
Item                             Qty      Price     Amount
──────────────────────────────────────────────────
Industrial Adhesive 500ml        248 EUR    13.06 EUR  3238.88
Nitrile Gloves Box (100)         302 EUR    16.71 EUR  5046.42
Ball Bearing 6205-2RS            269 EUR     7.99 EUR  2149.31
──────────────────────────────────────────────────
Subtotal:                                     EUR 10434.61
Tax (5.0%):                                   EUR   521.73
TOTAL:                                        EUR 10956.34

Payment Terms: Net 90
Due Date: 2026-03-19

Thank you for your business!
---

[Assistant] {"common":{"document_type":"invoice","date":"2026-02-17","issuer":{"name":"Moore PLC","address":"7679 Perry Forge, West Russellport, TX 89431"},"recipient":{"name":"Tucker, Estrada and Williams","address":"34324 Murphy Avenue, Burgessburgh, DC 50335"},"total_amount":10956.34,"currency":"EUR"},"line_items":[{"description":"Industrial Adhesive 500ml","quantity":248,"unit_price":13.06,"amount":3238.88},{"description":"Nitrile Gloves Box (100)","quantity":302,"unit_price":16.71,"amount":5046.42},{"description":"Ball Bearing 6205-2RS","quantity":269,"unit_price":7.99,"amount":2149.31}],"type_specific":{"invoice_number":"INV-2025-4155","due_date":"2026-03-19","payment_terms":"Net 90","tax_amount":521.73,"subtotal":10434.61},"flags":[],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
***********************************
  Vega-Thomas
  Lisaville, RI
***********************************

Date: 06/03/2025  Time: 21:20
Receipt #: R-247720
Cashier: Emma

  Trip Unit            7x $69.39  $485.73

  Subtotal:                   $485.73
  Tax (8.5%):                $41.29
  ──────────────────────────────
  TOTAL:                      $527.02

  Paid by: Visa ****4532

  Thank you for shopping with us!
***********************************
---


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---

RECEIPT
----------------------------------------
  SAUSAGE AND SALAMI             x1       62000.00
  GREEN MONSIEUR                 x1       57000.00
----------------------------------------
  TOTAL: 152746.00
---


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---

RECEIPT
----------------------------------------
  KUE PILUS ASIN                 x80      16800.00
  KACANG MEDAN                   x95      28690.00
----------------------------------------
  TOTAL: 50039.00
---


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
***********************************
  Holmes's Hardware
  North Tinamouth, CT
***********************************

Date: 07/13/2025  Time: 8:45
Receipt #: R-630041
Cashier: Mary

  Score Pair           3x $14.82  $44.46
  Near Pair            8x $11.06  $88.48
  Property Set         10x $40.12  $401.20
  Themselves Pair      8x $65.07  $520.56
  Eye Box              3x $42.02  $126.06

  Subtotal:                   $1180.76
  Tax (8.5%):                $100.36
  ──────────────────────────────
  TOTAL:                      $1281.12

  Paid by: Wire Transfer

  Thank you for shopping with us!
***********************************
---


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
==================================================
INVOICE
==================================================

Invoice Number: INV-2020-5082
Date: 11-Jun-2024

From:
  Good-Hodges
  2400 Flynn Hill, Nicholasberg, IA 70122

Bill To:
  Knight-Sparks
  693 Durham Divide, South Dana, NH 33967

──────────────────────────────────────────────────
Item                             Qty      Price     Amount
──────────────────────────────────────────────────
Hydraulic Cylinder 3in Bore      411 CAD   194.19 CAD 79812.09
Copper Wire 14AWG (100ft)        272 CAD    89.08 CAD 24229.76
──────────────────────────────────────────────────
Subtotal:                                     CAD 104041.85
Tax (13.0%):                                  CAD 13525.44
TOTAL:                                        CAD 117567.29

Payment Terms: COD
Due Date: 2024-09-09

Thank you for your business!
  Hydraulic Cylinder 3in Bore (DUPLICATE ENTRY)
---

[Assistant] {"common":{"document_type":"invoice","date":"2024-06-11","issuer":{"name":"Good-Hodges","address":"2400 Flynn Hill, Nicholasberg, IA 70122"},"recipient":{"name":"Knight-Sparks","address":"693 Durham Divide, South Dana, NH 33967"},"total_amount":117567.29,"currency":"CAD"},"line_items":[{"description":"Hydraulic Cylinder 3in Bore","quantity":411,"unit_price":194.19,"amount":79812.09},{"description":"Copper Wire 14AWG (100ft)","quantity":272,"unit_price":89.08,"amount":24229.76},{"description":"Hydraulic Cylinder 3in Bore","quantity":411,"unit_price":194.19,"amount":79812.09}],"type_specific":{"invoice_number":null,"due_date":null,"payment_terms":"COD","tax_amount":13525.44,"subtotal":104041.85},"flags":[{"category":"missing_field","field":"type_specific.due_date","severity":"medium","description":"Required field 'Due Date' is missing from the document."},{"category":"missing_field","field":"type_specific.invoice_number","severity":"medium","description":"Required field 'Invoice Number' is missing from the document."},{"category":"format_anomaly","field":"line_items","severity":"low","description":"Duplicate line item detected: 'Hydraulic Cylinder 3in Bore' appears more than once."}],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---

RECEIPT
----------------------------------------
  BUDS CALMING TUMMY RUB CREAM 30ML(TOILETRIES) x1      200000.00
  BUDS PRECIOUS NEWBORN CREAM 75ML(TOILETRIES) x1      235000.00
  BUDS PRECIOUS NEWBORN HEAD TO TOE CLEANSER 250ML(TOILETRIES) x1      270000.00
----------------------------------------
  TOTAL: 705000.00
---

[Assistant] {"common":{"document_type":"receipt","date":null,"issuer":{"name":null,"address":null},"recipient":null,"total_amount":705000.0,"currency":"USD"},"line_items":[{"description":"BUDS CALMING TUMMY RUB CREAM 30ML(TOILETRIES)","quantity":1.0,"unit_price":200000.0,"amount":200000.0},{"description":"BUDS PRECIOUS NEWBORN CREAM 75ML(TOILETRIES)","quantity":1.0,"unit_price":235000.0,"amount":235000.0},{"description":"BUDS PRECIOUS NEWBORN HEAD TO TOE CLEANSER 250ML(TOILETRIES)","quantity":1.0,"unit_price":270000.0,"amount":270000.0}],"type_specific":{"receipt_number":"RCP-24668D7D","payment_method":"unknown","store_location":null,"cashier":null,"subtotal":null,"tax_amount":null},"flags":[],"confidence_score":0.88}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
==================================================
INVOICE
==================================================

Invoice Number: INV-2022-1722
Date: 10/07/2024

From:
  Terry LLC
  058 Stanley Cliff, Alexanderchester, GU 64752

Bill To:
  Hamilton LLC
  262 Gilbert Plain Suite 769, Marcusbury, MP 11860

──────────────────────────────────────────────────
Item                             Qty      Price     Amount
──────────────────────────────────────────────────
Annual Software License           18 USD   734.10 USD 13213.80
Marketing Campaign Management     18 USD  2058.02 USD 37044.36
Graphic Design Services            3 USD   191.76 USD   575.28
──────────────────────────────────────────────────
Subtotal:                                     USD 50833.44
Tax (6.0%):                                   USD  3050.01
TOTAL:                                        USD 1135367.93

Payment Terms: Due on Receipt
Due Date: 2025-01-05

Thank you for your business!
---

[Assistant] {"common":{"document_type":"invoice","date":"2024-10-07","issuer":{"name":"Terry LLC","address":"058 Stanley Cliff, Alexanderchester, GU 64752"},"recipient":{"name":"Hamilton LLC","address":"262 Gilbert Plain Suite 769, Marcusbury, MP 11860"},"total_amount":1135367.93,"currency":"USD"},"line_items":[{"description":"Annual Software License","quantity":18,"unit_price":734.1,"amount":13213.8},{"description":"Marketing Campaign Management","quantity":18,"unit_price":2058.02,"amount":37044.36},{"description":"Graphic Design Services","quantity":3,"unit_price":191.76,"amount":575.28}],"type_specific":{"invoice_number":"INV-2022-1722","due_date":"2025-01-05","payment_terms":"Due on Receipt","tax_amount":3050.01,"subtotal":50833.44},"flags":[{"category":"business_logic","field":"common.total_amount","severity":"high","description":"Total amount $1,135,367.93 is unusually large and may require additional review."}],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
PURCHASE ORDER

PO Number: PO-2023-54681
Date: 2024-09-09

Buyer: Thomas, Hoover and Nicholson
Address: USNV Martin, FPO AE 74778

Supplier: Rhodes-Fernandez
Address: 185 Connor Fort, West Cassiefurt, WI 43279

Items Ordered:
──────────────────────────────────────────────────
  1. Safety Goggles ANSI Z87 - Qty: 167 @ USD 10.87 = USD 1815.29
  2. LED Panel Light 60W - Qty: 291 @ USD 31.68 = USD 9218.88
  3. Ball Bearing 6205-2RS - Qty: 453 @ USD 3.26 = USD 1476.78
──────────────────────────────────────────────────
Total: USD 12510.95

Delivery Date: 2024-09-26
Ship To: 7358 Reynolds Springs Suite 194, Lake Charles, KY 20715

Authorized By: Richard Moore
---

[Assistant] {"common":{"document_type":"purchase_order","date":"2024-09-09","issuer":{"name":"Thomas, Hoover and Nicholson","address":"USNV Martin, FPO AE 74778"},"recipient":{"name":"Rhodes-Fernandez","address":"185 Connor Fort, West Cassiefurt, WI 43279"},"total_amount":12510.95,"currency":"USD"},"line_items":[{"description":"Safety Goggles ANSI Z87","quantity":167,"unit_price":10.87,"amount":1815.29},{"description":"LED Panel Light 60W","quantity":291,"unit_price":31.68,"amount":9218.88},{"description":"Ball Bearing 6205-2RS","quantity":453,"unit_price":3.26,"amount":1476.78}],"type_specific":{"po_number":"PO-2023-54681","delivery_date":"2024-09-26","shipping_address":"7358 Reynolds Springs Suite 194, Lake Charles, KY 20715","referenced_invoice":null},"flags":[],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
==================================================
INVOICE
==================================================

Invoice Number: INV-2022-4020
Date: 31-May-2024

From:
  Schultz, Schmidt and Lee
  231 Jonathan Extensions Apt. 127, Webstershire, NV 89778

Bill To:
  Day, Downs and Morris
  Unit 5271 Box 7744, DPO AP 07863

──────────────────────────────────────────────────
Item                             Qty      Price     Amount
──────────────────────────────────────────────────
PVC Pipe 2in x 10ft              252 AUD     4.04 AUD  1018.08
Hydraulic Cylinder 3in Bore      323 AUD   246.32 AUD 79561.36
Rubber O-Ring Seals               78 AUD     0.46 AUD    35.88
Welding Rod E6013 (5lb)          289 AUD    21.19 AUD  6123.91
Stainless Steel Sheet 4x8ft       44 AUD   188.12 AUD  8277.28
──────────────────────────────────────────────────
Subtotal:                                     AUD 95016.51
Tax (5.0%):                                   AUD  4750.83
TOTAL:                                        AUD 99767.34

Payment Terms: Net 60
Due Date: 2024-08-29

Thank you for your business!
---

[Assistant] {"common":{"document_type":"invoice","date":"2024-05-31","issuer":{"name":"Schultz, Schmidt and Lee","address":"231 Jonathan Extensions Apt. 127, Webstershire, NV 89778"},"recipient":{"name":"Day, Downs and Morris","address":"Unit 5271 Box 7744, DPO AP 07863"},"total_amount":99767.34,"currency":"AUD"},"line_items":[{"description":"PVC Pipe 2in x 10ft","quantity":252,"unit_price":4.04,"amount":1018.08},{"description":"Hydraulic Cylinder 3in Bore","quantity":323,"unit_price":246.32,"amount":79561.36},{"description":"Rubber O-Ring Seals","quantity":78,"unit_price":0.46,"amount":35.88},{"description":"Welding Rod E6013 (5lb)","quantity":289,"unit_price":21.19,"amount":6123.91},{"description":"Stainless Steel Sheet 4x8ft","quantity":44,"unit_price":188.12,"amount":8277.28}],"type_specific":{"invoice_number":"INV-2022-4020","due_date":"2024-08-29","payment_terms":"Net 60","tax_amount":4750.83,"subtotal":95016.51},"flags":[],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
PURCHASE ORDER

PO Number: PO-2022-39552
Date: 2025-07-22

Buyer: Smith and Sons
Address: 2175 Mark Harbors Apt. 838, Powellbury, CO 60675

Supplier: Solis-West
Address: 1701 Gutierrez Point Apt. 199, Pamelaside, IL 86300

Items Ordered:
──────────────────────────────────────────────────
  1. Air Filter Cartridge - Qty: 141 @ CAD 6.28 = CAD 885.48
  2. LED Panel Light 60W - Qty: 156 @ CAD 32.28 = CAD 5035.68
  3. Rubber O-Ring Seals - Qty: 48 @ CAD 1.27 = CAD 60.96
  4. PVC Pipe 2in x 10ft - Qty: 87 @ CAD 9.89 = CAD 860.43
  5. Industrial Adhesive 500ml - Qty: 298 @ CAD 11.04 = CAD 3289.92
  6. Nitrile Gloves Box (100) - Qty: 338 @ CAD 12.49 = CAD 4221.62
──────────────────────────────────────────────────
Total: CAD 14354.09

Delivery Date: 2025-09-05
Ship To: 0375 Moran Lakes Suite 113, West Michaelport, OH 68918

Authorized By: Brian Prince
---

[Assistant] {"common":{"document_type":"purchase_order","date":"2025-07-22","issuer":{"name":"Smith and Sons","address":"2175 Mark Harbors Apt. 838, Powellbury, CO 60675"},"recipient":{"name":"Solis-West","address":"1701 Gutierrez Point Apt. 199, Pamelaside, IL 86300"},"total_amount":14354.09,"currency":"CAD"},"line_items":[{"description":"Air Filter Cartridge","quantity":141,"unit_price":6.28,"amount":885.48},{"description":"LED Panel Light 60W","quantity":156,"unit_price":32.28,"amount":5035.68},{"description":"Rubber O-Ring Seals","quantity":48,"unit_price":1.27,"amount":60.96},{"description":"PVC Pipe 2in x 10ft","quantity":87,"unit_price":9.89,"amount":860.43},{"description":"Industrial Adhesive 500ml","quantity":298,"unit_price":11.04,"amount":3289.92},{"description":"Nitrile Gloves Box (100)","quantity":338,"unit_price":12.49,"amount":4221.62}],"type_specific":{"po_number":"PO-2022-39552","delivery_date":"2025-09-05","shipping_address":"0375 Moran Lakes Suite 113, West Michaelport, OH 68918","referenced_invoice":null},"flags":[],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
============================================================
  First National Bank
  ACCOUNT STATEMENT
============================================================

Account Holder: Jacqueline Stewart
Account Number: ****3807
Statement Period: 04/02/2026 - 05/02/2026

Opening Balance: $25,493.06

Date         Description                          Amount      Balance
──────────────────────────────────────────────────────────────────
2026-04-03   Client Payment                    $9,259.57 $51,644.47
2026-04-05   Deposit                           $2,336.18 $37,603.67
2026-04-12   Wire Transfer - Johnston         $-3,763.75 $43,236.18
2026-04-15   Utility Payment - Electric       $-3,029.79 $41,030.86
2026-04-20   Utility Payment - Electric       $-1,925.39 $44,338.60
2026-04-21   Interest Payment                  $9,690.76 $50,721.62
2026-04-22   Refund - Ramirez, Walker and Ray    $9,774.43 $35,267.49
2026-04-24   Deposit                           $3,027.81 $46,263.99
2026-04-25   Utility Payment - Electric         $-277.95 $44,060.65
2026-04-30   Refund - Bryant Inc               $4,781.23 $42,384.90
2026-04-30   Wire Transfer - Diaz             $-4,644.54 $46,999.93
──────────────────────────────────────────────────────────────────

Closing Balance: $46,999.93

Total Debits:  $-13,641.42
Total Credits: $38,869.98
---

[Assistant] {"common":{"document_type":"bank_statement","date":"2026-05-02","issuer":{"name":"First National Bank","address":null},"recipient":{"name":"Jacqueline Stewart","address":null},"total_amount":46999.93,"currency":"USD"},"line_items":[{"description":"Client Payment","quantity":1,"unit_price":9259.57,"amount":9259.57},{"description":"Deposit","quantity":1,"unit_price":2336.18,"amount":2336.18},{"description":"Wire Transfer - Johnston","quantity":1,"unit_price":-3763.75,"amount":-3763.75},{"description":"Utility Payment - Electric","quantity":1,"unit_price":-3029.79,"amount":-3029.79},{"description":"Utility Payment - Electric","quantity":1,"unit_price":-1925.39,"amount":-1925.39},{"description":"Interest Payment","quantity":1,"unit_price":9690.76,"amount":9690.76},{"description":"Refund - Ramirez, Walker and Ray","quantity":1,"unit_price":9774.43,"amount":9774.43},{"description":"Deposit","quantity":1,"unit_price":3027.81,"amount":3027.81},{"description":"Utility Payment - Electric","quantity":1,"unit_price":-277.95,"amount":-277.95},{"description":"Refund - Bryant Inc","quantity":1,"unit_price":4781.23,"amount":4781.23},{"description":"Wire Transfer - Diaz","quantity":1,"unit_price":-4644.54,"amount":-4644.54}],"type_specific":{"account_number":"****3807","statement_period":"2026-04-02 to 2026-05-02","opening_balance":25493.06,"closing_balance":46999.93},"flags":[],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---

RECEIPT
----------------------------------------
  1069-ROTI KEJU COKLAT          x1           8.50
  1037-ROTI MAHKOTA/RING         x1          10.50
  1022-ROTI KACANG MERAH         x1           8.00
  1001-ROTI COKLAT               x1           8.00
----------------------------------------
  TOTAL: 35.00
---


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
==================================================
INVOICE
==================================================

Invoice Number: INV-2020-3496
Date: 09-Sep-2024

From:
  Robinson, Kane and Murphy
  2284 Daniel Way, East Alexisbury, OR 42938

Bill To:
  Thompson Inc
  117 Strickland Passage Apt. 783, Lake Kristahaven, ME 60537

──────────────────────────────────────────────────
Item                             Qty      Price     Amount
──────────────────────────────────────────────────
Legal Advisory - Contract Review    20 USD   487.31 USD  9746.20
Cloud Infrastructure Setup         4 USD  2444.48 USD  9777.92
Graphic Design Services            6 USD   194.71 USD  1168.26
Equipment Maintenance - Quarterly     4 USD   547.21 USD  2188.84
Marketing Campaign Management     10 USD  5454.78 USD 54547.80
Staff Training Session            13 USD   775.99 USD 10087.87
Security Audit                     7 USD  1303.99 USD  9127.93
Annual Software License            8 USD   190.71 USD  1525.68
──────────────────────────────────────────────────
Subtotal:                                     USD 98170.50
Tax (7.5%):                                   USD  7362.79
TOTAL:                                        USD 105533.29

Payment Terms: Net 15
Due Date: 2024-10-24

Thank you for your business!
---

[Assistant] {"common":{"document_type":"invoice","date":"2024-09-09","issuer":{"name":"Robinson, Kane and Murphy","address":"2284 Daniel Way, East Alexisbury, OR 42938"},"recipient":{"name":"Thompson Inc","address":"117 Strickland Passage Apt. 783, Lake Kristahaven, ME 60537"},"total_amount":105533.29,"currency":"USD"},"line_items":[{"description":"Legal Advisory - Contract Review","quantity":20,"unit_price":487.31,"amount":9746.2},{"description":"Cloud Infrastructure Setup","quantity":4,"unit_price":2444.48,"amount":9777.92},{"description":"Graphic Design Services","quantity":6,"unit_price":194.71,"amount":1168.26},{"description":"Equipment Maintenance - Quarterly","quantity":4,"unit_price":547.21,"amount":2188.84},{"description":"Marketing Campaign Management","quantity":10,"unit_price":5454.78,"amount":54547.8},{"description":"Staff Training Session","quantity":13,"unit_price":775.99,"amount":10087.87},{"description":"Security Audit","quantity":7,"unit_price":1303.99,"amount":9127.93},{"description":"Annual Software License","quantity":8,"unit_price":190.71,"amount":1525.68}],"type_specific":{"invoice_number":"INV-2020-3496","due_date":"2024-10-24","payment_terms":"Net 15","tax_amount":7362.79,"subtotal":98170.5},"flags":[],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
==================================================
INVOICE
==================================================

Invoice Number: INV-2023-3591
Date: May 25, 2024

From:
  Jones, Hensley and Powell
  USNS Riley, FPO AE 81684

Bill To:
  Barnes PLC
  3534 Anderson Rue Suite 751, South Christineshire, CT 10103

──────────────────────────────────────────────────
Item                             Qty      Price     Amount
──────────────────────────────────────────────────
Air Filter Cartridge             446 USD    13.41 USD  5980.86
Welding Rod E6013 (5lb)          431 USD    16.22 USD  6990.82
Copper Wire 14AWG (100ft)        312 USD    29.92 USD  9335.04
Nitrile Gloves Box (100)         192 USD    14.14 USD  2714.88
Rubber O-Ring Seals              277 USD     2.29 USD   634.33
──────────────────────────────────────────────────
Subtotal:                                     USD 25655.93
Tax (10.0%):                                  USD  2565.59
TOTAL:                                        USD 28221.52

Payment Terms: Due on Receipt
Due Date: 2024-07-24

Thank you for your business!

Referenced Purchase Order: PO-2022-93346
  Air Filter Cartridge (DUPLICATE ENTRY)
---

[Assistant] {"common":{"document_type":"invoice","date":"2024-05-25","issuer":{"name":"Jones, Hensley and Powell","address":"USNS Riley, FPO AE 81684"},"recipient":{"name":"Barnes PLC","address":"3534 Anderson Rue Suite 751, South Christineshire, CT 10103"},"total_amount":28221.52,"currency":"USD"},"line_items":[{"description":"Air Filter Cartridge","quantity":446,"unit_price":13.41,"amount":5980.86},{"description":"Welding Rod E6013 (5lb)","quantity":431,"unit_price":16.22,"amount":6990.82},{"description":"Copper Wire 14AWG (100ft)","quantity":312,"unit_price":29.92,"amount":9335.04},{"description":"Nitrile Gloves Box (100)","quantity":192,"unit_price":14.14,"amount":2714.88},{"description":"Rubber O-Ring Seals","quantity":277,"unit_price":2.29,"amount":634.33},{"description":"Air Filter Cartridge","quantity":446,"unit_price":13.41,"amount":5980.86}],"type_specific":{"invoice_number":"INV-2023-3591","due_date":"2024-07-24","payment_terms":"Due on Receipt","tax_amount":2565.59,"subtotal":25655.93},"flags":[{"category":"cross_field","field":"referenced_po","severity":"high","description":"Invoice references Purchase Order 'PO-2022-93346' which could not be verified in the system."},{"category":"format_anomaly","field":"line_items","severity":"low","description":"Duplicate line item detected: 'Air Filter Cartridge' appears more than once."}],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
PURCHASE ORDER

PO Number: PO-2022-53007
Date: 2025-02-03

Buyer: Skinner-James
Address: 6924 Morrison Square Apt. 752, Novakport, WA 91590

Supplier: Henry, Johnston and Sanchez
Address: 1939 Erin Plaza Apt. 737, Marieland, GU 54128

Items Ordered:
──────────────────────────────────────────────────
  1. Steel Bolts M10x50 - Qty: 383 @ EUR 3.92 = EUR 1501.36
  2. Hydraulic Cylinder 3in Bore - Qty: 67 @ EUR 174.35 = EUR 11681.45
──────────────────────────────────────────────────
Total: EUR 13182.81

Delivery Date: 2025-03-27
Ship To: 434 Jennifer Turnpike, Jonesfort, OR 53035

Authorized By: Tammy Kane

Note: Payment in CAD
---

[Assistant] {"common":{"document_type":"purchase_order","date":"2025-02-03","issuer":{"name":"Skinner-James","address":"6924 Morrison Square Apt. 752, Novakport, WA 91590"},"recipient":{"name":"Henry, Johnston and Sanchez","address":"1939 Erin Plaza Apt. 737, Marieland, GU 54128"},"total_amount":13182.81,"currency":"EUR"},"line_items":[{"description":"Steel Bolts M10x50","quantity":383,"unit_price":3.92,"amount":1501.36},{"description":"Hydraulic Cylinder 3in Bore","quantity":67,"unit_price":174.35,"amount":11681.45}],"type_specific":{"po_number":"PO-2022-53007","delivery_date":null,"shipping_address":"434 Jennifer Turnpike, Jonesfort, OR 53035","referenced_invoice":null},"flags":[{"category":"missing_field","field":"type_specific.delivery_date","severity":"medium","description":"Required field 'Delivery Date' is missing from the document."},{"category":"cross_field","field":"currency","severity":"high","description":"Header shows currency as EUR but payment note references CAD. Currency mismatch detected."}],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
==================================================
INVOICE
==================================================

Invoice Number: INV-2025-2771
Date: 01/13/2025

From:
  Tran-Cooper
  Unit 8557 Box 4443, DPO AE 95041

Bill To:
  Stewart Ltd
  37498 Hooper Village, West Jeremy, HI 40119

──────────────────────────────────────────────────
Item                             Qty      Price     Amount
──────────────────────────────────────────────────
PVC Pipe 2in x 10ft              241 CAD     5.71 CAD  1376.11
──────────────────────────────────────────────────
Subtotal:                                     CAD  1376.11
Tax (9.0%):                                   CAD   123.85
TOTAL:                                        CAD  1499.96

Payment Terms: Net 90
Due Date: 2025-02-12

Thank you for your business!

Referenced Purchase Order: PO-2020-91876
---

[Assistant] {"common":{"document_type":"invoice","date":"2025-01-13","issuer":{"name":"Tran-Cooper","address":"Unit 8557 Box 4443, DPO AE 95041"},"recipient":{"name":"Stewart Ltd","address":"37498 Hooper Village, West Jeremy, HI 40119"},"total_amount":1499.96,"currency":"CAD"},"line_items":[{"description":"PVC Pipe 2in x 10ft","quantity":241,"unit_price":5.71,"amount":1376.11}],"type_specific":{"invoice_number":"INV-2025-2771","due_date":"2025-02-12","payment_terms":"Net 90","tax_amount":123.85,"subtotal":1376.11},"flags":[{"category":"cross_field","field":"referenced_po","severity":"high","description":"Invoice references Purchase Order 'PO-2020-91876' which could not be verified in the system."}],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
==================================================
INVOICE
==================================================

Invoice Number: INV-2025-7594
Date: August 29, 2024

From:
  Cooke and Sons
  880 Walter River, New Nicholas, GA 24204

Bill To:
  Wise, Lamb and Martin
  3794 Young Garden Suite 735, Murrayport, WI 50553

──────────────────────────────────────────────────
Item                             Qty      Price     Amount
──────────────────────────────────────────────────
Hydraulic Cylinder 3in Bore       47 USD   138.80 USD  6523.60
Rubber O-Ring Seals              346 USD     2.03 USD   702.38
Thermal Paste 30g                295 USD     6.69 USD  1973.55
Steel Bolts M10x50                11 USD     8.50 USD    93.50
Stainless Steel Sheet 4x8ft      345 USD   163.28 USD 56331.60
Safety Goggles ANSI Z87          296 USD     3.88 USD  1148.48
LED Panel Light 60W              388 USD    17.78 USD  6898.64
Ball Bearing 6205-2RS            266 USD     8.47 USD  2253.02
──────────────────────────────────────────────────
Subtotal:                                     USD 75924.77
Tax (7.5%):                                   USD  5694.36
TOTAL:                                        USD 81619.13

Payment Terms: 2/10 Net 30
Due Date: 2024-10-28

Thank you for your business!
---

[Assistant] {"common":{"document_type":"invoice","date":"2024-08-29","issuer":{"name":"Cooke and Sons","address":"880 Walter River, New Nicholas, GA 24204"},"recipient":{"name":"Wise, Lamb and Martin","address":"3794 Young Garden Suite 735, Murrayport, WI 50553"},"total_amount":81619.13,"currency":"USD"},"line_items":[{"description":"Hydraulic Cylinder 3in Bore","quantity":47,"unit_price":138.8,"amount":6523.6},{"description":"Rubber O-Ring Seals","quantity":346,"unit_price":2.03,"amount":702.38},{"description":"Thermal Paste 30g","quantity":295,"unit_price":6.69,"amount":1973.55},{"description":"Steel Bolts M10x50","quantity":11,"unit_price":8.5,"amount":93.5},{"description":"Stainless Steel Sheet 4x8ft","quantity":345,"unit_price":163.28,"amount":56331.6},{"description":"Safety Goggles ANSI Z87","quantity":296,"unit_price":3.88,"amount":1148.48},{"description":"LED Panel Light 60W","quantity":388,"unit_price":17.78,"amount":6898.64},{"description":"Ball Bearing 6205-2RS","quantity":266,"unit_price":8.47,"amount":2253.02}],"type_specific":{"invoice_number":"INV-2025-7594","due_date":"2024-10-28","payment_terms":"2/10 Net 30","tax_amount":5694.36,"subtotal":75924.77},"flags":[],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---

RECEIPT
----------------------------------------
  Jamur Crispy                   x2          27.00
  Nasi Putih                     x2          14.00
  Sambel Kecap                   x2           9.00
  Es Teh                         x2          15.00
----------------------------------------
  TOTAL: 73.45
---


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
============================================================
  Cornerstone Banking Group
  ACCOUNT STATEMENT
============================================================

Account Holder: Cynthia Le
Account Number: ****6890
Statement Period: 04/02/2026 - 05/02/2026

Opening Balance: $44,879.57

Date         Description                          Amount      Balance
──────────────────────────────────────────────────────────────────
2026-04-03   Deposit                             $274.72 $55,430.27
2026-04-06   Payroll                            $-53-1.70 $46,287.44
2026-04-09   Wire Transfer In                  $1,705.07 $47,722.87
2026-04-12   Client Payment                    $8,010.50 $63,440.77
2026-04-15   POS Purchase - Conrad and Sons   $-1,117.79 $41,776.15
2026-04-15   Deposit                           $1,204.89 $47,492.33
2026-04-16   Refund - Miller-Lewis             $6,919.85 $46,819.14
2026-04-16   Refund - Kirk-Gutierrez           $4,855.11 $55,500.75
2026-04-17   Utility Payment - Electric         $-345.20 $55,155.55
2026-04-21   Deposit                           $1,138.23 $46,017.80
2026-04-21   Utility Payment - Electric       $-4,828.93 $42,893.94
2026-04-25   Payroll                          $-1,876.86 $39,899.29
2026-05-02   Wire Transfer In                  $3,153.31 $50,645.64
──────────────────────────────────────────────────────────────────

Closing Balance: $50,645.64

Total Debits:  $-8,700.48
Total Credits: $27,261.68
---

[Assistant] {"common":{"document_type":"bank_statement","date":"2026-05-02","issuer":{"name":"Cornerstone Banking Group","address":null},"recipient":{"name":"Cynthia Le","address":null},"total_amount":50645.64,"currency":"USD"},"line_items":[{"description":"Deposit","quantity":1,"unit_price":274.72,"amount":274.72},{"description":"Payroll","quantity":1,"unit_price":-531.7,"amount":-531.7},{"description":"Wire Transfer In","quantity":1,"unit_price":1705.07,"amount":1705.07},{"description":"Client Payment","quantity":1,"unit_price":8010.5,"amount":8010.5},{"description":"POS Purchase - Conrad and Sons","quantity":1,"unit_price":-1117.79,"amount":-1117.79},{"description":"Deposit","quantity":-1,"unit_price":1204.89,"amount":1204.89},{"description":"Refund - Miller-Lewis","quantity":1,"unit_price":6919.85,"amount":6919.85},{"description":"Refund - Kirk-Gutierrez","quantity":1,"unit_price":4855.11,"amount":4855.11},{"description":"Utility Payment - Electric","quantity":1,"unit_price":-345.2,"amount":-345.2},{"description":"Deposit","quantity":1,"unit_price":1138.23,"amount":1138.23},{"description":"Utility Payment - Electric","quantity":1,"unit_price":-4828.93,"amount":-4828.93},{"description":"Payroll","quantity":1,"unit_price":-1876.86,"amount":-1876.86},{"description":"Wire Transfer In","quantity":1,"unit_price":3153.31,"amount":3153.31}],"type_specific":{"account_number":null,"statement_period":null,"opening_balance":44879.57,"closing_balance":50645.64},"flags":[{"category":"missing_field","field":"type_specific.account_number","severity":"medium","description":"Required field 'Account Number' is missing from the document."},{"category":"missing_field","field":"type_specific.statement_period","severity":"medium","description":"Required field 'Statement Period' is missing from the document."},{"category":"format_anomaly","field":"line_items[5].quantity","severity":"medium","description":"Line item 'Deposit' has a negative quantity (-1), which is unusual for a standard document."}],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
==================================================
INVOICE
==================================================

Invoice Number: INV-2021-2480
Date: June 16, 2025

From:
  Jacobs Ltd
  7192 Sanders Run Suite 310, South April, PW 74120

Bill To:
  Green LLC
  473 Derek Cliffs, Thompsonmouth, CO 89882

──────────────────────────────────────────────────
Item                             Qty      Price     Amount
──────────────────────────────────────────────────
Welding Rod E6013 (5lb)          361 USD    19.96 USD  7205.56
Cable Ties 12in (100pk)          228 USD     2.66 USD   606.48
──────────────────────────────────────────────────
Subtotal:                                     USD  7812.04
Tax (7.5%):                                   USD   585.90
TOTAL:                                        USD  8397.94

Payment Terms: Net 15
Due Date: 2025-07-31

Thank you for your business!
  Welding Rod E6013 (5lb) (DUPLICATE ENTRY)
---

[Assistant] {"common":{"document_type":"invoice","date":"2025-06-16","issuer":{"name":"Jacobs Ltd","address":"7192 Sanders Run Suite 310, South April, PW 74120"},"recipient":{"name":"Green LLC","address":"473 Derek Cliffs, Thompsonmouth, CO 89882"},"total_amount":8397.94,"currency":"USD"},"line_items":[{"description":"Welding Rod E6013 (5lb)","quantity":361,"unit_price":19.96,"amount":7205.56},{"description":"Cable Ties 12in (100pk)","quantity":228,"unit_price":2.66,"amount":606.48},{"description":"Welding Rod E6013 (5lb)","quantity":361,"unit_price":19.96,"amount":7205.56}],"type_specific":{"invoice_number":"INV-2021-2480","due_date":"2025-07-31","payment_terms":"Net 15","tax_amount":585.9,"subtotal":7812.04},"flags":[{"category":"format_anomaly","field":"line_items","severity":"low","description":"Duplicate line item detected: 'Welding Rod E6013 (5lb)' appears more than once."}],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---

RECEIPT
----------------------------------------
  Coffee Rocksalt [R]            x1       28000.00
  ICED NUTELLA LATTE [R]         x1       30000.00
  ICED MOCHA LATTE [R]           x1       30000.00
----------------------------------------
  TOTAL: 100000.00
---


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
***********************************
  Perry's Hardware
  Lake Martin, MN
***********************************

Date: 10/21/2025  Time: 12:40
Receipt #: R-735710
Cashier: Christine

  Finally Pair         -6x $14.67  $88.02
  Discover Pair        5x $48.30  $241.50
  Soldier Pair         9x $43.51  $391.59

  Subtotal:                   $721.11
  Tax (10.0%):                $72.11
  ──────────────────────────────
  TOTAL:                      $1453526.67

  Paid by: Wire Transfer

  Thank you for shopping with us!
***********************************
---

[Assistant] {"common":{"document_type":"receipt","date":"2025-10-21","issuer":{"name":"Perry's Hardware","address":"Lake Martin, MN"},"recipient":null,"total_amount":1453526.67,"currency":"USD"},"line_items":[{"description":"Finally Pair","quantity":-6,"unit_price":14.67,"amount":88.02},{"description":"Discover Pair","quantity":5,"unit_price":48.3,"amount":241.5},{"description":"Soldier Pair","quantity":9,"unit_price":43.51,"amount":391.59}],"type_specific":{"receipt_number":"R-735710","payment_method":"Wire Transfer","store_location":"Lake Martin, MN","cashier":"Christine"},"flags":[{"category":"business_logic","field":"common.total_amount","severity":"high","description":"Total amount $1,453,526.67 is unusually large and may require additional review."},{"category":"format_anomaly","field":"line_items[0].quantity","severity":"medium","description":"Line item 'Finally Pair' has a negative quantity (-6), which is unusual for a standard document."}],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
PURCHASE ORDER

PO Number: PO-2021-18812
Date: 2024-11-22

Buyer: Meyer, Hanson and Silva
Address: 994 Cohen Orchard Apt. 545, Joseport, ID 20152

Supplier: Cannon, Yoder and Trujillo
Address: 520 Bright Green Suite 660, West Jessica, IN 90458

Items Ordered:
──────────────────────────────────────────────────
  1. Welding Rod E6013 (5lb) - Qty: 197 @ USD 21.19 = USD 4174.43
  2. Cable Ties 12in (100pk) - Qty: 17 @ USD 5.73 = USD 97.41
  3. Safety Goggles ANSI Z87 - Qty: 348 @ USD 7.77 = USD 2703.96
  4. Nitrile Gloves Box (100) - Qty: 190 @ USD 9.46 = USD 1797.40
──────────────────────────────────────────────────
Total: USD 8773.20

Delivery Date: 2025-01-16
Ship To: 584 Mary Wells Apt. 417, Lake Jonathan, AS 73774

Authorized By: Catherine Frazier

Note: Payment in AUD
---

[Assistant] {"common":{"document_type":"purchase_order","date":"2024-11-22","issuer":{"name":"Meyer, Hanson and Silva","address":"994 Cohen Orchard Apt. 545, Joseport, ID 20152"},"recipient":{"name":"Cannon, Yoder and Trujillo","address":"520 Bright Green Suite 660, West Jessica, IN 90458"},"total_amount":8773.2,"currency":"USD"},"line_items":[{"description":"Welding Rod E6013 (5lb)","quantity":197,"unit_price":21.19,"amount":4174.43},{"description":"Cable Ties 12in (100pk)","quantity":17,"unit_price":5.73,"amount":97.41},{"description":"Safety Goggles ANSI Z87","quantity":348,"unit_price":7.77,"amount":2703.96},{"description":"Nitrile Gloves Box (100)","quantity":190,"unit_price":9.46,"amount":1797.4}],"type_specific":{"po_number":"PO-2021-18812","delivery_date":"2025-01-16","shipping_address":"584 Mary Wells Apt. 417, Lake Jonathan, AS 73774","referenced_invoice":null},"flags":[{"category":"cross_field","field":"currency","severity":"high","description":"Header shows currency as USD but payment note references AUD. Currency mismatch detected."}],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
============================================================
  Horizon Financial Corp
  ACCOUNT STATEMENT
============================================================

Account Holder: Julie Taylor
Account Number: ****4300
Statement Period: 04/02/2026 - 05/02/2026

Opening Balance: $7,393.99

Date         Description                          Amount      Balance
──────────────────────────────────────────────────────────────────
2026-04-06   ACH Debit - Phillips LLC         $-4,233.94 $3,802.63
2026-04-06   Client Payment                    $9,489.50 $8,250.68
2026-04-07   Refund - Harrison PLC             $6,950.93 $21,710.95
2026-04-23   Utility Payment - Electric       $-1,515.81 $-1,238.82
2026-04-27   Interest Payment                  $6,509.34 $14,760.02
2026-04-29   Utility Payment - Electric       $-3,525.64 $276.99
2026-05-01   Wire Transfer In                    $642.58 $8,036.57
──────────────────────────────────────────────────────────────────

Closing Balance: $8,036.57

Total Debits:  $-9,275.39
Total Credits: $23,592.35
---

[Assistant] {"common":{"document_type":"bank_statement","date":"2026-05-02","issuer":{"name":"Horizon Financial Corp","address":null},"recipient":{"name":"Julie Taylor","address":null},"total_amount":8036.57,"currency":"USD"},"line_items":[{"description":"ACH Debit - Phillips LLC","quantity":1,"unit_price":-4233.94,"amount":-4233.94},{"description":"Client Payment","quantity":1,"unit_price":9489.5,"amount":9489.5},{"description":"Refund - Harrison PLC","quantity":1,"unit_price":6950.93,"amount":6950.93},{"description":"Utility Payment - Electric","quantity":1,"unit_price":-1515.81,"amount":-1515.81},{"description":"Interest Payment","quantity":1,"unit_price":6509.34,"amount":6509.34},{"description":"Utility Payment - Electric","quantity":1,"unit_price":-3525.64,"amount":-3525.64},{"description":"Wire Transfer In","quantity":1,"unit_price":642.58,"amount":642.58}],"type_specific":{"account_number":"****4300","statement_period":"2026-04-02 to 2026-05-02","opening_balance":7393.99,"closing_balance":8036.57},"flags":[],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
============================================================
  Pacific Commerce Bank
  ACCOUNT STATEMENT
============================================================

Account Holder: Abigail Andrade
Account Number: ****5646
Statement Period: 04/02/2026 - 05/02/2026

Opening Balance: $27,818.22

Date         Description                          Amount      Balance
──────────────────────────────────────────────────────────────────
2026-04-10   Payment to Richardson-Gray       $-1,987.74 $45,038.29
2026-04-11   ACH Credit - Murphy-Gutierrez     $4,320.85 $49,359.14
2026-04-20   Wire Transfer In                  $8,946.84 $36,765.06
2026-04-26   Payroll                             $-91.24 $36,673.82
2026-05-01   Interest Payment                  $4,592.36 $41,266.18
2026-05-01   Deposit                           $6,563.15 $47,026.03
2026-05-02   POS Purchase - Larson, Cobb and Thompson     $-803.30 $40,462.88
──────────────────────────────────────────────────────────────────

Closing Balance: $40,462.88

Total Debits:  $-2,882.28
Total Credits: $24,423.20
---

[Assistant] {"common":{"document_type":"bank_statement","date":"2026-05-02","issuer":{"name":"Pacific Commerce Bank","address":null},"recipient":{"name":"Abigail Andrade","address":null},"total_amount":40462.88,"currency":"USD"},"line_items":[{"description":"Payment to Richardson-Gray","quantity":1,"unit_price":-1987.74,"amount":-1987.74},{"description":"ACH Credit - Murphy-Gutierrez","quantity":1,"unit_price":4320.85,"amount":4320.85},{"description":"Wire Transfer In","quantity":1,"unit_price":8946.84,"amount":8946.84},{"description":"Payroll","quantity":1,"unit_price":-91.24,"amount":-91.24},{"description":"Interest Payment","quantity":1,"unit_price":4592.36,"amount":4592.36},{"description":"Deposit","quantity":1,"unit_price":6563.15,"amount":6563.15},{"description":"POS Purchase - Larson, Cobb and Thompson","quantity":1,"unit_price":-803.3,"amount":-803.3}],"type_specific":{"account_number":null,"statement_period":null,"opening_balance":27818.22,"closing_balance":40462.88},"flags":[{"category":"missing_field","field":"type_specific.account_number","severity":"medium","description":"Required field 'Account Number' is missing from the document."},{"category":"missing_field","field":"type_specific.statement_period","severity":"medium","description":"Required field 'Statement Period' is missing from the document."}],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
============================================================
  Citizens Trust Bank
  ACCOUNT STATEMENT
============================================================

Account Holder: Vincent Smith
Account Number: ****6770
Statement Period: 04/02/2026 - 05/02/2026

Opening Balance: $7,857.97

Date         Description                          Amount      Balance
──────────────────────────────────────────────────────────────────
2026-04-02   ACH Debit - Mitchell, Johnson and Greene   $-3,538.78 $2,227.43
2026-04-02   Utility Payment - Electric         $-311.65 $1,915.78
2026-04-02   Wire Transfer - Webb               $-544.01 $20,210.43
2026-04-04   Payroll                          $-2,829.36 $22,237.98
2026-04-05   Check #4948                      $-3,102.71 $17,107.72
2026-04-10   Wire Transfer In                  $7,959.62 $25,067.34
2026-04-14   Payment to Harris and Sons       $-3,187.37 $18,574.04
2026-04-17   Payment to Morrow Group          $-2,624.48 $5,233.49
2026-04-18   Refund - Phillips, Arroyo and Pratt    $9,775.92 $20,754.44
2026-04-22   Refund - Dunn Ltd                 $9,131.88 $11,047.66
2026-04-23   Insurance Premium                   $-69.14 $10,978.52
2026-04-24   Payment to Valentine Ltd           $-476.57 $21,761.41
2026-04-28   Client Payment                      $532.72 $5,766.21
──────────────────────────────────────────────────────────────────

Closing Balance: $5,766.21

Total Debits:  $-16,684.07
Total Credits: $27,400.14
---

[Assistant] {"common":{"document_type":"bank_statement","date":"2026-05-02","issuer":{"name":"Citizens Trust Bank","address":null},"recipient":{"name":"Vincent Smith","address":null},"total_amount":5766.21,"currency":"USD"},"line_items":[{"description":"ACH Debit - Mitchell, Johnson and Greene","quantity":1,"unit_price":-3538.78,"amount":-3538.78},{"description":"Utility Payment - Electric","quantity":1,"unit_price":-311.65,"amount":-311.65},{"description":"Wire Transfer - Webb","quantity":1,"unit_price":-544.01,"amount":-544.01},{"description":"Payroll","quantity":1,"unit_price":-2829.36,"amount":-2829.36},{"description":"Check #4948","quantity":1,"unit_price":-3102.71,"amount":-3102.71},{"description":"Wire Transfer In","quantity":1,"unit_price":7959.62,"amount":7959.62},{"description":"Payment to Harris and Sons","quantity":1,"unit_price":-3187.37,"amount":-3187.37},{"description":"Payment to Morrow Group","quantity":1,"unit_price":-2624.48,"amount":-2624.48},{"description":"Refund - Phillips, Arroyo and Pratt","quantity":1,"unit_price":9775.92,"amount":9775.92},{"description":"Refund - Dunn Ltd","quantity":1,"unit_price":9131.88,"amount":9131.88},{"description":"Insurance Premium","quantity":1,"unit_price":-69.14,"amount":-69.14},{"description":"Payment to Valentine Ltd","quantity":1,"unit_price":-476.57,"amount":-476.57},{"description":"Client Payment","quantity":1,"unit_price":532.72,"amount":532.72}],"type_specific":{"account_number":"****6770","statement_period":"2026-04-02 to 2026-05-02","opening_balance":7857.97,"closing_balance":5766.21},"flags":[],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
==================================================
INVOICE
==================================================

Invoice Number: INV-2023-6507
Date: October 16, 2025

From:
  Whitney, Coffey and Ballard
  48175 Richards View Suite 137, New Nicoleside, MD 80465

Bill To:
  Holland Ltd
  612 Sophia Hollow Suite 113, South Shawn, TN 97905

──────────────────────────────────────────────────
Item                             Qty      Price     Amount
──────────────────────────────────────────────────
Ball Bearing 6205-2RS            465 GBP     6.23 GBP  2896.95
Copper Wire 14AWG (100ft)        289 GBP    64.72 GBP 18704.08
Hydraulic Cylinder 3in Bore       43 GBP   236.05 GBP 10150.15
PVC Pipe 2in x 10ft               70 GBP    13.00 GBP   910.00
Thermal Paste 30g                 94 GBP     2.40 GBP   225.60
Air Filter Cartridge             195 GBP     9.16 GBP  1786.20
Steel Bolts M10x50               233 GBP     3.08 GBP   717.64
──────────────────────────────────────────────────
Subtotal:                                     GBP 35390.62
Tax (8.5%):                                   GBP  3008.20
TOTAL:                                        GBP 38398.82

Payment Terms: 2/10 Net 30
Due Date: 2025-11-30

Thank you for your business!
---

[Assistant] {"common":{"document_type":"invoice","date":"2025-10-16","issuer":{"name":"Whitney, Coffey and Ballard","address":"48175 Richards View Suite 137, New Nicoleside, MD 80465"},"recipient":{"name":"Holland Ltd","address":"612 Sophia Hollow Suite 113, South Shawn, TN 97905"},"total_amount":38398.82,"currency":"GBP"},"line_items":[{"description":"Ball Bearing 6205-2RS","quantity":465,"unit_price":6.23,"amount":2896.95},{"description":"Copper Wire 14AWG (100ft)","quantity":289,"unit_price":64.72,"amount":18704.08},{"description":"Hydraulic Cylinder 3in Bore","quantity":43,"unit_price":236.05,"amount":10150.15},{"description":"PVC Pipe 2in x 10ft","quantity":70,"unit_price":13.0,"amount":910.0},{"description":"Thermal Paste 30g","quantity":94,"unit_price":2.4,"amount":225.6},{"description":"Air Filter Cartridge","quantity":195,"unit_price":9.16,"amount":1786.2},{"description":"Steel Bolts M10x50","quantity":233,"unit_price":3.08,"amount":717.64}],"type_specific":{"invoice_number":"INV-2023-6507","due_date":"2025-11-30","payment_terms":"2/10 Net 30","tax_amount":3008.2,"subtotal":35390.62},"flags":[],"confidence_score":0.95}


[System]
You are a financial document extraction expert. Your task is to:

1. Identify the document type (invoice, purchase_order, receipt, or bank_statement).
2. Extract all relevant fields into a structured JSON object following this exact schema:
   - "common": document_type, date, issuer (name, address), recipient (name, address), total_amount, currency
   - "line_items": array of {description, quantity, unit_price, amount}
   - "type_specific": fields specific to the document type
   - "flags": array of detected anomalies, each with {category, field, severity, description}
   - "confidence_score": your confidence in the extraction (0.0 to 1.0)

3. Analyze the document for anomalies across these categories:
   - arithmetic_error: Mathematical calculations that don't add up
   - missing_field: Required fields that are absent from the document
   - format_anomaly: Inconsistent formats, negative quantities, duplicate entries
   - business_logic: Unusual amounts, suspicious patterns, round-number fraud indicators
   - cross_field: Mismatched references between related fields or documents

4. If no anomalies are found, return an empty "flags" array.

Output ONLY valid JSON. No explanations, no markdown, no code blocks — just the raw JSON object.

[User]
Extract structured data from this financial document:

---
==================================================
INVOICE
==================================================

Invoice Number: INV-2024-6439
Date: 2025-04-22

From:
  Jimenez, Glass and Stone
  69284 Garcia Islands Suite 479, Jacksonmouth, MI 59107

Bill To:
  Acosta LLC
  0165 Stephanie Divide Suite 021, Port Deanna, MN 50682

──────────────────────────────────────────────────
Item                             Qty      Price     Amount
──────────────────────────────────────────────────
Rubber O-Ring Seals              241 USD     1.90 USD   457.90
Air Filter Cartridge             136 USD     9.32 USD  1267.52
Hydraulic Cylinder 3in Bore      355 USD   178.41 USD 63335.55
Steel Bolts M10x50                42 USD     7.31 USD   307.02
Copper Wire 14AWG (100ft)        437 USD    65.57 USD 28654.09
Stainless Steel Sheet 4x8ft      274 USD    99.72 USD 27323.28
Cable Ties 12in (100pk)          163 USD     5.88 USD   958.44
Nitrile Gloves Box (100)         455 USD    14.11 USD  6420.05
──────────────────────────────────────────────────
Subtotal:                                     USD 128723.85
Tax (10.0%):                                  USD 12872.39
TOTAL:                                        USD 141596.24

Payment Terms: Net 30
Due Date: 2025-05-22

Thank you for your business!

Referenced Purchase Order: PO-2020-93853
---

[Assistant] {"common":{"document_type":"invoice","date":"2025-04-22","issuer":{"name":"Jimenez, Glass and Stone","address":"69284 Garcia Islands Suite 479, Jacksonmouth, MI 59107"},"recipient":{"name":"Acosta LLC","address":"0165 Stephanie Divide Suite 021, Port Deanna, MN 50682"},"total_amount":141596.24,"currency":"USD"},"line_items":[{"description":"Rubber O-Ring Seals","quantity":241,"unit_price":1.9,"amount":457.9},{"description":"Air Filter Cartridge","quantity":136,"unit_price":9.32,"amount":1267.52},{"description":"Hydraulic Cylinder 3in Bore","quantity":355,"unit_price":178.41,"amount":63335.55},{"description":"Steel Bolts M10x50","quantity":42,"unit_price":7.31,"amount":307.02},{"description":"Copper Wire 14AWG (100ft)","quantity":437,"unit_price":65.57,"amount":28654.09},{"description":"Stainless Steel Sheet 4x8ft","quantity":274,"unit_price":99.72,"amount":27323.28},{"description":"Cable Ties 12in (100pk)","quantity":163,"unit_price":5.88,"amount":958.44},{"description":"Nitrile Gloves Box (100)","quantity":455,"unit_price":14.11,"amount":6420.05}],"type_specific":{"invoice_number":"INV-2024-6439","due_date":"2025-05-22","payment_terms":"Net 30","tax_amount":12872.39,"subtotal":128723.85},"flags":[{"category":"cross_field","field":"referenced_po","severity":"high","description":"Invoice references Purchase Order 'PO-2020-93853' which could not be verified in the system."}],"confidence_score":0.95}