devve1 commited on
Commit
c29f6a3
1 Parent(s): ebed8ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -242,9 +242,12 @@ def generate_answer(query: str,
242
  s = time.time()
243
 
244
  if search_strategy == 'Exact Search':
245
- scored_points = query_keywords_search(query, client, collection_name, sparse_embeddings).points
246
 
247
- answer = f"{scored_points[0].payload['text']}\n\n\nSource :\n\n{scored_points[0].payload['metadata']}"
 
 
 
248
  else:
249
  regex = build_regex_from_schema(schema, r"[\n ]?")
250
  gen_text = outlines.generate.regex(llm, regex)
 
242
  s = time.time()
243
 
244
  if search_strategy == 'Exact Search':
245
+ scored_point = query_keywords_search(query, client, collection_name, sparse_embeddings).points[0]
246
 
247
+ text = scored_point.payload['text']
248
+ metadata = scored_point.payload['metadata']
249
+
250
+ answer = f"{text}\n\n\nSource :\n\n{metadata}"
251
  else:
252
  regex = build_regex_from_schema(schema, r"[\n ]?")
253
  gen_text = outlines.generate.regex(llm, regex)