Ask questions about financial reports and get accurate, cited answers β powered by RAG.
FinRAG is a locally-running financial document intelligence platform. Upload any financial PDF (annual reports, 10-Ks, earnings summaries), index it into a vector database, and query it using natural language. The system retrieves the most relevant passages and uses a large language model to generate grounded, cited responses.
- π PDF Ingestion β Upload financial PDFs directly through the Streamlit UI
- π Semantic Search β Dense vector search via MilvusLite + BCEmbedding
- π― Reranking β BCEReranker refines retrieval accuracy before generation
- π€ LLM Q&A β Answers generated with source citations via OpenAI-compatible API
- π Source Citations β Every answer links back to the exact passage retrieved
- ποΈ Multi-document Support β Manage multiple PDFs per Category ID
- π Fully Local β Runs offline with local embedding + MilvusLite (no cloud DB required)
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββββββ
β Streamlit UI βββββββΆβ FastAPI Backend βββββββΆβ MilvusLite (Local) β
β (app_ui/) β β (app/) β β Vector Store β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββββββ
β β²
β embed & rerank β vector search
βΌ β
βββββββββββββββββββ βββββββββββββββββββββ
β BCEmbedding βββββββββΆβ BCEReranker β
β (text β vec) β β (refine results) β
βββββββββββββββββββ βββββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β LLM (OpenAI / β
β Gemini API) β
βββββββββββββββββββ
Download and install Python 3.11 from the official website:
π https://www.python.org/downloads/release/python-3110/
During installation, make sure to check:
- β Add Python 3.11 to PATH
- β Install for all users (recommended)
Verify the installation by opening Command Prompt or PowerShell:
python --version
# Expected: Python 3.11.xFinRAG uses MilvusLite by default β no Docker required. A local .db file (milvus_local.db) is created automatically on first run.
For a full Milvus server (optional), start via docker-compose:
cd docker
docker-compose up -dMilvus UI will be available at http://{your_server_ip}:3100/.
# Create model directory
mkdir -p /data/WoLLM
# Download BCE Embedding model
git clone https://www.modelscope.cn/maidalun/bce-embedding-base_v1.git /data/WoLLM/bce-embedding-base_v1
# Download BCE Reranker model
git clone https://www.modelscope.cn/maidalun/bce-reranker-base_v1.git /data/WoLLM/bce-reranker-base_v1| Model | Purpose |
|---|---|
bce-embedding-base_v1 |
Converts text into dense vectors for semantic search |
bce-reranker-base_v1 |
Refines retrieval results to improve answer accuracy |
Update
EMBEDDING_MODELandRERANK_MODELpaths inconf/config.pyto match your local directory.
# Create virtual environment
python -m venv .venv
# Activate (PowerShell)
.venv\Scripts\activate
# Install all dependencies
pip install -r requirements.txtKey dependencies:
| Package | Version | Role |
|---|---|---|
fastapi |
latest | Backend API server |
streamlit |
1.58.0 | Frontend dashboard UI |
BCEmbedding |
0.1.5 | Embedding & reranking |
pymilvus[milvus-lite] |
β₯ 2.4.2 | Vector store |
langchain |
0.2.0 | RAG pipeline orchestration |
pikepdf |
8.15.1 | PDF parsing |
openai |
1.30.1 | LLM API client |
uvicorn |
latest | ASGI server |
Edit conf/config.py to match your environment:
VECTOR_DB_PATH = "milvus_local.db" # Path to MilvusLite local DB
COLLECTION_NAME = "fin_rag_collection" # Milvus collection name
EMBEDDING_MODEL = "maidalun1020/bce-embedding-base_v1"
RERANK_MODEL = "maidalun1020/bce-reranker-base_v1"# Copy the environment template
cp .env_user .envOpen .env and fill in your credentials:
# LLM Provider (OpenAI-compatible, e.g. Gemini, Together AI, etc.)
OPENAI_API_KEY=your_api_key_here
OPENAI_BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai/
# Object Storage (optional, for remote PDF storage)
OSS_ACCESS_KEY_ID=your_oss_key
OSS_ACCESS_KEY_SECRET=your_oss_secretpython main.pybash bin/start.shAfter startup, open your browser and navigate to:
| Service | URL |
|---|---|
| Streamlit Dashboard | http://localhost:8501 |
| FastAPI Backend | http://localhost:8000 |
| API Docs (Swagger) | http://localhost:8000/docs |
- Set Category ID β Enter a numeric ID in the sidebar (e.g.
101) to namespace your documents. - Upload PDF β Click the upload area and select a financial PDF (e.g. an annual report).
- Index Document β Click Index Document and wait for the embedding process to complete. Progress will be shown in the sidebar.
- Ask Questions β Type a natural language question in the chat input (e.g. "What did the company report about internal controls for fiscal 2025?").
- View Citations β Expand View Source Citations under each answer to see the exact passages retrieved.
FinRAG/
βββ app/ # FastAPI backend (routes, RAG pipeline)
βββ app_ui/ # Streamlit frontend
βββ bin/ # Start/stop scripts
βββ conf/ # Configuration files
βββ data/ # Uploaded documents storage
βββ docs/
β βββ screenshots/ # UI screenshots for documentation
βββ logs/ # Application logs
βββ milvus_local.db/ # Local MilvusLite vector database
βββ storage/ # Processed document storage
βββ test/ # Unit tests
βββ utils/ # Shared utility functions
βββ config.py # Root-level config overrides
βββ main.py # Application entry point
βββ requirements.txt # Python dependencies
βββ Dockerfile # Container build definition
βββ .env # Environment variables (not committed)
docker build -t finrag .
docker run -p 8000:8000 -p 8501:8501 --env-file .env finrag- PDF upload & indexing via Streamlit UI
- Local vector search with MilvusLite
- BCE embedding + reranking pipeline
- LLM-powered Q&A with source citations
- RAG Optimization
- Multi-level indexing
- Multi-query expansion
- Query rewriting / optimization
- Advanced text parsing pipelines
- Multi-user support with auth
- Cloud deployment (AWS / GCP)
- Support for Excel & Word documents
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the terms of the LICENSE file included in this repository.



