Omkar008 commited on
Commit
4f60909
·
verified ·
1 Parent(s): f257105

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -138,6 +138,7 @@ def receipt_radar_prompt(raw_text:str)->str:
138
  "description": "Provide the discount details (amount/percentage), minimum purchase, eligible products, retailer, any terms or restrictions, usage limit (single-use/multi-use), and where the coupon applies (in-store/online)."
139
  }
140
  """
 
141
  system_prompt = f"""Extract information from the following receipt OCR text,Strictly first analyse if the text actually is actually related to a purchase , insurance receipt , travel receipt , hotel receipt or a text having some coupon codes , If it is not a purchase or contains a coupon code then just return null strictly , and return a JSON object with these exact keys: brand, total_cost, location, purchase_category, brand_category, Date, currency, filename, payment_method, metadata.
142
  Rules:
143
  1. For total_cost, use the highest monetary value in the text.
@@ -146,9 +147,8 @@ def receipt_radar_prompt(raw_text:str)->str:
146
  4. Check if the text includes the purchaser's name, receipt or transaction ID, relevant dates, amount paid, service details (insurance, travel, or hotel), and issuer information to verify if it's a valid insurance, travel, or hotel receipt. If you find that its just a promotion email ,don't assum its a travel , insurance or hotel receipt.
147
  4. metadata: For insurance receipts extract the data points given in the JSON and return the JSON with structure: \n """ + insurance_response_structure + """
148
  5.metadata : For travel receipts(flight ,bus,train) extract these data points as a JSON object exactly""" + travel_response_structure + """
149
- 6. metadata : For hotel receipts extract these data points as a JSON object exactly""" + hotel_data_points + f"""
150
- 7. metadata : For coupon receipts extract these data points as a JSON object exactly""" + coupon_data_points + f"""
151
- For non-insurance and non-travel , non-hotel , non-coupon receipts, return metadata as null.Also if you don't find a valid coupon code,then return metadata as null directly strictly follow this rule.
152
  8. Use currency codes (e.g., USD, EUR) instead of symbols.
153
  9. Generate filename as 'PURCHASE_TYPE_BRAND_DATE' (e.g., 'clothing_gucci_20230715').
154
  10. If a value is not found, return null.
 
138
  "description": "Provide the discount details (amount/percentage), minimum purchase, eligible products, retailer, any terms or restrictions, usage limit (single-use/multi-use), and where the coupon applies (in-store/online)."
139
  }
140
  """
141
+ #7. metadata : For coupon receipts extract these data points as a JSON object exactly""" + coupon_data_points +
142
  system_prompt = f"""Extract information from the following receipt OCR text,Strictly first analyse if the text actually is actually related to a purchase , insurance receipt , travel receipt , hotel receipt or a text having some coupon codes , If it is not a purchase or contains a coupon code then just return null strictly , and return a JSON object with these exact keys: brand, total_cost, location, purchase_category, brand_category, Date, currency, filename, payment_method, metadata.
143
  Rules:
144
  1. For total_cost, use the highest monetary value in the text.
 
147
  4. Check if the text includes the purchaser's name, receipt or transaction ID, relevant dates, amount paid, service details (insurance, travel, or hotel), and issuer information to verify if it's a valid insurance, travel, or hotel receipt. If you find that its just a promotion email ,don't assum its a travel , insurance or hotel receipt.
148
  4. metadata: For insurance receipts extract the data points given in the JSON and return the JSON with structure: \n """ + insurance_response_structure + """
149
  5.metadata : For travel receipts(flight ,bus,train) extract these data points as a JSON object exactly""" + travel_response_structure + """
150
+ 6. metadata : For hotel receipts extract these data points as a JSON object exactly""" + hotel_data_points +f"""
151
+ For non-insurance and non-travel , non-hotel , non-coupon receipts, return metadata as null.
 
152
  8. Use currency codes (e.g., USD, EUR) instead of symbols.
153
  9. Generate filename as 'PURCHASE_TYPE_BRAND_DATE' (e.g., 'clothing_gucci_20230715').
154
  10. If a value is not found, return null.