mirror of
https://github.com/R0m1k3/Priceflow.git
synced 2026-10-11 17:29:14 +02:00
feat: Add AI extraction schemas and prompt templates, and refine price extraction logic to prioritize TTC over HT.
This commit is contained in:
1 parent
384baa3575
commit
83fa8ed734
3 files changed
+9
-3
No files matched your search
+5
-2
@@ -142,8 +142,11 @@ EXTRACTION_PROMPT_TEMPLATE = """Extract product price and stock status from this
|
||||
- Extract as DECIMAL NUMBER: If you see "3.99", return 3.99
|
||||
- Ignore crossed-out/barré prices (old prices)
|
||||
- **CRITICAL:** Ignore "Prix au litre", "Prix au kg", "P.U.", or unit prices usually shown in smaller text/parentheses (e.g., "4.60 € / L").
|
||||
- If multiple prices, take the current/main price (not the original, not the unit price)
|
||||
- **B&M STORES Specific:** The main price is often large and bold (e.g. "1.15€"), while unit price is small (e.g. "4.60 €/L"). ALWAYS take the main price.
|
||||
- **CRITICAL:** If you see both HT (Hors Taxe) and TTC (Toutes Taxes Comprises) prices, **ALWAYS select the TTC price**.
|
||||
- Look for labels like "Taxe incluse", "TTC", "Prix payé". Ignore "HT" or "Hors Taxe".
|
||||
- Example: If text has "1.15 € HT" and "1.38 € TTC", return 1.38 (NOT 1.15).
|
||||
- If multiple prices, take the current/main price (not the original, not the unit price, not the HT price)
|
||||
- **B&M STORES Specific:** The main price is often large and bold (e.g. "1.38€"), while unit price is small. ALWAYS take the main price (TTC). Ignore hidden HT prices (e.g. 1.15€).
|
||||
|
||||
**CRITICAL - Common mistakes to avoid:**
|
||||
- "3.99 €" means 3.99 (NOT 399.00, NOT 3990.00)
|
||||
|
||||
@@ -37,3 +37,4 @@ Improving price extraction reliability for B&M Stores and others.
|
||||
- Improved AI prompt to ignore unit prices (like "Prix au litre").
|
||||
- Enhanced text extraction to remove menu/footer noise.
|
||||
- Verified logic with `verify_extraction_logic.py` (simulated).
|
||||
- **Fixed HT vs TTC issue**: AI was extracting 1.15€ (HT) instead of 1.38€ (TTC). Updated prompt to prioritize "Taxe incluse"/TTC prices.
|
||||
@@ -118,7 +118,9 @@ async def verify_extraction_logic():
|
||||
"CRITICAL",
|
||||
"Ignore \"Prix au litre\"",
|
||||
"B&M STORES Specific",
|
||||
"Extract as DECIMAL NUMBER"
|
||||
"Extract as DECIMAL NUMBER",
|
||||
"ALWAYS select the TTC price",
|
||||
"Ignore \"HT\""
|
||||
]
|
||||
|
||||
all_passed = True
|
||||
|
||||
Reference in new issue
Block a user