

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Chunking
incomplete
2: Chunk Overlap
incomplete
3: Semantic Chunking
incomplete
4: Chunked Semantic Embeddings
incomplete
5: Chunked Semantic Search
incomplete
6: Chunked Edge Cases
incomplete
7: ColBERT
incomplete
8: Late Chunking
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Let's implement search using the embeddings we generated for document chunks. We'll search across all chunks to find the most relevant sections, then aggregate results back to the document level.
In this lesson, we'll focus on:
By searching at the chunk level, we can find relevant information even when it's buried deep within a long document, like a book or technical manual.
Implement search functionality that queries chunk embeddings and aggregates results.
chunk_idx: The index of the chunk within the documentmovie_idx: The index of the document in self.documents (you'll need to use self.chunk_metadata to map back to this)score: The cosine similarity score{
"id": doc_id,
"title": title,
"document": document[:100],
"score": round(score, SCORE_PRECISION),
"metadata": metadata or {},
}
print(f"\n{i}. {TITLE} (score: {SCORE:.4f})")
print(f" {DOCUMENT}...")
Run and submit the CLI tests.