How sondosahmed1/academic-paper-assistant works
This is a local academic-paper RAG assistant: users ask questions in a Streamlit chat and receive answers grounded in retrieved paper passages with citations. The README also documents a separate corpus-preparation workflow—PDF extraction, chunking, embeddings, and page-layout analysis—though its implementation is not represented by the sampled Python modules; the notebook is present in the tree. Runtime retrieval and generation are visible in the excerpts. The layout detector excerpt is a mock, so its production layout-analysis capability is documented rather than verified in code.
Main entry points: main.py App startup · rag_service.py RAG service · query.py Query route · vector_store.py Chroma store
Components 16
Chat client
- Chat UI
rag-assistant-project/frontend/app.py - API client
rag-assistant-project/frontend/api_client.py
Query API
- Query route
rag-assistant-project/app/api/routes/query.py - Query schema
rag-assistant-project/app/schemas/query.py - App startup
rag-assistant-project/main.py
Retrieval and answers
- RAG service
rag-assistant-project/app/services/rag_service.py - Passage retrieval
rag-assistant-project/app/services/rag_service.py - Layout context
rag-assistant-project/app/core/layout_detector.py - Chroma store
rag-assistant-project/app/db/vector_store.py - Grounded prompt
rag-assistant-project/app/services/rag_service.py - Ollama client
rag-assistant-project/app/services/ollama_client.py
Corpus preparation
- Academic PDFs
- PDF preparation
rag-assistant-project/notebooks/rag_pipeline.ipynb - Sample indexer
rag-assistant-project/index_samples.py
Other components
- Researcher
- Ollama model
Connections 20
- Researcher → Chat UI: asks
rag-assistant-project/frontend/app.py - Chat UI → API client: calls
rag-assistant-project/frontend/app.py - API client → Query route: POSTs query
rag-assistant-project/frontend/api_client.py - App startup → Query route: registers route
rag-assistant-project/main.py - App startup → RAG service: initializes
rag-assistant-project/main.py - App startup → Chroma store: initializes
rag-assistant-project/main.py - App startup → Layout context: initializes
rag-assistant-project/main.py - App startup → Ollama client: initializes
rag-assistant-project/main.py - Query route → Query schema: returns response
rag-assistant-project/app/api/routes/query.py - Query route → RAG service: invokes
rag-assistant-project/app/api/routes/query.py - RAG service → Passage retrieval: uses
rag-assistant-project/app/services/rag_service.py - Passage retrieval → Chroma store: queries
rag-assistant-project/app/services/rag_service.py - Passage retrieval → Layout context: gets page context
rag-assistant-project/app/services/rag_service.py - RAG service → Grounded prompt: builds prompt
rag-assistant-project/app/services/rag_service.py - RAG service → Ollama client: requests completion
rag-assistant-project/app/services/rag_service.py - Ollama client → Ollama model: sends prompt
rag-assistant-project/app/services/ollama_client.py - Academic PDFs → PDF preparation: provides PDFs
README.md - PDF preparation → Chroma store: indexes chunks
README.md - PDF preparation → Layout context: analyzes pages
README.md - Sample indexer → Chroma store: adds samples
rag-assistant-project/index_samples.py