DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to find the page that answers a question in a long PDF with Jev Doc Search

Searches a 300-page report by tree, then returns the pages that answer your question.

Short answer: Run pip install -r requirements.txt in the repo folder; then run export TYPESAFE_API_KEY="..." and replace the value with your TypeSafe key; run export PAGEINDEX_API_KEY="..." and replace the value with your PageIndex key. All steps.

  • Top pick
  • Research
  • Intermediate
  • 45 minutes
  • From the README
  • Any agent

Credentials. The script needs two API keys set as environment variables, so keep them out of shared code and shell history.

Credentials. The PDF is uploaded to the cloud PageIndex service, so do not send confidential documents you are not allowed to share with that service.

Who it is forAn analyst or developer with a long annual report or technical PDF who needs the exact page for a specific figure, and who is past the point where one request can hold every page.

The problemA single multiple-choice request cannot hold every page of a long document, so flat page search fails on reports over a few dozen pages.

The outcomeThe script prints the sections and pages it kept, so you can open the right page of the report and check the figure.

What you need first

  • Python with pip available
  • A TypeSafe API key from the TypeSafe console
  • A PageIndex API key from the PageIndex dashboard
  • The PDF you want to search

Steps

  1. Run pip install -r requirements.txt in the repo folder.
  2. Run export TYPESAFE_API_KEY="..." and replace the value with your TypeSafe key.
  3. Run export PAGEINDEX_API_KEY="..." and replace the value with your PageIndex key.
  4. Run python tree_search.py NVIDIA_10K.pdf "What was NVIDIA's total revenue for fiscal year 2026?" with your own PDF and question.
  5. Note the printed doc_id, then ask another question with python tree_search.py pi-... "<your question>" so the PDF is not uploaded again. (inferred, check the README)

Prompt for your agent

Using the repo VectifyAI/jev-doc-search, run tree_search.py on <path-to-pdf> with the question <question>. Report the sections and pages it kept and the doc_id. Verify by opening the first kept page of the PDF and confirming the figure or claim appears there.

Caveat. The README tests tree search on two annual reports and two questions, so verify each returned page against the source document before relying on it.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for VectifyAI/jev-doc-search and "Find the page that answers a question in a long PDF"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer