theekshana commited on
Commit
e910e3b
1 Parent(s): 83a86f4

max marginal retreval

Browse files
__pycache__/qaPipeline.cpython-311.pyc CHANGED
Binary files a/__pycache__/qaPipeline.cpython-311.pyc and b/__pycache__/qaPipeline.cpython-311.pyc differ
 
app.py CHANGED
@@ -230,6 +230,7 @@ def handle_userinput(query):
230
  except Exception as e:
231
  # logger.error(f"Answer retrieval failed with {e}")
232
  st.error(f"Error Occured! see log info for more details.")#, icon=":books:")
 
233
  return
234
 
235
 
 
230
  except Exception as e:
231
  # logger.error(f"Answer retrieval failed with {e}")
232
  st.error(f"Error Occured! see log info for more details.")#, icon=":books:")
233
+ print(f"> Error Occured! {e}.")#, icon=":books:")
234
  return
235
 
236
 
qaPipeline.py CHANGED
@@ -216,7 +216,7 @@ class QAPipeline:
216
  """
217
  You are the AI of company boardpac which provide services to company board members.
218
  please answer the question based on the chat history and context information provided below related to central bank acts published in various years.
219
- The published year may indicated in the source of metadata of each source document annd in the content itself.
220
 
221
  The content of a bank act of a past year can updated by a bank act from a latest year.
222
  Always try to answer with latest information and mention the year which information extracted if possible.
@@ -236,8 +236,14 @@ class QAPipeline:
236
  bank_regulations_qa = ConversationalRetrievalChain.from_llm(
237
  llm=self.llm,
238
  chain_type="stuff",
239
- retriever = self.vectorstore.as_retriever(),
240
- # retriever = self.vectorstore.as_retriever(search_kwargs={"k": target_source_chunks}
 
 
 
 
 
 
241
  return_source_documents= True,
242
  get_chat_history=lambda h : h,
243
  combine_docs_chain_kwargs={"prompt": retrieval_qa_chain_prompt},
 
216
  """
217
  You are the AI of company boardpac which provide services to company board members.
218
  please answer the question based on the chat history and context information provided below related to central bank acts published in various years.
219
+ The published year may indicated in the source of metadata of each source document.
220
 
221
  The content of a bank act of a past year can updated by a bank act from a latest year.
222
  Always try to answer with latest information and mention the year which information extracted if possible.
 
236
  bank_regulations_qa = ConversationalRetrievalChain.from_llm(
237
  llm=self.llm,
238
  chain_type="stuff",
239
+ # retriever = self.vectorstore.as_retriever(),
240
+ retriever = self.vectorstore.as_retriever(
241
+ search_type="mmr",
242
+ search_kwargs={
243
+ 'k': 4,
244
+ # 'lambda_mult': 0.1,
245
+ 'fetch_k': 40}
246
+ ),
247
  return_source_documents= True,
248
  get_chat_history=lambda h : h,
249
  combine_docs_chain_kwargs={"prompt": retrieval_qa_chain_prompt},