Commit
•
32a7a7e
1
Parent(s):
cc3359d
Update app.py
Browse files
app.py
CHANGED
@@ -88,7 +88,7 @@ if uploaded_files:
|
|
88 |
|
89 |
# Retrieval
|
90 |
bm25_retriever = BM25Retriever.from_defaults(nodes=nodes, similarity_top_k=1)
|
91 |
-
vector_retriever = index.as_retriever(similarity_top_k=
|
92 |
|
93 |
# Hybrid Retriever class
|
94 |
class HybridRetriever(BaseRetriever):
|
@@ -109,11 +109,11 @@ if uploaded_files:
|
|
109 |
# return all_nodes
|
110 |
|
111 |
def _retrieve(self, query, **kwargs):
|
112 |
-
bm25_nodes = self.bm25_retriever.retrieve(query, **kwargs)
|
113 |
-
|
114 |
all_nodes = []
|
115 |
node_ids = set()
|
116 |
-
for n in
|
117 |
if n.node.node_id not in node_ids:
|
118 |
all_nodes.append(n)
|
119 |
node_ids.add(n.node.node_id)
|
|
|
88 |
|
89 |
# Retrieval
|
90 |
bm25_retriever = BM25Retriever.from_defaults(nodes=nodes, similarity_top_k=1)
|
91 |
+
vector_retriever = index.as_retriever(similarity_top_k=1)
|
92 |
|
93 |
# Hybrid Retriever class
|
94 |
class HybridRetriever(BaseRetriever):
|
|
|
109 |
# return all_nodes
|
110 |
|
111 |
def _retrieve(self, query, **kwargs):
|
112 |
+
# bm25_nodes = self.bm25_retriever.retrieve(query, **kwargs)
|
113 |
+
vector_nodes = self.vector_retriever.retrieve(query, **kwargs)
|
114 |
all_nodes = []
|
115 |
node_ids = set()
|
116 |
+
for n in vector_nodes:
|
117 |
if n.node.node_id not in node_ids:
|
118 |
all_nodes.append(n)
|
119 |
node_ids.add(n.node.node_id)
|