github-actions[bot]
commited on
Commit
·
e964001
1
Parent(s):
b168249
Sync from GitHub: c92cec18d31886d94642ced850e1385758cfff7d
Browse files- inference.py +18 -13
inference.py
CHANGED
|
@@ -67,34 +67,29 @@ Output rules:
|
|
| 67 |
COMBINED_REASONING_EXTRACTION_PROMPT = """
|
| 68 |
Analyze this Indian tractor invoice using Chain of Thought reasoning.
|
| 69 |
|
| 70 |
-
First, share your observations about the
|
| 71 |
-
|
| 72 |
-
DEALER NAME:
|
| 73 |
-
- Where do you see it? (header, letterhead, stamp)
|
| 74 |
-
- What language? What exact text?
|
| 75 |
|
| 76 |
MODEL NAME:
|
| 77 |
-
- How is it presented? (checkbox/handwritten/printed)
|
| 78 |
-
- If checkboxes
|
| 79 |
- What exact text do you see?
|
|
|
|
| 80 |
|
| 81 |
HORSE POWER:
|
| 82 |
- Where is HP mentioned?
|
| 83 |
- Explicit text like "49 HP" or in checkbox?
|
| 84 |
-
- Which value is
|
| 85 |
- HP must come from explicit HP text only, never from model numbers
|
|
|
|
|
|
|
| 86 |
|
| 87 |
-
ASSET COST:
|
| 88 |
-
- Where is the final total?
|
| 89 |
-
- Which amount is after all taxes?
|
| 90 |
-
- What exact amount with currency?
|
| 91 |
|
| 92 |
After reasoning, extract the fields.
|
| 93 |
|
| 94 |
Return ONLY valid JSON:
|
| 95 |
{{
|
| 96 |
"reasoning": "your observations and thoughts here",
|
| 97 |
-
"dealer_name": string,
|
| 98 |
"model_name": string,
|
| 99 |
"horse_power": number,
|
| 100 |
"asset_cost": number
|
|
@@ -108,6 +103,16 @@ Rules for extraction:
|
|
| 108 |
- Dealer is usually at top header
|
| 109 |
- If handwriting unclear, make best interpretation but preserve language
|
| 110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
Output ONLY valid JSON, no markdown.
|
| 112 |
"""
|
| 113 |
|
|
|
|
| 67 |
COMBINED_REASONING_EXTRACTION_PROMPT = """
|
| 68 |
Analyze this Indian tractor invoice using Chain of Thought reasoning.
|
| 69 |
|
| 70 |
+
First, share your observations about the 2 key fields:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
MODEL NAME:
|
| 73 |
+
- How is it presented? (checkbox/handwritten/printed or any other way)
|
| 74 |
+
- If a checkboxes or anything marked?
|
| 75 |
- What exact text do you see?
|
| 76 |
+
- Based on this, which model name you think is involved in the deal.
|
| 77 |
|
| 78 |
HORSE POWER:
|
| 79 |
- Where is HP mentioned?
|
| 80 |
- Explicit text like "49 HP" or in checkbox?
|
| 81 |
+
- Which value is marked?
|
| 82 |
- HP must come from explicit HP text only, never from model numbers
|
| 83 |
+
- If only one value for HP is associated with the correct Model name, it is the models HP.
|
| 84 |
+
- If multiple HP values are associated with the correct Model, the correct HP will be usuall marked.
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
After reasoning, extract the fields.
|
| 88 |
|
| 89 |
Return ONLY valid JSON:
|
| 90 |
{{
|
| 91 |
"reasoning": "your observations and thoughts here",
|
| 92 |
+
"dealer_name": "string",
|
| 93 |
"model_name": string,
|
| 94 |
"horse_power": number,
|
| 95 |
"asset_cost": number
|
|
|
|
| 103 |
- Dealer is usually at top header
|
| 104 |
- If handwriting unclear, make best interpretation but preserve language
|
| 105 |
|
| 106 |
+
|
| 107 |
+
Extraction hints:
|
| 108 |
+
- Dealer name is usually at the top header or company name.
|
| 109 |
+
- Model name often appears near words like Model, Tractor, Variant.
|
| 110 |
+
- Horse power must come ONLY from explicit HP text, never from model numbers.
|
| 111 |
+
- Horse power may appear as "HP", handwritten like "49 HP", "63hp", "HP-30".
|
| 112 |
+
- Remove commas and currency symbols from numbers only.
|
| 113 |
+
- If handwriting is unclear, make your best reasonable interpretation of the characters — but preserve language.
|
| 114 |
+
|
| 115 |
+
|
| 116 |
Output ONLY valid JSON, no markdown.
|
| 117 |
"""
|
| 118 |
|