ytyeung commited on
Commit
5784cae
1 Parent(s): 3153a86

Add order to retrieved candidates

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -77,7 +77,7 @@ def answer(input_text,context=None):
77
  # tips +="最佳答案\n"
78
  #else:
79
  # tips +="較差答案\n"
80
- tips += f"谜面:{tip[0]} 谜底是:{tip[1]} "
81
  tips +="\n"
82
  print (f"====\n{input_text}\n{context[0][0]} 谜底是:{context[0][1]} {context[0][2]}")
83
  if context[0][2] >=0.9:
@@ -119,7 +119,7 @@ def answer(input_text,context=None):
119
 
120
  # helper function for RAG
121
  def helper_rag(text):
122
- docs_out = vectordb.similarity_search_with_relevance_scores(text,k=1)
123
  #docs_out = vectordb.max_marginal_relevance_search(text,k=5,fetch_k = 20, lambda_mult = 0.5)
124
  context = []
125
  for doc in docs_out:
 
77
  # tips +="最佳答案\n"
78
  #else:
79
  # tips +="較差答案\n"
80
+ tips += f"{i+1}. 谜面:{tip[0]} 谜底是:{tip[1]} "
81
  tips +="\n"
82
  print (f"====\n{input_text}\n{context[0][0]} 谜底是:{context[0][1]} {context[0][2]}")
83
  if context[0][2] >=0.9:
 
119
 
120
  # helper function for RAG
121
  def helper_rag(text):
122
+ docs_out = vectordb.similarity_search_with_relevance_scores(text,k=3)
123
  #docs_out = vectordb.max_marginal_relevance_search(text,k=5,fetch_k = 20, lambda_mult = 0.5)
124
  context = []
125
  for doc in docs_out: