Financial RAG Chatbot
SEC-filing Q&A with line-level citations — multi-stage retrieval over ChromaDB, evaluated with Claude as judge, live on Cloud Run.
- Org
- Columbia
- Role
- Designed & built solo
- Period
- 2025
- Status
- live
- Stack
- FastAPI · ChromaDB · LangChain · text-embedding-3-large · Streamlit · GCP Cloud Run
- Links
- Live demo ↗GitHub ↗
The problem
Analysts and investors spend hours sifting through SEC filings — 10-Ks, 10-Qs, 8-Ks — to extract insight about performance, risk factors, and management commentary. The documents are dense, often 100+ pages, and written in complex legal-financial language.
The goal: an assistant that answers natural-language questions about company financials with source-grounded responses — eliminating the hallucinations that make standard LLM answers worthless in a financial context.
The constraints
- SEC filings have complex nested structure — tables, footnotes, cross-references — that naive chunking destroys
- Financial data demands exact numbers; approximations are unacceptable
- Relevant information spans multiple document sections, but context windows are finite
- The system must handle both quantitative queries ("What was Q3 revenue?") and qualitative ones ("What are the main risk factors?")
- Every response must cite its sources, or it can't be trusted or audited
The loop
A RAG architecture where the retrieval layer does the heavy lifting:
- Structure-aware ingestion — SEC-EDGAR APIs fetch filings; chunking respects document structure, preserving tables and section boundaries instead of splitting mid-table
- Semantic search — ChromaDB vector store with
text-embedding-3-large, combined with metadata filtering on company, filing date, and section type - Multi-stage retrieval — broad initial retrieval, then reranking to surface the most relevant chunks per query
- Constrained generation — the generator may only answer from retrieved context, and must cite; automatic ticker and period parsing routes queries to the right filings
The build
- FastAPI backend — document ingestion, query processing, response generation
- ChromaDB — persistent vector store with company/filing metadata for filtered retrieval
- LangChain orchestration — the RAG pipeline, conversation memory, chain-of-thought reasoning
- Streamlit frontend — chat interface with conversation history and source highlighting
- Cloud Run deployment — live, with persistent conversation history
Evidence
Trust in a RAG system is an eval problem, so evaluation is part of the build, not a postscript:
- A multi-model evaluation pipeline uses Claude Opus as judge, scoring responses on accuracy, relevance, and faithfulness to the source documents
- Answers carry line-level citations back into the filing, so any number can be checked against the original in one click
- The corpus spans multiple years of filings across companies, exercising retrieval across heterogeneous document structures
Impact
- Time-to-insight cut from hours of manual reading to seconds of conversation
- Automatic ticker and period parsing makes queries frictionless
- Deployed live on Cloud Run with persistent conversation history
Questions about this project? Press ⌘K — the chat answers from these case studies and cites them.