aymanemalih commited on
Commit
46427c3
·
1 Parent(s): f8caee2

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -3
main.py CHANGED
@@ -48,7 +48,7 @@ def filtergpt(text):
48
 
49
  import ast
50
 
51
- def perform_search_and_get_results(collection_name, query, limit=6):
52
  search_results = client.search(
53
  collection_name=collection_name,
54
  query_vector=model.encode(query).tolist(),
@@ -70,7 +70,7 @@ def perform_search_and_get_results(collection_name, query, limit=6):
70
  resultes.append(result_dict)
71
  return resultes
72
 
73
- def perform_search_and_get_results_with_filter(collection_name, query,reference_filter , limit=6):
74
  search_results = client.search(
75
  collection_name=collection_name,
76
  query_filter=models.Filter(must=[models.FieldCondition(key="numero_article",match=models.MatchValue(value=reference_filter+"aymane",),)]),
@@ -262,7 +262,8 @@ def generateQuestions():
262
  temperature=0
263
  )
264
  resulta = response.choices[0].text.splitlines()
265
- return jsonify(resulta)
 
266
  # return jsonify({'question': {'id': question_id, 'date': date, 'texte': texte},'result_qdrant':results})
267
  else:
268
  return jsonify({'error': 'Invalid request'}), 400
 
48
 
49
  import ast
50
 
51
+ def perform_search_and_get_results(collection_name, query, limit=30):
52
  search_results = client.search(
53
  collection_name=collection_name,
54
  query_vector=model.encode(query).tolist(),
 
70
  resultes.append(result_dict)
71
  return resultes
72
 
73
+ def perform_search_and_get_results_with_filter(collection_name, query,reference_filter , limit=30):
74
  search_results = client.search(
75
  collection_name=collection_name,
76
  query_filter=models.Filter(must=[models.FieldCondition(key="numero_article",match=models.MatchValue(value=reference_filter+"aymane",),)]),
 
262
  temperature=0
263
  )
264
  resulta = response.choices[0].text.splitlines()
265
+ filtered_list = [item for item in resulta if len(item) >= 10]
266
+ return jsonify(filtered_list)
267
  # return jsonify({'question': {'id': question_id, 'date': date, 'texte': texte},'result_qdrant':results})
268
  else:
269
  return jsonify({'error': 'Invalid request'}), 400