Repository navigation
fix(retrieval,llm): improve dental/statutory ranking and suppress unsolicited grievance forms in Lookup - #882
Conversation
…olicited grievance forms in Lookup
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 27 minutes. View limit details
Walkthrough
Merge Risk:
|
Fixes unsolicited grievance-form dumps and hybrid retrieval ranking regressions on plain dental benefits and statutory lookup queries.
UNION_MANDATORY_RULES(Rules 1 & 5) and Lookup persona wording inapp/services/llm.pyso Lookup mode does not suggest filing a grievance or output/public/docs/forms/Grievance_-_*.pdflinks on general benefits, policy, or statutory questions, while aligning Rule 1 exception, Rule 5, and Lookup persona on the exact same three explicit request categories (filing a grievance, grievance forms, or challenging an employer denial or contract violation) and preserving Grieve mode's strategic grievance-path role without conflict.query_requests_grievance_forms()andinclude_grievance_formsfiltering onbuild_reference_links()(app/services/llm.py,app/main.py) so general Lookup queries omit retrievedforms/documents fromReference Documentsunless the user explicitly asks about filing a grievance, grievance forms, or challenging an employer denial/violation (while Grieve mode and direct callers retain them).app/indexing.py(_BM25Index.search, preserving legal section markers like"s"in"s. 21"and falling back to unfiltered tokens if all tokens are stopwords) and lowers_RRF_Kfrom60to3so the 1.5x Tier 1/Tier 3 weight ratio only breaks close ties instead of letting distant Tier 1 chunks override rank-1 statutory or benefits chunks.s08_dental_benefits_coverage("What are my dental benefits?", category-bound percentage anchorsBasic ... 100%/Major ... 65%/Orthodontic ... 55%/lifetime ... $3,500, andforbidden_patternsrejecting/public/docs/forms/Grievance_-_, rendered grievance form titles,Filing a Grievance, and direct grievance-filing advice) toapp/tests/integration/suitability_prompts.json, preserves rendered<a href>destinations during Chainlit DOM extraction in.github/scripts/eval_test_space.py, and checksforbidden_patternsacross both answer body andReference Documents._RRF_Kfrom60to3changes global hybrid retrieval ranking across all queries (giving steeper priority to top-2 FAISS/BM25 ranks over rank 4+ Tier 1 chunks) and will re-rank some borderline Tier 1 vs Tier 3 ties.s08_dental_benefits_coverageexpands the blocking TEST Space suitability gate (eval_test_space.py) from 7 to 8 prompts; live TEST Space promotion to PROD will now fail if"What are my dental benefits?"swaps coverage percentages, states an annual rather than lifetime$3,500maximum, suggests filing a grievance, or dumps unsolicited grievance form links in the body orReference Documents.Reference Documentsfiltering could cause an edge-case implicit complaint in Lookup mode without explicit grievance/challenge keywords to omitforms/links unless the user mentions filing a grievance, grievance forms, or challenging an employer denial/violation.tests/integration/test_golden_retrieval.py, 30 questions invexilon:dev): improved from 28/30 (93.3%) top-5, 28/30 (93.3%) top-10 (missingq01,q02) to 29/30 (96.7%) top-5, 30/30 (100.0%) top-10 (q02in top 5,q01in top 10,section_ref5/6 top-5 / 6/6 top-10, all other categories 6/6 top-5)._RRF_K=3vs_RRF_K=60baseline):"What are my dental benefits?":#1 EXTENDED HEALTH AND DENTAL PLANS,#2 DENTAL BENEFITS AT A GLANCE"What are my dental benefits as a seasonal employee?":0/5->#4 BC Bargaining Unit Health and Dental Benefits | DENTAL BENEFITS AT A GLANCEalongsideAPPENDIX 4,APPENDIX A - SEASONAL REGULAR EMPLOYEES,MOU 35"What are my dental benefits as an auxiliary employee?":0/5->#2 BC Bargaining Unit Benefits Overview | ON THIS PAGE(auxiliary dental eligibility table) alongside Main Agreement Article 31 (31.11,31.6,31.8,31.1)"What are my extended health benefits?": 4/5 H&D (#1 EXTENDED HEALTH BENEFITS AT A GLANCE) +WORK STATUS CHANGES"What is my vision coverage?": 5/5 H&D"dental plan":#2->#1 DENTAL BENEFITS AT A GLANCE(5/5 H&D)docker.io/library/vexilon:dev):pytest -s tests/test_index.py tests/test_retrieval_eval.py tests/test_verify_response.py tests/test_grieve_draft_error.py tests/test_rag_stream.py tests/integration/test_golden_retrieval.py ../tests/deploy_integrity/test_suitability_gate.py-> 163 passed, 1 skipped (test_compose_yml_does_not_hardcode_model_nameskipped in/repo/appcontainer layout).python /repo/.github/scripts/eval_test_space.py --prompts /repo/app/tests/integration/suitability_prompts.json --data-dir /repo/app/data --dry-run --break-it): 8/8 prompts passed and 7 adversarial failure cases blocked promotion as expected.Summary by CodeRabbit