



A RAG technique that indexes individual sentences for precise matching but retrieves surrounding sentences (a window) for context. Provides fine-grained retrieval precision while maintaining adequate context for LLM generation.
Loading more......
Sentence Window Retrieval indexes individual sentences but retrieves a window of surrounding sentences. This balances precision (finding exact relevant sentences) with context (providing enough information for the LLM).
from llama_index import SentenceWindowNodeParser
node_parser = SentenceWindowNodeParser.from_defaults(
window_size=3, # 3 sentences before and after
window_metadata_key="window",
original_text_metadata_key="original_text",
)
Implementation-dependent (LlamaIndex feature).