Spaces:
Sleeping
Sleeping
Commit ·
37d88ed
1
Parent(s): a2280fa
added 35 semantic similarity
Browse files- index_retriever.py +1 -3
index_retriever.py
CHANGED
|
@@ -21,7 +21,7 @@ def create_query_engine(vector_index):
|
|
| 21 |
|
| 22 |
vector_retriever = VectorIndexRetriever(
|
| 23 |
index=vector_index,
|
| 24 |
-
similarity_top_k=
|
| 25 |
similarity_cutoff=0.65 # Slightly lower for recall
|
| 26 |
)
|
| 27 |
|
|
@@ -63,10 +63,8 @@ def rerank_nodes(query, nodes, reranker, top_k=20, min_score_threshold=0.5, dive
|
|
| 63 |
scores = reranker.predict(pairs)
|
| 64 |
scored_nodes = list(zip(nodes, scores))
|
| 65 |
|
| 66 |
-
# Sort by score descending
|
| 67 |
scored_nodes.sort(key=lambda x: x[1], reverse=True)
|
| 68 |
|
| 69 |
-
# Filter by minimum threshold (more strict)
|
| 70 |
if min_score_threshold is not None:
|
| 71 |
scored_nodes = [(node, score) for node, score in scored_nodes
|
| 72 |
if score >= min_score_threshold]
|
|
|
|
| 21 |
|
| 22 |
vector_retriever = VectorIndexRetriever(
|
| 23 |
index=vector_index,
|
| 24 |
+
similarity_top_k=35, # Increased
|
| 25 |
similarity_cutoff=0.65 # Slightly lower for recall
|
| 26 |
)
|
| 27 |
|
|
|
|
| 63 |
scores = reranker.predict(pairs)
|
| 64 |
scored_nodes = list(zip(nodes, scores))
|
| 65 |
|
|
|
|
| 66 |
scored_nodes.sort(key=lambda x: x[1], reverse=True)
|
| 67 |
|
|
|
|
| 68 |
if min_score_threshold is not None:
|
| 69 |
scored_nodes = [(node, score) for node, score in scored_nodes
|
| 70 |
if score >= min_score_threshold]
|