Skip to content

本页尚未翻译

本页内容仍为英文原文,源自官方文档 tutorials/agents/contextual-rag。中文翻译正在分批进行中。

Contextual RAG ​

Prepend LLM-generated context to each chunk before embedding it.

Addresses the "lost in the middle" problem in retrieval. An LLM generates a succinct piece of context for each document chunk, which is prepended to the chunk before embedding, so a chunk carries enough surrounding meaning to be retrieved for the right queries.

说明

This example is a runnable notebook in the vectordb-recipes repository rather than a page here.

Open in ColabRun it end to end in the browser.View on GitHubRead the source.