Spaces:
Sleeping
Sleeping
File size: 420 Bytes
5830944 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
from typing import List
from core.faiss_vector import FaissIndex
class SemanticRefiner:
def __init__(self):
self.index = FaissIndex()
def build_from_results(self, results: List[dict]):
texts = [r.get("snippet","") for r in results if r.get("snippet")]
if texts:
self.index.add(texts)
def refine(self, query: str, k: int = 10):
return self.index.search(query, k) |