Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Related Work Researcher

A local web application that helps researchers discover, download, and deeply interrogate academic papers. You type a research query, get back 50 scored and ranked papers from Google Scholar, download the open-access PDFs, and then ask free-form questions about them — answered by Claude using a RAG pipeline built on your downloaded papers.


What It Does

1. Paper Search

  • Searches Google Scholar via SerpAPI and fetches up to 50 papers in parallel.
  • Each paper is scored out of 100 across four dimensions:
Dimension Max Score How it works
Relevance 25 Keyword hits in title (weighted higher) and abstract snippet
Top venue 25 Checks for NeurIPS, ICML, ICLR, Nature, ACL, CVPR, and 20+ other top venues
Recency 25 Decays 2 points per year from 2026
Citations 25 Tiered: 1 citation = 2pts, 10 = 6pts, 100 = 13pts, 1000 = 20pts, 10000 = 25pts
  • Results are displayed across 5 ranked tabs (10 papers each), highest-scoring first.

2. PDF Download

Each paper card has a Download PDF button. The server tries to find an open-access PDF through a cascade of fallback strategies:

  1. Direct PDF link from SerpAPI's resources field
  2. arXiv — converts abs/ URL to pdf/ automatically
  3. Semantic Scholar open-access API (free, no key needed)
  4. OpenAlex open-access API (free, no key needed)
  5. HTML page scraping — looks for citation_pdf_url meta tag, .pdf links, and download button keywords

Downloaded PDFs are saved to a downloads/ folder and are never downloaded twice — if the file already exists, it is served from disk.

3. RAG-Powered Q&A

Select any combination of downloaded papers and ask questions. The system uses a full Retrieval-Augmented Generation (RAG) pipeline:

  1. Full text extraction — PyPDF2 extracts the complete text of each PDF (no character limit).
  2. Intelligent chunking — Text is split by section headers first (e.g. 1. Introduction, 2 Related Work). Sections longer than 500 words are further split at sentence boundaries with 100-word overlap between adjacent chunks.
  3. Hybrid indexing — Each chunk is indexed in two ways simultaneously:
    • FAISS vector index using all-MiniLM-L6-v2 sentence embeddings (cosine similarity)
    • BM25 keyword index for exact term matching
  4. Hybrid retrieval with RRF — For each question, both indexes are queried. Results are fused using Reciprocal Rank Fusion (RRF), combining semantic and keyword signals. The top 5 most relevant chunks are selected per paper — so every selected paper contributes equally regardless of size.
  5. Per-paper answers — Claude (claude-sonnet-4-6) receives the retrieved sections and answers the question separately for each paper, with a clear heading per paper.
  6. Index caching — The FAISS + BM25 index is cached keyed by file paths and modification times. Repeated questions on the same selection reuse the cache instantly. Downloading a new paper or changing the selection automatically triggers a rebuild.

4. Multi-Turn Conversation

  • The Q&A panel maintains full conversation history across questions.
  • History is sent to Claude on every request, allowing natural follow-up questions (e.g. "Which of those methods is most novel?", "Elaborate on that").
  • If the history grows beyond ~6,000 characters (~1,500 tokens), older turns are automatically summarized using claude-haiku to stay within context limits, while the most recent 2 turns are always kept verbatim.
  • Click Clear history to start a fresh conversation at any time.

Project Structure

RelatedWork_Researcher/
├── server.py       # Flask backend — all API endpoints and RAG pipeline
├── index.html      # Single-file frontend — no build step required
├── downloads/      # Downloaded PDFs (auto-created on first download)
└── .env            # API keys (see setup below)

Requirements


Setup

1. Install dependencies

pip install flask httpx python-dotenv anthropic PyPDF2 beautifulsoup4 \
            sentence-transformers faiss-cpu numpy rank-bm25

2. Create a .env file

Create a file named .env in this folder:

SERP_API_KEY=your_serpapi_key_here
ANTHROPIC_API_KEY=your_anthropic_key_here

Important: Never commit .env to version control. It is already listed in .gitignore.

3. Start the server

python server.py

The server starts at http://localhost:5001.

4. Open in browser

Navigate to http://localhost:5001 in any modern browser.


How to Use

Searching for Papers

  1. Type your research topic into the search bar (e.g. autonomous agents LLM planning).
  2. Click Search 50 — results appear in up to 5 tabs after a few seconds.
  3. Each card shows: title (linked to the paper), authors, year, venue, citation count, relevance score, and an abstract snippet.
  4. Switch between tabs to browse by score tier.

Downloading Papers

  • Click Download PDF on any paper card.
  • The button changes to Downloaded once saved.
  • Papers already downloaded are automatically marked on future searches.
  • Downloaded papers appear in the Downloaded Papers sidebar on the right. Click Open to view a PDF in a new tab.

Note: Only open-access papers can be downloaded. Paywalled papers will show "No open-access PDF found".

Manually adding a paper

If automatic download fails (e.g. the paper is paywalled), you can download the PDF yourself and add it manually:

  1. Download the PDF from any source (publisher website, ResearchGate, your institution's access, etc.).
  2. Rename the file to something descriptive, e.g. Attention_Is_All_You_Need.pdf.
  3. Copy or move it into the downloads/ folder inside this project directory.
  4. Refresh the browser — the paper will appear in the Downloaded Papers sidebar and the Papers to query checklist automatically, ready to be queried.

Asking Questions

  1. In the Ask About Papers panel, check the papers you want to query. Use Select all / None to toggle all at once.
  2. Type your question in the text box and click Ask (or press Enter).
  3. Claude will return a structured answer with a heading for each selected paper.
  4. Ask follow-up questions freely — the assistant remembers the conversation context.
  5. Click Clear history to reset the conversation and start fresh.

Example question flow

Q: What datasets are used in these papers?
A: [Per-paper breakdown of datasets...]

Q: Which of those datasets is largest?
A: [Claude references the previous answer to compare...]

Q: What are the limitations of using that dataset?
A: [Claude understands "that dataset" from context...]

API Endpoints

Method Endpoint Description
GET / Serves the frontend (index.html)
POST /search Searches Google Scholar. Body: {"query": "..."}
POST /download Downloads a PDF. Body: {"url": "...", "title": "...", "pdf_url": "..."}
GET /downloads Lists all downloaded PDFs with metadata
GET /files/<filename> Serves a downloaded PDF file
POST /ask RAG Q&A. Body: {"question": "...", "files": [...], "history": [...]}

Technical Notes

  • Embedding model: all-MiniLM-L6-v2 from sentence-transformers — downloaded automatically on first use (~80 MB, cached locally by HuggingFace).
  • Chunking: Section-header regex targets academic numbering patterns (1. Introduction, 3.1 Methods). Falls back to sentence-boundary splitting. Max chunk size: 500 words. Overlap: 100 words.
  • RRF fusion constant: k=60 (standard default). Lower values amplify top-ranked results; higher values smooth rankings.
  • History summarization: Triggered when total history exceeds 6,000 characters. Uses claude-haiku-4-5 (faster, cheaper) to produce a 3–5 sentence summary of older turns.
  • Port conflict: macOS uses port 5000 for AirPlay. The server runs on port 5001 to avoid this.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages