June 19, 2026 at 12:00 am
Comments posted to this topic are about the item You Probably Don't Need a Vector Database
June 20, 2026 at 12:10 am
Thanks for posting your issue and hopefully someone will answer soon.
This is an automated bump to increase visibility of your question.
June 29, 2026 at 5:57 pm
This is a very nice, concise, demo of RAG. I learned a lot of it. Thanks for posting!
The example required a few small changes in the function retrieve: the lines with sorted() and the last line of the function have a missing indexer .
Corrected version:
def retrieve(self, query: str, top_k: int = TOP_K) -> list[str]:
scores = self.bm25.get_scores(query.lower().split())
top_idx = sorted(range(len(scores)), key=lambda i: scores[ i ], reverse=True)[:top_k]
print(f" Top chunks retrieved:")
for rank, idx in enumerate(top_idx):
print(f" [{rank+1}] score={scores[idx]:.4f} ? {self.chunks[idx][:80]}...")
print()
return [self.chunks[ i ] for i in top_idx]
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply