Library reranking, per-item failures, fetch and quote fixes, companion tools
Four changes that came out of live runs, plus the first companion tool.
One model call with no answer costs that item, not the run (follow-up to #3)
- Reading a passage: it is dropped with the flag
no_answer_from_modeland counted in Limits. - Classifying a paper: it is graded
unclearfor this run, and that is not cached. - Planning, synthesis and critique still end the run, as does an unreachable model.
Reranking is the paper library’s
- The local-model reranker is removed. In a live run the 4B model spent 4.9 of 5.7 hours reranking.
- The library’s cross-encoder (
PAPER_FETCH_RERANK_MODEL) ranks passages. The pipeline keeps that order and only caps passages per paper and per sub-question. - Without the setting, passages are read in retrieval order, and the run notes say so.
Two bugs from that run
- Fetch ordering now puts papers reported as open access first and papers reported as closed last. All six fetches had gone to closed papers.
- An exact quote match that stops inside a word or number is widened to the whole token. A stored quote read “5.” where the passage said “5.9 mmHg”.
Companion tools (research_pipeline/companions.py)
- With a companion configured under
companionsin the gateway config, the plan’s schema gains atoolsfield restricted to the configured keys. - Code calls each requested tool once, within set bounds, and prints the tool’s own records in the answer. No model writes that section, and it never becomes evidence.
- A companion that fails is reported and the run goes on. Offline runs call none.
- First companion:
datasets, which speaks dataset-fetch’s MCP contract.- It searches every catalogue that takes a free-text query, with Zenodo restricted to dataset-typed records.
- It reads the data cards, and counts documents-only records instead of listing them.
- It orders the rest by the library’s
relevance.
- Adding another companion is one registry entry.
Also
- A generic
UpstreamMCP client;PaperLibraryis now one use of it. - The design doc notes the planned “own endpoint” backend for private runs.
Tested:
- 237 tests pass. ruff and pyright are clean.
- Live against the real services: the library reranker returned on-topic passages, and the dataset companion searched three catalogues and read ten cards in 14 s.
🤖 Generated with Claude Code