How lovelypoet/paper-reader-agent works
This is a local document-ingestion and question-answering application. A user uploads a PDF or image through the Streamlit interface; the LangGraph ingestion workflow extracts text, validates and cleans it, then chunks and indexes it. The user can ask questions, which are answered from retrieved document passages with page and chunk citations. The README documents the processing stages, while the workflow, OCR, PDF, and validator implementations were not sampled; their detailed call relationships are therefore shown only where documentation supports them.
Main entry points: rag_node.py Chunk and index · workflow.py Ingestion workflow · app.py Streamlit interface · validator_node.py Text validation
Components 11
User interface
- Streamlit interface
app.py
Document ingestion
- Ingestion workflow
workflow.py - PDF extraction
nodes/pdf_node.py - Image OCR
nodes/ocr_node.py - Text validation
nodes/validator_node.py
Retrieval and answers
- Chunk and index
nodes/rag_node.py - Chroma vector store
- Local Ollama
Shared runtime
- Document state
state.py - Runtime settings
config.py
Other components
- Document user
Connections 15
- Document user → Streamlit interface: uploads document
README.md - Streamlit interface → Ingestion workflow: invokes ingestion
app.py - Ingestion workflow → PDF extraction: extracts PDF text
README.md - Ingestion workflow → Image OCR: runs OCR
README.md - PDF extraction → Image OCR: OCR fallback
README.md - Ingestion workflow → Text validation: validates text
README.md - Text validation → Image OCR: retries weak text
README.md - Ingestion workflow → Chunk and index: indexes validated text
README.md - Streamlit interface → Chunk and index: asks question
app.py - Chunk and index → Chroma vector store: stores and retrieves
nodes/rag_node.py - Chunk and index → Local Ollama: embeds and answers
nodes/rag_node.py - Chunk and index → Text validation: cleans chunks
nodes/rag_node.py - Chunk and index → Runtime settings: reads settings
nodes/rag_node.py - Chunk and index → Document state: reads ingestion state
nodes/rag_node.py - Streamlit interface → Runtime settings: saves uploads
app.py