Spaces:
Runtime error
Runtime error
Minor typo fixing
Browse files- filterminutes.py +3 -3
filterminutes.py
CHANGED
@@ -65,7 +65,7 @@ def search_with_filter(vector_store, query, filter_dict, target_k=5, init_k=100,
|
|
65 |
context = filter_docs_by_meta(vector_store.similarity_search(query, k=init_k), filter_dict)
|
66 |
len_docs_begin = len(context)
|
67 |
if len_docs_begin >= target_k:
|
68 |
-
log.info(f'Initial search contains {len_docs_begin}
|
69 |
return context
|
70 |
CUT_THE_LOOP_N = 500
|
71 |
for top_k_docs in np.arange(init_k, CUT_THE_LOOP_N * init_k, step):
|
@@ -73,9 +73,9 @@ def search_with_filter(vector_store, query, filter_dict, target_k=5, init_k=100,
|
|
73 |
log.info(f'Expanding search with k={top_k_docs}')
|
74 |
context = filter_docs_by_meta(vector_store.similarity_search(query, k=int(top_k_docs)), filter_dict)
|
75 |
if len(context) >= target_k:
|
76 |
-
log.info(f'Success. Context contains {len(context)}
|
77 |
return context
|
78 |
log.info(f'Failed to reach target number of documents after {CUT_THE_LOOP_N} loops,'
|
79 |
-
f' context contains {len(context)}
|
80 |
return context
|
81 |
|
|
|
65 |
context = filter_docs_by_meta(vector_store.similarity_search(query, k=init_k), filter_dict)
|
66 |
len_docs_begin = len(context)
|
67 |
if len_docs_begin >= target_k:
|
68 |
+
log.info(f'Initial search contains {len_docs_begin} documents. Expansion not required. ')
|
69 |
return context
|
70 |
CUT_THE_LOOP_N = 500
|
71 |
for top_k_docs in np.arange(init_k, CUT_THE_LOOP_N * init_k, step):
|
|
|
73 |
log.info(f'Expanding search with k={top_k_docs}')
|
74 |
context = filter_docs_by_meta(vector_store.similarity_search(query, k=int(top_k_docs)), filter_dict)
|
75 |
if len(context) >= target_k:
|
76 |
+
log.info(f'Success. Context contains {len(context)} documents matching the filtering criteria')
|
77 |
return context
|
78 |
log.info(f'Failed to reach target number of documents after {CUT_THE_LOOP_N} loops,'
|
79 |
+
f' context contains {len(context)} documents matching the filtering criteria')
|
80 |
return context
|
81 |
|