ppsingh commited on
Commit
bcd119c
1 Parent(s): fc4f679

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -15
app.py CHANGED
@@ -109,23 +109,21 @@ async def chat(query,history,sources,reports,subtype,year):
109
  vectorstore = vectorstores["allreports"]
110
 
111
  ##------------------------------get context----------------------------------------------------
112
- #context_retrieved_lst = []
113
- #question_lst= [query]
114
- #for question in question_lst:
115
- # retriever = vectorstore.as_retriever(
116
- # search_type="similarity_score_threshold", search_kwargs={"score_threshold": 0.6, "k": 3})
117
- #
118
- # context_retrieved = retriever.invoke(question)
119
- #
120
- # def format_docs(docs):
121
- # return "\n\n".join(doc.page_content for doc in docs)
122
 
123
- # context_retrieved_formatted = format_docs(context_retrieved)
124
- # context_retrieved_lst.append(context_retrieved_formatted)
125
- # print(context_retrieved_lst)
126
 
127
-
128
-
129
  yield history,docs_html
130
  #process_pdf()
131
 
 
109
  vectorstore = vectorstores["allreports"]
110
 
111
  ##------------------------------get context----------------------------------------------------
112
+ context_retrieved_lst = []
113
+ question_lst= [query]
114
+ for question in question_lst:
115
+ retriever = vectorstore.as_retriever(
116
+ search_type="similarity_score_threshold", search_kwargs={"score_threshold": 0.6, "k": 3})
117
+
118
+ context_retrieved = retriever.invoke(question)
119
+
120
+ def format_docs(docs):
121
+ return "\n\n".join(doc.page_content for doc in docs)
122
 
123
+ context_retrieved_formatted = format_docs(context_retrieved)
124
+ context_retrieved_lst.append(context_retrieved_formatted)
125
+ print(context_retrieved_lst)
126
 
 
 
127
  yield history,docs_html
128
  #process_pdf()
129