prasadnu commited on
Commit
8a1e73f
·
1 Parent(s): fa84d86

change ksize in RAG

Browse files
RAG/rag_DocumentSearcher.py CHANGED
@@ -312,15 +312,15 @@ def query_(awsauth,inputs, session_id,search_types):
312
  is_table_in_result = True
313
  #table_res = invoke_models.read_from_table(hit["_source"]["table"],question) # use for complex analytical dataframe questions (uses panda at the background))
314
  df.append({'name':hit["_source"]["table"],'text':hit["_source"]["processed_element"]})
315
- context_tables.append(str(id) + " : Reference from a table :" + hit["_source"]["processed_element"])#table_res+"\n\n"+
316
 
317
  else:
318
  if(hit["_source"]["image"]!="None"):
319
  with open(parent_dirname+'/figures/'+st.session_state.input_index+"/"+hit["_source"]["raw_element_type"].split("_")[1].replace(".jpg","")+"-resized.jpg", "rb") as read_img:
320
  input_encoded = base64.b64encode(read_img.read()).decode("utf8")
321
- context.append(str(id) + " : Reference from a image :" + invoke_models.generate_image_captions_llm(input_encoded,question))
322
  else:
323
- context.append(str(id) + " : Reference from a text chunk :" + hit["_source"]["processed_element"])
324
 
325
  if(hit["_source"]["image"]!="None"):
326
  images_2.append({'file':hit["_source"]["image"],'caption':hit["_source"]["processed_element"]})
 
312
  is_table_in_result = True
313
  #table_res = invoke_models.read_from_table(hit["_source"]["table"],question) # use for complex analytical dataframe questions (uses panda at the background))
314
  df.append({'name':hit["_source"]["table"],'text':hit["_source"]["processed_element"]})
315
+ context_tables.append(str(id+1) + " : Reference from a table :" + hit["_source"]["processed_element"])#table_res+"\n\n"+
316
 
317
  else:
318
  if(hit["_source"]["image"]!="None"):
319
  with open(parent_dirname+'/figures/'+st.session_state.input_index+"/"+hit["_source"]["raw_element_type"].split("_")[1].replace(".jpg","")+"-resized.jpg", "rb") as read_img:
320
  input_encoded = base64.b64encode(read_img.read()).decode("utf8")
321
+ context.append(str(id+1) + " : Reference from a image :" + invoke_models.generate_image_captions_llm(input_encoded,question))
322
  else:
323
+ context.append(str(id+1) + " : Reference from a text chunk :" + hit["_source"]["processed_element"])
324
 
325
  if(hit["_source"]["image"]!="None"):
326
  images_2.append({'file':hit["_source"]["image"],'caption':hit["_source"]["processed_element"]})
pages/Multimodal_Conversational_Search.py CHANGED
@@ -436,7 +436,7 @@ with st.sidebar:
436
  #st.button("Show similarity map",key="input_sim_map",on_click=handle_input,args=('colpali_show_similarity_map',True))
437
 
438
  with st.expander("Sample questions for Colpali retriever:"):
439
- st.write("1. Proportion of female new hires 2021-2023? \n\n 2. First-half 2021 return on unlisted real estate investments? \n\n 3. Trend of the fund's expected absolute volatility between January 2014 and January 2016? \n\n 4. Fund return percentage in 2017? \n\n 5. Annualized gross return of the fund from 1997 to 2008?")
440
 
441
 
442
 
 
436
  #st.button("Show similarity map",key="input_sim_map",on_click=handle_input,args=('colpali_show_similarity_map',True))
437
 
438
  with st.expander("Sample questions for Colpali retriever:"):
439
+ st.write("1. Proportion of female new hires 2021-2023? \n\n 2. hula hoop kid \n\n 3. First-half 2021 return on unlisted real estate investments? \n\n 4. Trend of the fund's expected absolute volatility between January 2014 and January 2016? \n\n 5. Fund return percentage in 2017? \n\n 6. Annualized gross return of the fund from 1997 to 2008?")
440
 
441
 
442
 
semantic_search/all_search_execute.py CHANGED
@@ -151,7 +151,7 @@ def handler(input_,session_id):
151
  ######### Create the queries for hybrid search #########
152
 
153
 
154
- path = "demostore-search-index/_search"
155
 
156
  url = host + path
157
 
@@ -412,7 +412,7 @@ def handler(input_,session_id):
412
  del hybrid_payload["query"]["hybrid"]
413
  hybrid_payload["query"] = single_query
414
  if(st.session_state.re_ranker == 'true' and st.session_state.input_reranker == 'Cohere Rerank'):
415
- path = "demostore-search-index/_search?search_pipeline=rerank_pipeline"
416
  url = host + path
417
  hybrid_payload["ext"] = {"rerank": {
418
  "query_context": {
 
151
  ######### Create the queries for hybrid search #########
152
 
153
 
154
+ path = "demostore-search-index-reindex/_search"
155
 
156
  url = host + path
157
 
 
412
  del hybrid_payload["query"]["hybrid"]
413
  hybrid_payload["query"] = single_query
414
  if(st.session_state.re_ranker == 'true' and st.session_state.input_reranker == 'Cohere Rerank'):
415
+ path = "demostore-search-index-reindex/_search?search_pipeline=rerank_pipeline"
416
  url = host + path
417
  hybrid_payload["ext"] = {"rerank": {
418
  "query_context": {