Sriramsr3 commited on
Commit
c225f9a
Β·
verified Β·
1 Parent(s): 727297a

Update rag_chain.py

Browse files
Files changed (1) hide show
  1. rag_chain.py +2 -4
rag_chain.py CHANGED
@@ -53,8 +53,6 @@ Your tasks:
53
  - If the query is intent-based, answer in **1-2 clear sentences** based on the provided policy excerpt [Detailed reason/Detailed Explanation].
54
  - If the query is decision-based, Identify both coverage clause or benefit section , Exclusion or waiting period clause (if any applies) respond in this format:
55
  [Yes/No] – [Procedure] is [covered/not covered] under [Coverage Clause/Section] and subject to [Exclusion/Waiting Period Clause/Section] because [Detailed reason/Detailed Explanation].
56
- - If the query is **general**, respond accurately using the provided policy excerpt, giving the most relevant and clear answer possible in **1-2 sentences** [Detailed reason/Detailed Explanation].
57
-
58
 
59
  User question: {query}
60
  Policy excerpt: {context}
@@ -180,12 +178,12 @@ def build_rag_chain(pdf_path: str, rebuild_index=False):
180
 
181
  # βœ… Create retrievers
182
  bm25_retriever = BM25Retriever.from_documents(final_chunks)
183
- bm25_retriever.k = 4
184
 
185
  retriever = EnsembleRetriever(
186
  retrievers=[
187
  bm25_retriever,
188
- vectorstore.as_retriever(search_type="mmr", search_kwargs={"k": 10 , "lambda_mult": 0.5})
189
  ],
190
  weights=[0.4, 0.6]
191
  )
 
53
  - If the query is intent-based, answer in **1-2 clear sentences** based on the provided policy excerpt [Detailed reason/Detailed Explanation].
54
  - If the query is decision-based, Identify both coverage clause or benefit section , Exclusion or waiting period clause (if any applies) respond in this format:
55
  [Yes/No] – [Procedure] is [covered/not covered] under [Coverage Clause/Section] and subject to [Exclusion/Waiting Period Clause/Section] because [Detailed reason/Detailed Explanation].
 
 
56
 
57
  User question: {query}
58
  Policy excerpt: {context}
 
178
 
179
  # βœ… Create retrievers
180
  bm25_retriever = BM25Retriever.from_documents(final_chunks)
181
+ bm25_retriever.k = 5
182
 
183
  retriever = EnsembleRetriever(
184
  retrievers=[
185
  bm25_retriever,
186
+ vectorstore.as_retriever(search_type="mmr", search_kwargs={"k": 12 , "lambda_mult": 0.5})
187
  ],
188
  weights=[0.4, 0.6]
189
  )