mxp1404 commited on
Commit
417fb82
·
verified ·
1 Parent(s): 4d0a74e

Upload chatbot/retriever.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. chatbot/retriever.py +9 -12
chatbot/retriever.py CHANGED
@@ -1,9 +1,4 @@
1
- """
2
- Retriever wrapping the embedding pipeline.
3
-
4
- Loads MedEmbed + Qdrant client once and exposes a simple `retrieve(query)` interface.
5
- Filters out low-value sections (References, Application) that pollute results.
6
- """
7
 
8
  import sys
9
  import time
@@ -158,12 +153,14 @@ class PolicyRetriever:
158
  page_end=p.get("page_end", 0),
159
  ))
160
 
161
- # Boost Coverage Rationale so it always survives deduplication.
162
- # This ensures the authoritative coverage/non-coverage statement
163
- # is present even when Clinical Evidence chunks score higher.
164
- COVERAGE_BOOST = 0.02
 
 
165
  for r in results:
166
- if r.section == "Coverage Rationale":
167
- r.score += COVERAGE_BOOST
168
 
 
169
  return results
 
1
+ """Policy retrieval via MedEmbed embeddings and Qdrant vector search."""
 
 
 
 
 
2
 
3
  import sys
4
  import time
 
153
  page_end=p.get("page_end", 0),
154
  ))
155
 
156
+ SECTION_BOOST = {
157
+ "Coverage Rationale": 0.04,
158
+ "Coverage Summary": 0.03,
159
+ "Benefit Considerations": 0.01,
160
+ "Documentation Requirements": 0.01,
161
+ }
162
  for r in results:
163
+ r.score += SECTION_BOOST.get(r.section, 0.0)
 
164
 
165
+ results.sort(key=lambda r: r.score, reverse=True)
166
  return results