Stable state

This commit is contained in:
2026-05-27 22:30:20 -07:00
parent 58f736a5f8
commit 1098bdb2f9
6 changed files with 175 additions and 176 deletions
+5 -1
View File
@@ -150,7 +150,8 @@ class RAGManager:
self, query: str, top_k: int = 5, summarize: bool = False
) -> List[ContextUpdate]:
"""
Retrieves the top-K most relevant snippets for a given query.
Retrieves the top-K most relevant snippets for a given query,
filtering for those with a similarity score > 0.7.
"""
if not self.index:
print("Index not initialized. Please ingest documents first.")
@@ -160,6 +161,9 @@ class RAGManager:
retriever = self.index.as_retriever(similarity_top_k=top_k)
nodes = retriever.retrieve(query)
# Filter nodes by similarity score (threshold > 0.7)
nodes = [node for node in nodes if node.score >= 0.7]
if summarize:
return self.summarize_results(query, nodes)