How akxt09/reports-summarization-for-financial-advisors works
Project Type and Purpose
• This is a full-stack web application (“Financial Report Summarizer using LLMs”) that provides a Flask UI for uploading financial PDFs, runs a RAG pipeline (LlamaIndex + FAISS + LangChain + OpenAI), generates Word summaries, and evaluates them with RAGAS.
File Structure
• Top-level:
• app/: Flask application package
– config.py (env & API settings)
– routes.py (HTTP endpoints)
– services/: core pipeline modules
• document_ingester.py (PDF → chunks → FAISS index)
• summary_generator.py (RAG prompts → one/two‐page summary)
• raga_evaluator.py (compute relevance/faithfulness/recall)
• financial_processor.py (domain‐specific parsing)
– utils/file_handler.py (I/O helpers)
– static/, templates/: UI assets and pages
• requirements.txt & run.py: app entry and dependencies
Extract Key Architectural Insights from README
• RAG pipeline with vector store (FAISS)
• LlamaIndex for ingestion/embedding
• LangChain for prompt orchestration
• python-docx for summary generation
• Flask for web layer
• External OpenAI API calls
Components & Relationships
a. Main Components
1. Browser (User Interface)
2. Flask Web Server (routes.py + config)
3. Service Layer
– Document Ingester (LlamaIndex + FAISS)
– Vector Store (FAISS index)
– Summarizer (LangChain + OpenAI)
– Evaluator (RAGAS)
– Document Generator (python-docx)
4. File System (uploaded PDFs, generated .docx)
5. External Services (OpenAI API)
b. Relationships & Data Flows
• User uploads PDF → HTTP POST to Flask routes
• routes.py calls Document Ingester → creates vector index
• routes.py invokes Summary Generator → LangChain calls OpenAI → returns text
• Summary Generator writes .docx via python-docx → filesystem
• routes.py invokes RagaEvaluator → returns metrics
• Flask returns links/metrics to UI for download/display
c. Architectural Patterns & Design Principles
• Layered Architecture: UI → Web/API layer → Service layer → Data/storage → External services
• Separation of Concerns: document ingestion, summarization, evaluation, and I/O in separate modules
• Retrieval-Augmented Generation pattern
d. Technologies & Frameworks
• Flask, Jinja2 (templates), JavaScript/CSS (static)
• LlamaIndex + FAISS (vector store)
• LangChain (RAG orchestration)
• python-docx (Word generation)
• RAGAS (evaluation metrics)
• OpenAI API
Detailed Level of Abstraction
• Four service modules individually rather than lumping them as “Backend Logic.”