RAG & Agents Engineering

M21 lab, framework fluency with LlamaIndex

Embed a sentence, send its window.

The Larkspur handbook’s two sections, split by SentenceWindowNodeParser into 17 sentence nodes and embedded with all-MiniLM-L6-v2. Pick a question, move window_size and similarity_top_k, and read what MetadataReplacementPostProcessor hands the model.

Golden question
similarity_top_k
Characters the model reads
Against the bare sentence
Answer facts in context
Sentences sent twice

What the model receives

Retrieved sentence highlighted, answer facts underlined

The handbook, one node per sentence

Cosine similarity, all-MiniLM-L6-v2

NodeScoreAnswerSentence

Scores come from the real LlamaIndex index and are the same at every window size, because the parser excludes the window from the embedding. The notebook embeds with OpenAI’s text-embedding-3-small, which scores differently. Windows here are a port of the parser’s join, checked against LlamaIndex 0.14.25 on all 30 settings of question, window and k: identical text.