Spaces:
Sleeping
fix(routing): KI-153 — profile-update utterances now route to fact_find
Browse filesLive bug: user said 'My name is Rohit' and 'I am 29 years old' on the
deployed bot. Both were classified as intent=qa and routed to the QA
brain, which had no idea what to do with them and produced defensive
'not enough evidence in the policy documents' replies. The fact-find
flow never even started.
Root cause: classify_intent in backend/orchestrator.py uses a keyword
trigger list (FACT_FIND_TRIGGERS) and falls through to 'qa' on no match.
The list covered advice-seeking openers ('looking for', 'i want',
'should i') and greetings ('hi', 'hello') but NOT profile-answer
phrasings — the exact text users produce when answering fact-find
questions. Result: any name/age/city/family answer was misrouted.
Fix: extend FACT_FIND_TRIGGERS with profile-answer patterns —
'my name is', 'call me', 'i am ', 'i'm ', 'years old', 'live in',
'married', 'single', 'with spouse', 'have kids', 'have parents',
'my income', 'first policy', etc. These match the natural answers
users give to fact-find questions and route them to fact_find_brain
for slot capture instead of QA brain's defensive refusals.
Verified localhost: 'My name is Rohit' -> fact_find_brain, profile
captures {name:'Rohit'}, natural reply 'Hi Rohit, how old are you?'
'I am 29 years old' -> fact_find_brain, profile captures {age:29}.
Both reply conversationally with appropriate next slot question.
- backend/orchestrator.py +16 -0
|
@@ -43,6 +43,22 @@ FACT_FIND_TRIGGERS = (
|
|
| 43 |
"want to buy", "best policy for me", "what do you recommend",
|
| 44 |
"i don't have", "no policy", "no insurance",
|
| 45 |
"hi", "hello", "hey", "namaste",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
)
|
| 47 |
|
| 48 |
COMPARISON_KEYWORDS = (
|
|
|
|
| 43 |
"want to buy", "best policy for me", "what do you recommend",
|
| 44 |
"i don't have", "no policy", "no insurance",
|
| 45 |
"hi", "hello", "hey", "namaste",
|
| 46 |
+
# KI-153 (2026-05-15) — profile-update phrasings. When a user provides
|
| 47 |
+
# personal information (name, age, city, family, income, existing
|
| 48 |
+
# cover), classify_intent was returning "qa" because none of these
|
| 49 |
+
# matched the recommend/comparison/fact-find triggers. They'd go to QA
|
| 50 |
+
# brain which had no idea what to do and produced defensive "not
|
| 51 |
+
# enough evidence in the policy documents" replies. These patterns
|
| 52 |
+
# cover the answers users give during fact-find collection so the
|
| 53 |
+
# orchestrator can route them back to fact_find_brain for slot capture.
|
| 54 |
+
"my name is", "i am called", "call me", "i'm called",
|
| 55 |
+
"i am ", "i'm ", "im ", # "I am 29 years old", "I'm single"
|
| 56 |
+
"years old", "year old", "age is",
|
| 57 |
+
"live in", "i'm in ", "i am in ", "from ", "based in",
|
| 58 |
+
"married", "single", "with spouse", "with my family",
|
| 59 |
+
"have kids", "have parents", "for my parents", "for my family",
|
| 60 |
+
"my income", "earn ", "salary",
|
| 61 |
+
"first policy", "first time buyer",
|
| 62 |
)
|
| 63 |
|
| 64 |
COMPARISON_KEYWORDS = (
|