datacipen commited on
Commit
263ee50
1 Parent(s): aa3f4d2

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -69,7 +69,7 @@ def Retriever(categorie):
69
  if categorie != "year":
70
  retriever = vectorstore.as_retriever(search_type="similarity_score_threshold", search_kwargs={"score_threshold": .7, "k": 150,"filter": {'categorie': {'$eq': categorie}}})
71
  else:
72
- retriever = vectorstore.as_retriever(search_type="similarity_score_threshold", search_kwargs={"score_threshold": .7, "k": 25,"filter": {'year': {'$gte': 2019}}})
73
  #search = vectorstore.similarity_search(query,k=50, filter={"categorie": {"$eq": "bibliographie-OPP-DGDIN"}, 'Source': {'$eq': 'Source : Persée'}})
74
  return retriever
75
 
@@ -95,8 +95,8 @@ def Search(input, categorie):
95
  for i in range(0,len(search)):
96
  if count <= 15:
97
  count = count + 1
98
- sources_text = sources_text + str(count) + ". " + search[i].metadata['title'] + ' (JDLP : ' + str(search[i].metadata['year']) + '), ' + search[i].metadata['author'] + ', ' + search[i].metadata['file'] + "\n"
99
- verbatim_text = verbatim_text + "<p>" + str(count) + ". JDLP : " + search[i].metadata['jdlp'] + "</p><p>" + search[i].metadata['text'] + "</p>"
100
 
101
  results = [sources_text, verbatim_text]
102
  return results
 
69
  if categorie != "year":
70
  retriever = vectorstore.as_retriever(search_type="similarity_score_threshold", search_kwargs={"score_threshold": .7, "k": 150,"filter": {'categorie': {'$eq': categorie}}})
71
  else:
72
+ retriever = vectorstore.as_retriever(search_type="similarity_score_threshold", search_kwargs={"score_threshold": .7, "k": 6,"filter": {'year': {'$gte': 2019}}})
73
  #search = vectorstore.similarity_search(query,k=50, filter={"categorie": {"$eq": "bibliographie-OPP-DGDIN"}, 'Source': {'$eq': 'Source : Persée'}})
74
  return retriever
75
 
 
95
  for i in range(0,len(search)):
96
  if count <= 15:
97
  count = count + 1
98
+ sources_text = sources_text + str(count) + ". " + search[i].metadata['title'] + ' (JDLP : ' + str(search[i].metadata['year']) + '), ' + search[i].metadata['author'] + ', https://cipen.univ-gustave-eiffel.fr/fileadmin/CIPEN/OPP/' + search[i].metadata['file'] + "\n"
99
+ verbatim_text = verbatim_text + "<p>" + str(count) + ". JDLP : " + search[i].metadata['jdlp'] + "</p><p>" + search[i].page_content + "</p>"
100
 
101
  results = [sources_text, verbatim_text]
102
  return results