Spaces:
Running
Running
jashdoshi77 commited on
Commit ·
a70e179
1
Parent(s): dd8c94f
fix policy_type column mapping
Browse files- services/rag_service.py +12 -6
services/rag_service.py
CHANGED
|
@@ -295,12 +295,18 @@ CRITICAL UNDERSTANDING RULES:
|
|
| 295 |
- Let your intelligence handle all variations and formats
|
| 296 |
|
| 297 |
4. COMPANY NAME EXTRACTION: When user mentions a company name (e.g., "ABC Corp", "XYZ Industries", "Company Name"), extract it to insured_name filter. Extract the company name as mentioned in the query, even if it's partial. The system will handle name variations (case, spacing, suffixes like "Pvt Ltd", singular/plural) automatically.
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
|
| 305 |
FORMAT DETECTION (NEW):
|
| 306 |
1. Detect if user explicitly asks for a specific format:
|
|
|
|
| 295 |
- Let your intelligence handle all variations and formats
|
| 296 |
|
| 297 |
4. COMPANY NAME EXTRACTION: When user mentions a company name (e.g., "ABC Corp", "XYZ Industries", "Company Name"), extract it to insured_name filter. Extract the company name as mentioned in the query, even if it's partial. The system will handle name variations (case, spacing, suffixes like "Pvt Ltd", singular/plural) automatically.
|
| 298 |
+
5. POLICY TYPE RECOGNITION (CRITICAL):
|
| 299 |
+
- Common policy types: GMC (Group Mediclaim), GPA (Group Personal Accident), Fire, Marine, Motor, Health, Liability, Property, Engineering, etc.
|
| 300 |
+
- When user mentions policy types (e.g., "GMC policies", "top 5 GMC", "Fire policies", "Marine insurance"), use policy_type filter, NOT insured_name
|
| 301 |
+
- Context clues: "GMC policies", "Fire policies", "top N [policy type]" → policy_type
|
| 302 |
+
- Company names typically have business keywords (Corp, Ltd, Industries, Chemical, etc.) or are proper nouns
|
| 303 |
+
- If unsure, consider: policy types are usually generic terms (GMC, Fire, Marine) while company names are specific entities (Tata, ABC Corp, Choksey Chemical)
|
| 304 |
+
|
| 305 |
+
6. ALWAYS extract industry/sector names mentioned in the query into the filters
|
| 306 |
+
7. When multiple industries are mentioned (e.g., "manufacturing and healthcare"), combine them with comma: "manufacturing, healthcare"
|
| 307 |
+
8. When user asks for "top N" of something, set both limit AND sort_by appropriately
|
| 308 |
+
9. Keywords like "manufacturing", "healthcare", "retail", "IT", "construction" are INDUSTRIES - put them in filters
|
| 309 |
+
10. COMPANY vs INDIVIDUAL: When user mentions a company name with business keywords (e.g., "ABC Chemical", "XYZ Industries", "Company Corp"), they want COMPANY policies, not individual person policies. The system will automatically filter out individual person names when company keywords are detected.
|
| 310 |
|
| 311 |
FORMAT DETECTION (NEW):
|
| 312 |
1. Detect if user explicitly asks for a specific format:
|