An advanced, LLM-powered agent designed to deconstruct and simplify complex academic research papers. This tool takes a PDF as input, generates a clean, structured booklet with summaries and citations, and provides an interactive chat interface for Q&A.
This project was developed for the Intra IIT Tech Meet at IIT Bhilai.
- Intelligent Document Parsing: Uses
unstructuredto parse PDFs, extracting text, tables, and images. - Automated Booklet Generation: Creates a professional, multi-page PDF booklet containing:
- A concise, AI-generated summary of the paper.
- A list of generated citations for key concepts.
- Extracted tables and image captions.
- Stateful Agentic Workflow: Built with LangGraph, using a supervisor architecture to robustly manage the processing pipeline, chat interactions, and error handling.
- Interactive RAG Chat: After processing, a chat interface is enabled, allowing users to ask specific questions about the paper's content.
- Modular & Asynchronous Backend: Built with FastAPI to handle requests efficiently, offloading heavy processing to background tasks.
The application uses a state-machine architecture managed by a LangGraph "supervisor." This ensures a clear separation between the document processing pipeline and the interactive chat loop, providing a smooth and predictable user experience.
graph TD
subgraph "Phase 1: Document Processing Pipeline"
A[User uploads PDF via UI/API] --> B{FastAPI Endpoint: /process_document};
B -- Triggers --> C{LangGraph Workflow};
C --> D(1. Parse Document);
D --> E(2. Index Content for RAG);
E --> F(3. Summarize Paper);
F --> G(4. Generate Citations);
G --> H(5. Compile PDF Booklet);
H --> I((State Updated: Chat Ready ✅));
end
subgraph "Phase 2: Interactive Chat Loop"
J[User asks question via UI/API] --> K{FastAPI Endpoint: /chat};
K -- Uses RAG Index from E --> L[RAG Chain Retrieves Context];
L --> M[LLM Generates Answer];
M --> N((Response Sent to User));
end
- Backend: FastAPI
- AI Orchestration: LangGraph
- LLM Interaction: LangChain, Google Gemini
- Document Parsing:
unstructured - Vector Database: ChromaDB
- Embeddings: HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
- PDF Compilation: WIP
Follow these steps to set up and run the project locally.
git clone <your-repo-url>
cd <your-repo-name># For macOS / Linux
python3 -m venv venv
source venv/bin/activate
# For Windows
python -m venv venv
.\venv\Scripts\activateThis project requires two key system-level dependencies:
- Poppler (for
unstructured):- macOS:
brew install poppler - Debian/Ubuntu:
sudo apt-get install poppler-utils
- macOS:
- LaTeX (for PDF compilation):
Create a requirements.txt file with the content below and install it.
Got to requirements.txt file and copy paste
pip install -r requirements.txtCreate a file named .env in the project root directory and add your Google API key.
# .env
GOOGLE_API_KEY="your_google_api_key_here"
-
Start the Backend Server: Run the following command from the project's root directory:
uvicorn app.main:app --reload
The API will be available at
http://127.0.0.1:8000. -
Access the Interactive API Docs: Open your browser and navigate to
http://127.0.0.1:8000/docs. -
Process a Document:
- Expand the
/process_documentendpoint. - Click "Try it out" and upload a PDF file.
- Execute the request. You will receive a
job_id.
- Expand the
-
Check Status & Get Booklet:
- Expand the
/status/{job_id}endpoint. - Enter the
job_idfrom the previous step and execute. - Once the
current_modeshows"chatting", abooklet_urlwill be available to download the generated PDF.
- Expand the
-
Chat with the Document:
- Expand the
/chatendpoint. - Enter the same
job_idand your question in the request body. - Execute to receive an AI-generated answer based on the document's content.
- Expand the
/project_root
├── app/
│ ├── agents/
│ │ ├── summarizer.py
│ │ └── citation_generator.py
│ ├── graphs/
│ │ ├── supervisor.py
│ │ ├── processing_nodes.py
│ │ ├── chat_nodes.py
│ │ └── error_nodes.py
│ ├── utils/
│ │ ├── parser.py
│ │ └── pdf_compiler.py
│ ├── schemas.py
│ └── main.py
├── outputs/ # Generated booklets and images will appear here
├── templates/
│ └── booklet_template_v2.tex
├── .env
└── requirements.txt