An agentic RAG research assistant. Chat with your research papers, pull in arXiv and web sources, and check whether a paper's claims still hold up against newer research.
Note
Note from the Owner: Every chat session gets its own knowledge base. Papers you load in one chat are not visible in any other chat.
- Ask questions about your papers: upload PDF, TXT or Markdown files, load web pages, or pull papers straight from arXiv by ID or title.
- Verify a claim: paste a claim from a paper and PaperLens searches the web and arXiv for newer work that challenges or supersedes it, with links.
- Search the web: questions about current events or recent developments are answered with live Tavily results.
/btwside questions: start a message with/btwto ask something off-topic without adding it to the session history.- Persistent sessions: chats are saved with SQLite checkpoints and auto-named from your first message.
- Inspect the agent: every answer has a 📊 Graph state panel showing the route taken, the retrieved chunks and the retry counts.
| Node | What it does |
|---|---|
router |
Classifies the question as retrieve, verify_claim or direct_answer. |
agent_node |
Picks a tool (your papers or web search) and writes the search query. Capped at 3 tool calls per question. |
retrieval |
Runs the tool: a Qdrant similarity search over your papers, or a Tavily web search. |
relevancy_check |
Checks whether the retrieved chunks actually answer the question. |
query_rewrite |
If they don't, rewrites the query once and sends it back to the agent. |
verify_claim |
Searches the web and arXiv for newer work and returns a verdict with up to 3 superseding papers. |
generate_answer |
Writes the final answer and streams it to the UI. |
PaperLens/
├── app.py # Streamlit UI (sessions, document loaders, chat)
├── backend/
│ ├── rag_graph.py # LangGraph workflow (router, agent, tools, claim verification)
│ ├── vector_store.py # Qdrant collections + cached OpenAI embeddings
│ ├── paper_loader.py # PDF / TXT / Markdown / web page / arXiv loaders and chunking
│ ├── btw_handler.py # /btw side-channel answers
│ └── models.py # Pydantic schemas for structured LLM outputs
├── evaluate.py # DeepEval evaluation of the RAG pipeline
├── goldens.json # Question/answer pairs used by the evaluation
├── eval_results.json # Latest evaluation results
├── documents/ # Sample report used by evaluate.py
├── graph.png # Workflow diagram (above)
├── pyproject.toml / uv.lock # Dependencies (uv)
├── requirements.txt # Dependencies (pip / Docker)
├── Dockerfile
├── DOCKER_GUIDE.md # Docker Hub + EC2 deployment guide
├── docker_install_on_AWS.txt # Installing Docker on an Ubuntu EC2 instance
└── qdrant_login_steps.md # Getting Qdrant Cloud credentials
Accounts & Keys
- OpenAI API Key from platform.openai.com (PaperLens uses
gpt-5.4-mini,gpt-5-miniandtext-embedding-3-small)- Tavily API Key from tavily.com (the free tier is enough)
- (Optional) Qdrant Cloud cluster, only if you don't want to run Qdrant locally (see qdrant_login_steps.md)
Local Tools
- Python 3.12+ &
uv: dependency management and running the app- Docker Desktop: runs Qdrant locally
- Git: cloning the repo
1.1 Clone the repo
git clone https://github.com/yashsdoshi/PaperLens.git cd PaperLens1.2 Install dependencies
uv syncThis creates a
.venvfolder and installs everything fromuv.lock.1.3 Start Qdrant
Option A: Local (Docker). Make sure Docker Desktop is running, then:
docker run -d --name paperlens-qdrant -p 6333:6333 -v paperlens_qdrant:/qdrant/storage qdrant/qdrant[!TIP] Your papers are stored in the
paperlens_qdrantvolume, so they survive restarts. Next time, just rundocker start paperlens-qdrant.Option B: Qdrant Cloud. Follow qdrant_login_steps.md to get your cluster URL and API key.
1.4 Create the
.envfileCreate an empty
.envfile in the project root:Windows (CMD):
type nul > .envmacOS / Linux:
touch .envThen add your keys:
OPENAI_API_KEY=sk-proj-... TAVILY_API_KEY=tvly-... QDRANT_URL=http://localhost:6333 QDRANT_API_KEY=[!IMPORTANT] Keep the
QDRANT_API_KEY=line even when it's empty (local Qdrant). The app reads it at startup and fails if the line is missing. For Qdrant Cloud, use your cluster's URL and API key instead.
2.1 Load your documents
Use the sidebar to add documents to the current chat:
Source How Files Upload PDF, TXT or Markdown files, then click Add Files. Web Pages Paste URLs (one per line), then click Load URLs. ArXiv Papers Enter an arXiv ID ( 1706.03762) or a title (Attention Is All You Need), then click Load ArXiv Paper.Documents are split into 1,000-character chunks (200 overlap) and embedded with
text-embedding-3-small. Embeddings are cached inembedding_cache/, so loading the same paper again doesn't re-embed it.2.2 Ask questions
The router picks the right path for you. Some examples:
You type Route What dataset did the authors use for training?retrieve: searches your papers What are the latest developments in retrieval-augmented generation?retrieve: searches the web Is this claim still accurate: "LSTMs outperform transformers on machine translation"verify_claim: finds newer papers What is softmax?direct_answer: no retrieval needed /btw What is attention?side channel: not saved to the session
3.1 Run the evaluation
evaluate.pyuses DeepEval to test the pipeline against the sample report indocuments/. Each question ingoldens.jsonruns through the full graph in a fresh session, and the answers are scored on 5 metrics (threshold0.7, judged bygpt-5.4-mini). Ifgoldens.jsonis missing, new question/answer pairs are generated from the report first.uv run evaluate.pyResults are saved to
eval_results.json.[!WARNING] The evaluation makes a lot of OpenAI calls, so it costs money. Each test case also creates its own Qdrant collection.
3.2 Latest results
10 test cases from
goldens.json:
Metric Avg score Passed Contextual Precision 0.98 10/10 Contextual Recall 1.00 10/10 Contextual Relevancy 0.58 5/10 Answer Relevancy 0.99 10/10 Faithfulness 0.98 10/10
4.1 Build and run the image
docker build -t paperlens . docker run -d -p 8501:8501 --env-file .env --name paperlens paperlens[!IMPORTANT] Inside the container,
localhostpoints to the container itself. If Qdrant is running locally in Docker Desktop, setQDRANT_URL=http://host.docker.internal:6333in your.env.4.2 Deploy to AWS EC2
- Install Docker on your EC2 instance using docker_install_on_AWS.txt.
- Push the image to Docker Hub and run it on EC2 using DOCKER_GUIDE.md.
- Open port 8501 in your EC2 security group.
| Error | Cause | Fix |
|---|---|---|
openai.OpenAIError: Missing credentials or KeyError: 'QDRANT_URL' |
.env is missing, or the app was started from another folder |
Create .env in the project root (Step 1.4) and run the app from there |
Could not load document list — try refreshing. |
Qdrant isn't running | docker start paperlens-qdrant |
open //./pipe/dockerDesktopLinuxEngine: The system cannot find the file specified |
Docker Desktop isn't running | Start Docker Desktop, wait until it's ready, then retry |
model_not_found from OpenAI |
Your key doesn't have access to gpt-5.4-mini or gpt-5-mini |
Change the model names in backend/rag_graph.py, backend/btw_handler.py and app.py |
