Skip to content

feat: add paper retrieval tools - #170

Open
pankajrajdeo wants to merge 1 commit into
mainfrom
feat/paper-retrieval
Open

pankajrajdeo wants to merge 1 commit into
mainfrom
feat/paper-retrieval

Conversation

@pankajrajdeo

@pankajrajdeo pankajrajdeo commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Agentomics can receive fetched PDFs, but the main agent cannot efficiently search their contents or inspect relevant figures and pages. This adds the downstream retrieval layer for the shared/fetched_papers handoff expected from #163.

Changes

  • process PDFs deterministically into cached Markdown and word chunks keyed by content hash
  • rank bounded results locally with TF-IDF while preserving source, page, chunk, and processed-file provenance
  • return no result when a query has no lexical match
  • render only retrieved pages to PNG on demand
  • add inspect_image(image_path, query), which returns the image to the same Agentomics model through Pydantic AI multimodal tool content
  • restrict image reads to the current run and cap them at 20 MB
  • register both tools by default and include the parser/renderer dependencies in the runtime environment

This PR covers text-based PDFs and requires the configured model to accept image input. OCR and page navigation for scanned/image-only PDFs, paper discovery, reader sub-agents, and Q&A orchestration remain follow-up work.

Validation

  • focused unit tests: 2 passed, covering retrieval, caching artifacts, blank PDF pages, no-match queries, image return structure, and path restrictions
  • live Codex pipeline on a synthetic paper: verified the recorded retrieve_paper_chunks → inspect_image call sequence and the combined text/image answer
  • live Codex pipeline on the real Agentomics paper: retrieved the test-isolation evidence, rendered and inspected the page, and correctly explained when the isolated test set is used
  • GitHub CPU test suite passed on the initial revision and is rerunning for the review fixes

The branch is based on current main and remains independent of #163 until its fetch implementation is ready to integrate.

@pankajrajdeo
pankajrajdeo marked this pull request as ready for review October 6, 2026 13:10
@pankajrajdeo
pankajrajdeo requested a review from MartinekV October 6, 2026 13:10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant