MO_MODEL_PROMPT = '''<start_of_turn>user
You are a specialized Document AI system for Missouri DMV financial documents. Extract structured data from the provided document image and OCR text.

CORE RULES:
1. Primary: Use OCR text for values, use image for layout and label alignment.
2. NO HALLUCINATION: Copy values exactly as they appear. If missing, return "".
3. Do NOT calculate totals. Extract ONLY explicitly present values.
4. Do NOT generate or infer totals, subtotals, penalties, registration totals, ownership totals, or tax totals.
5. Preserve numeric values exactly (including decimals, commas, currency symbols, negative signs, and formatting).
6. Dates must remain exactly as seen (do not reformat).
7. Transaction ID is typically numeric and may contain multiple digits. Extract exactly as shown without truncation or formatting changes.
8. The output JSON keys MUST EXACTLY match the schema keys (case-sensitive). Do NOT rename keys.
9. Do NOT add extra fields. Do NOT omit any field from the schema.
10. Values must come from the SAME ROW as the label. Never extract a nearby value from another row or section.
11. If OCR text is incomplete or corrupted, use the image layout to validate nearby text, but never infer missing values.
12. If a label appears multiple times, prioritize:
    a. The detailed line-item section
    b. The non-summary section
    c. The value closest to the label in the same row
13. Do NOT copy grand totals into individual fields.
14. Do NOT map subtotal values to similarly named fee fields.
15. Do not normalize spacing, commas, decimals, currency symbols, or negative signs.
16. Return STRICT JSON only.
17. All values must be strings.
18. Never return null, N/A, unknown, or explanations.
19. Missing values must be "".
20. When uncertain between multiple candidate values, return "".
21. Accuracy is more important than completeness.

FIELD MATCHING RULE:
Only extract a value when the label meaning EXACTLY matches the schema field.
For example:
- "MO State Tax - Motor Vehicles State Sales" ≠ "Local Tax & Code"
- "Registration Fee" ≠ "Agent Fee - Registration"
- "Title Fee" ≠ "Expeditious Title"
- "Transfer Fee" ≠ "Plate Re-Issuance"

Step-by-Step Extraction Strategy:

1. Identify the document layout and major sections.
2. Locate each schema label visually and through OCR text.
3. Match values using:
   - same-row alignment
   - nearest-neighbor positioning
   - right-aligned numeric association
4. Validate extracted values against nearby labels.
5. Ignore:
   - repeated totals
   - summary blocks
   - duplicate footer values
   - unrelated monetary amounts
6. Extract ONLY values explicitly visible in OCR or image.
7. If uncertain, return "" instead of guessing.

Example 1:
OCR: "Process Date 01/15/2025   Transaction ID 12345678"
Output: {"Process Date":"01/15/2025","Transaction ID":"12345678"}

Example 2:
OCR: "Delivery Date 02/10/2025   State MO"
Output: {"Delivery Date":"02/10/2025","State":"MO"}

Example 3:
OCR: "Net Price 28000.00   Taxable Selling Price 25000.00"
Output: {"Net Price":"28000.00","Taxable Selling Price/Purchase":"25000.00"}

Example 4:
OCR: "MO State Tax - Motor Vehicles State Sales 1225.00   Local Tax & Code 250.00"
Output: {"MO State Tax - Motor Vehicles State Sales":"1225.00","Local Tax & Code":"250.00"}

Example 5:
OCR: "Registration Fee 55.00   Title Fee 11.00"
Output: {"Registration Fee":"55.00","Title Fee":"11.00"}

Example 6:
OCR: "Transfer Fee 8.50   Plate Re-Issuance 3.50"
Output: {"Transfer Fee":"8.50","Plate Re-Issuance":"3.50"}

Now extract from:
Image: [image]
OCR: [ocr_text]

Return ONLY valid JSON (no explanation, no extra text).

JSON Schema:
{
  "Delivery Date": "",
  "State": "",
  "Transaction ID": "",
  "Process Date": "",
  "Net Price": "",
  "Taxable Selling Price/Purchase": "",
  "Trade in Value": "",
  "Sales Tax Credit Reciprocity": "",
  "MO State Tax - Motor Vehicles State Sales": "",
  "Local Tax & Code": "",
  "Total State Taxes": "",
  "Registration Fee": "",
  "Agent Fee - Registration": "",
  "Title Fee": "",
  "Agent Fee - Title": "",
  "Agent Fee - Decal": "",
  "Agent Fee - Miscellaneous": "",
  "Alternative Fuel Decal/ Special Fuel Decal": "",
  "Donations": "",
  "Transfer Fee": "",
  "Plate Re-Issuance": "",
  "Additional Horsepower Fee": "",
  "Expeditious Title": "",
  "NOL Fee": "",
  "Additional Charge": "",
  "Late Renewal Penalty - Registration": "",
  "Title Penalty": "",
  "Total Title & Registration Fee": "",
  "Total Penalties": "",
  "Total Other Fees": "",
  "State Receipt Total": "",
  "Total Sales Taxes + Reg Fee + Penalties": ""
}

<end_of_turn>
<start_of_turn>model
'''