Credentials. The script needs a TypeSafe API key set as an environment variable, so keep it out of shared files.
Who it is forAn HR or operations person with a short handbook or policy PDF who wants the page for a question like vacation days, without reading the whole file.
The problemScanning a short PDF page by page to answer one policy question wastes time, and the document is short enough for a single Choice.
The outcomeThe script prints the most likely page label and its text, which you can read directly.
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
- Run
pip install -r requirements.txtin the repo folder. - Run
export TYPESAFE_API_KEY="..."and replace the value with your TypeSafe key. - Run
python page_search.py handbook.pdf "How many vacation days do new employees get?"with your own PDF and question. - Read the printed page and its text to confirm it contains the policy.
Prompt for your agent
Using the repo VectifyAI/jev-doc-search, run page_search.py on <path-to-pdf> with the question <question>. Output the most likely page label and its text. Verify that the page text contains the answer by checking the wording against the PDF.
Caveat. Flat page search only works while the whole document fits in one request, which the README puts at a few dozen pages, so use tree_search.py for longer PDFs.
Get 5 new use cases every morning. Free, one short email, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Disclaimer
Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked "Seen in the wild", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email [email protected] and we will look at it promptly. Full disclaimer page