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
