How dingzehu/arxiv-rag works
arxiv-rag provides semantic search and cited Q&A over indexed machine-learning papers, with arXiv and PDF-upload ingestion, scheduled evaluation, and MLflow tracking. A user enters a question in the React interface; the app posts it to FastAPI, whose RAG service embeds it, retrieves similar pgvector chunks, and asks Gemini for a grounded answer returned with sources. Ingestion fetches or accepts documents, extracts and chunks text, embeds it, and stores it. The graph also shows batch evaluation and paper-management capabilities documented in the README or routes. Unsampled DAG and frontend details are represented only where documented.
Main entry points: ingestion.py Ingestion service · routes.py API routes · rag_pipeline.py RAG search · evaluator.py Answer evaluator
Components 24
Search interface
- Search app
frontend/src/App.jsx - Question input
frontend/src/components/SearchBar.jsx - Answer display
frontend/src/components/AnswerCard.jsx - Source list
frontend/src/components/SourceList.jsx
Backend API
- FastAPI app
backend/app/main.py - API routes
backend/app/api/routes.py - Request schemas
backend/app/models/schemas.py
Paper ingestion
- arXiv fetcher
backend/app/services/arxiv_fetcher.py - PDF extraction
backend/app/services/pdf_extractor.py - Text chunking
backend/app/services/chunker.py - Embedding service
backend/app/services/embedder.py - Ingestion service
backend/app/services/ingestion.py - Scheduled pipeline
airflow/dags/arxiv_pipeline_dag.py
Retrieval and evaluation
- RAG search
backend/app/services/rag_pipeline.py - Answer evaluator
backend/app/services/evaluator.py - Golden questions
evaluation/golden_test_set.json
Data and tracking
- App settings
backend/app/config.py - DB session setup
backend/app/database.py - Paper and chunks
backend/app/models/db.py - PostgreSQL pgvector
Other components
- Researcher
- Gemini API
- arXiv API
- MLflow tracking
Connections 32
- Researcher → Question input: enters question
README.md - Question input → Search app: submits question
frontend/src/App.jsx - Search app → API routes: POST /search
frontend/src/App.jsx - Search app → Answer display: renders answer
frontend/src/App.jsx - Search app → Source list: renders sources
frontend/src/App.jsx - FastAPI app → API routes: registers routes
backend/app/main.py - API routes → Request schemas: validates requests
backend/app/api/routes.py - API routes → RAG search: calls search
backend/app/api/routes.py - API routes → Ingestion service: calls ingestion
backend/app/api/routes.py - API routes → Answer evaluator: calls evaluation
backend/app/api/routes.py - Scheduled pipeline → FastAPI app: posts ingest and evaluate
README.md - Ingestion service → arXiv fetcher: fetches papers
backend/app/services/ingestion.py - Ingestion service → PDF extraction: extracts PDF text
backend/app/services/ingestion.py - Ingestion service → Text chunking: chunks text
backend/app/services/ingestion.py - Ingestion service → Embedding service: embeds chunks
backend/app/services/ingestion.py - Ingestion service → Paper and chunks: stores papers and chunks
backend/app/services/ingestion.py - arXiv fetcher → arXiv API: fetches metadata
README.md - Embedding service → Gemini API: requests embeddings
README.md - RAG search → Embedding service: embeds query
backend/app/services/rag_pipeline.py - RAG search → Paper and chunks: queries similar chunks
backend/app/services/rag_pipeline.py - RAG search → Gemini API: generates answer
README.md - Answer evaluator → RAG search: evaluates search result
backend/app/services/evaluator.py - Answer evaluator → Golden questions: loads batch questions
backend/app/services/evaluator.py - Answer evaluator → Gemini API: scores answer
backend/app/services/evaluator.py - Ingestion service → MLflow tracking: logs ingestion metrics
backend/app/services/ingestion.py - RAG search → MLflow tracking: logs search run
backend/app/services/rag_pipeline.py - Answer evaluator → MLflow tracking: logs evaluation scores
backend/app/services/evaluator.py - DB session setup → App settings: reads database URL
backend/app/database.py - DB session setup → PostgreSQL pgvector: opens sessions
README.md - Paper and chunks → DB session setup: uses declarative base
backend/app/models/db.py - API routes → DB session setup: depends on DB session
backend/app/api/routes.py - Ingestion service → App settings: reads pipeline settings
backend/app/services/ingestion.py