How rojasantino/financial-document-rag works
This is a financial-document RAG application: users upload PDFs, which are parsed page by page, chunked, embedded, and indexed; questions are embedded, retrieved, reranked, and answered from a grounded prompt with page citations. The graph keeps upload and question handling as separate domain flows and includes configuration and persisted storage. Backend calls are evidenced by the sampled source; the README documents the frontend/backend relationship and major retrieval stages. The frontend implementation was read but its API wiring was not shown, so that connection is documented rather than source-verified.
Main entry points: rag_pipeline.py RAG answer pipeline · config.py Application settings · ingest.py Ingestion pipeline · upload.py Upload endpoint
Components 18
User interface
- Streamlit UI
frontend/app.py
API workflows
- FastAPI app
app/main.py - Upload endpoint
app/api/upload.py - Question endpoint
app/api/chat.py
Document ingestion
- Ingestion pipeline
app/services/ingest.py - PDF extraction
app/services/pdf_loader.py - Text chunking
app/services/chunker.py
Retrieval and answering
- Text embeddings
app/services/embeddings.py - Cross-encoder reranker
app/services/reranker.py - RAG answer pipeline
app/services/rag_pipeline.py - LLM provider adapter
app/services/llm.py
Configuration and storage
- FAISS vector store
app/services/vector_store.py - Application settings
app/config.py - Uploaded PDFs
data/documents - Persisted index
data/vectorstore
Other components
- User
- Anthropic API
- OpenAI API
Connections 25
- User → Streamlit UI: uses
README.md - Streamlit UI → FastAPI app: uses API
README.md - FastAPI app → Upload endpoint: registers route
app/main.py - FastAPI app → Question endpoint: registers route
app/main.py - Upload endpoint → Ingestion pipeline: indexes PDF
app/api/upload.py - Upload endpoint → Uploaded PDFs: writes PDF
app/api/upload.py - Ingestion pipeline → PDF extraction: extracts pages
app/services/ingest.py - Ingestion pipeline → Text chunking: creates chunks
app/services/ingest.py - Ingestion pipeline → Text embeddings: embeds chunks
app/services/ingest.py - Ingestion pipeline → FAISS vector store: adds and saves
app/services/ingest.py - FAISS vector store → Persisted index: persists index
app/services/vector_store.py - Question endpoint → RAG answer pipeline: answers question
app/api/chat.py - RAG answer pipeline → Text embeddings: embeds query
app/services/rag_pipeline.py - RAG answer pipeline → FAISS vector store: searches candidates
app/services/rag_pipeline.py - RAG answer pipeline → Cross-encoder reranker: reranks candidates
app/services/rag_pipeline.py - RAG answer pipeline → LLM provider adapter: generates answer
app/services/rag_pipeline.py - LLM provider adapter → Anthropic API: calls provider
app/services/llm.py - LLM provider adapter → OpenAI API: calls provider
app/services/llm.py - Upload endpoint → Application settings: reads settings
app/api/upload.py - Text chunking → Application settings: reads settings
app/services/chunker.py - Text embeddings → Application settings: reads settings
app/services/embeddings.py - Cross-encoder reranker → Application settings: reads settings
app/services/reranker.py - LLM provider adapter → Application settings: reads settings
app/services/llm.py - FAISS vector store → Application settings: reads settings
app/services/vector_store.py - RAG answer pipeline → Application settings: reads settings
app/services/rag_pipeline.py