liveBook · Manning

Reasoning-based retrieval

As explained in Context Engineering

Vectorless retrieval-augmented generation retrieves information without vector similarity, often by navigating document structure, and supplies it as context to a language model.

Reasoning-based retrieval, also called vectorless RAG, locates information by navigating document structure rather than using embedding similarity. It supplies the selected text as grounding context for an LLM’s answer. section 3.6

An indexing pipeline parses headings, numbering, and tables of contents into a hierarchy of sections, subsections, and paragraphs. Each node contains a heading, a generated summary, and a pointer to the underlying text. At query time, the model selects a likely branch at each level until it reaches a leaf; that leaf’s text enters the generation context. section 3.6

This approach is suited to long, well-structured documents where sections may use similar vocabulary for different procedures. It preserves section context and avoids fixed-size chunk boundaries. Its effectiveness depends on structural quality, however, and it is ineffective for unstructured collections or questions requiring synthesis across disparate documents. section 3.6

Querying a policy document with PageIndex

Submit a PDF to PageIndex, retain its document ID, and poll until indexing completes. Then send a question such as “What is the conflict policy?” with the document ID and read the generated answer. The illustrative polling loop does not show a timeout or error handling. section 3.10.6

Listing 3.7 Vectorless RAG implementation using PageIndex
import os
import time
from pageindex import PageIndexClient

client = PageIndexClient(api_key=os.getenv("PAGEINDEX_API_KEY")) #1

upload_result = client.submit_document("sample.pdf") #2
doc_id = upload_result.get("doc_id")

while True: #3
    doc_info = client.get_document(doc_id)
    if doc_info.get("status") == "completed":
        break
    time.sleep(2)

response = client.chat_completions( #4
    messages=[{"role": "user", "content": "What is the conflict policy?"}],
    doc_id=doc_id
)
print(response["choices"][0]["message"]["content"])

Follow the Python implementation from document submission through indexing status checks and the query. section 3.10.6

Choose retrieval architecture by weighing build effort, query cost, and tolerable failure modes. Start with the cheapest approach that fits the corpus, then use retrieval evaluation to identify failures that justify a more elaborate design. section 3.11

How Context Engineering covers it

How deep it goes
Explains tree indexing and top-down navigation, and demonstrates document submission and querying with PageIndex.
Examples
Uses technical manuals, legal contracts, and financial reports as document examples, plus a PDF conflict-policy query.
What you can do after
Apply it via PageIndex to index a PDF and submit a grounded question.
How it connects
Contrasts embedding-based RAG and vector databases with structural retrieval, and distinguishes it from agentic RAG.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Context Engineering. The section links point to the parts of the book it draws on.