Development & Automation

How to Use jev-doc-search: Search Long PDFs With Jev Choice and PageIndex.

VectifyAI's jev-doc-search uses a PageIndex document tree and Jev Choice to find the pages that hold the answer in a long PDF. Covers setup, the search flow, top-K and Noul extensions, and 10-K examples.

· Huuush

How to Use jev-doc-search: Search Long PDFs With Jev Choice and PageIndex

Key takeaways

  1. 1jev-doc-search walks down a document tree built by PageIndex with Jev Choice to find the pages that answer a question in a long PDF.
  2. 2On top of the basic choice-based search, the full tree_search.py adds a top-3 beam and Noul checks on up to 16 pages.
  3. 3The README examples record results from the 93-page NVIDIA FY2026 10-K and the 318-page Citigroup FY2025 10-K.
Layered paper tabs used to find the page with the answer in a long report

When you look for the page with the answer in a long PDF, comparing every page at once makes the input length and the number of options grow fast. VectifyAI's open-source jev-doc-search follows the document tree PageIndex builds and uses Jev Choice to narrow down to the relevant sections and pages step by step. Instead of embeddings or a vector database, it uses the document's hierarchy and each node's summary for search.

Loading X post.

Unable to load the X post. Please try again.

Source: X @PageIndexAI

Flat page search hits a limit as documents get longer

The repository includes page_search.py, which extracts a PDF's page text and puts it all in a single Jev Choice request. The question is passed as the state to judge, and each page's text as an option description. Jev picks the most likely page among the candidates and also returns a probability for each option.

This approach needs a single request's context to stay within 32k tokens, and a single Choice can hold at most 255 options. The code also checks that the state stays under 30,000 tokens to leave some margin. The NVIDIA FY2026 10-K in the README is 93 pages and about 76k tokens, which exceeds the context limit. The Citigroup FY2025 10-K is 318 pages, which exceeds the number of options in one Choice. The longer the document, the more you need a structure that splits up the search scope instead of comparing every page in one request.

Pick the section likely to hold the answer from the PageIndex tree

PageIndex builds a tree with the document as the root, and under it sections and subsections that have a title, a summary, and a page range. The leaves hold the actual page content. At each level of the tree, tree_search.py turns the titles and summaries of the child nodes into Choice options and picks the path relevant to the question. If a section has subsections, it descends into them, and when it reaches a leaf it compares the page text.

The simple README example descends one level at a time following the highest-probability option. The full implementation adds top-K search, because taking only one path can miss the right section. It is a beam search that keeps the 3 highest-scoring paths at each section level. It also includes in the options pages that come before a section's subsections, and when pages don't all fit in one request, it splits them into ranges sized to fit.

It then checks up to 16 candidate pages with Jev Noul. For each page, Noul independently makes a yes/no judgment on "Does this page contain the answer to the question?" It keeps pages with a probability of 0.5 or higher, and if no page passes the threshold, it returns the top two pages. You can tell apart the README's simple tree example and the top-K and Noul steps in the full tree_search.py.

How to install it and search your first document

In a Python environment, clone the repository and install the dependencies. Set the TypeSafe key needed for Jev requests and the PageIndex key needed to build the PDF tree as environment variables.

git clone https://github.com/VectifyAI/jev-doc-search.git
cd jev-doc-search
pip install -r requirements.txt
export TYPESAFE_API_KEY="your_key"
export PAGEINDEX_API_KEY="your_key"

The README's requirements include pageindex>=0.2.21, typesafe-sdk==0.7.2, tiktoken, and pypdf. For example, to find total revenue for fiscal year 2026 in NVIDIA's report, pass the PDF and the question together.

python tree_search.py NVIDIA_10K.pdf "What was NVIDIA's total revenue for fiscal year 2026?"

On the first run, it submits the PDF to PageIndex to build the tree and prints a doc_id. The result shows the section path it explored and the pages it found. To ask a different question about the same document without uploading the PDF again, use the doc_id you received as the first argument.

python tree_search.py pi-... "What was NVIDIA's gross margin for fiscal year 2026?"

page_search.py is a simple baseline that compares whole pages with Choice, and for long documents where you want tree paths, page candidates, and Noul checks together, run tree_search.py. The PageIndex API the repository uses provides a flow for submitting a document and retrieving the completed tree, while Jev's Choice and Noul handle option search and candidate page verification respectively.

Pages found in the 10-K examples

The repository README records search results for two annual reports uploaded to PageIndex. The NVIDIA FY2026 10-K is 93 pages and about 76k tokens, and for the total revenue question it returned p37 and p51. The consolidated income statement is on p51. The Citigroup FY2025 10-K is 318 pages, and for the net income question it returned p12, p16, p134, and p135, with the consolidated income statement on p134, according to the README.

In these examples, rather than turning the whole document into page options at once, the search narrows the candidate range in the section tree and then compares the actual page contents. jevgrep, a Jev-based code search tool, likewise finds relevant files and code regions step by step from a natural-language question. For the structure and use cases of the Jev model itself, continue with the CLM-8B and Jev introduction.

Sources

Frequently asked questions

What is jev-doc-search?
It is a Python example in a VectifyAI repository that repeats Jev Choice over a PageIndex document tree to find the pages related to a question.
Do I need a vector database or embeddings?
No. The repository's search flow uses the PageIndex document tree, Jev Choice, and page content instead of embeddings and a vector database.
Which API keys do I need to run it?
Set TYPESAFE_API_KEY for Jev requests and PAGEINDEX_API_KEY for building the PDF tree as environment variables.
How do I ask a new question about the same PDF?
Use the doc_id printed on the first run as the first argument to tree_search.py in place of the PDF file path.

Related articles