Download README.md from h-murai/FedInsight: direct link, hf CLI and curl.
- Browser
- Download file 7.27 kB
-
https://huggingface.co/h-murai/FedInsight/resolve/main/README.md
- Command line
-
hf download hf://h-murai/FedInsight/README.md
-
curl -L -o README.md https://huggingface.co/h-murai/FedInsight/resolve/main/README.md
title: FedInsight
emoji: π
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860
pinned: false
license: mit
FedInsight π
AI-powered semantic search and RAG over Federal Reserve communications
FOMC Minutes β’ Beige Book β’ Speeches β’ SEP β’ and more
FedInsight is a complete RAG (Retrieval-Augmented Generation) project that lets you "talk" to Federal Reserve documents. Ask questions in natural language and get accurate quotes + synthesized answers with sources.
Why this is useful
- Analysts and traders want to quickly find what the Fed said about inflation, interest rates, or the labor market in specific periods.
- Researchers study the evolution of monetary policy rhetoric over time.
- It's just interesting: "What did the Fed say about the 2023 banking crisis?"
Current capabilities
- β Full FOMC Minutes scraper (with metadata, resume support, logging)
- β PDF parsing β clean text + metadata (PyMuPDF, column-aware)
- β Chunking + embeddings (sentence-transformers, GPU-accelerated)
- β Vector database: ChromaDB (local default) or pgvector (PostgreSQL)
- β RAG pipeline (retrieval + generation with source attribution)
- β Streamlit chat interface
- β Fully local operation (no mandatory API keys)
- π Beige Book scraper (planned)
Quick start
git clone https://github.com/murai1998/FedInsight.git
cd FedInsight
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\Activate.ps1 on Windows (PowerShell)
pip install -r requirements.txt
NVIDIA GPU (optional but recommended): the default
torchwheel is CPU-only. For GPU acceleration install the matching CUDA build, e.g. for an RTX 50-series (Blackwell) card:pip install --index-url https://download.pytorch.org/whl/cu128 torchThe embedder auto-detects CUDA and uses it when available.
Usage β the full pipeline, step by step
Run everything from the project root with the virtualenv activated (so the
correct Python/torch is used). On Windows you can also prefix commands with
.\.venv\Scripts\python.exe instead of activating.
Optional configuration lives in .env (copy from .env.example):
cp .env.example .env # then edit as needed (vector backend, LLM provider, keys)
1. Start the vector database (pgvector, the default backend)
docker compose up -d # PostgreSQL + pgvector on localhost:5432
2. Load the knowledge base (fast path β no scraping)
The repo ships a prebuilt Chroma store (~4,075 FOMC chunks) but no source PDFs, so the quickest way to a working knowledge base is to copy those vectors into pgvector:
python scripts/migrate_chroma_to_pgvector.py --clear
3. (Optional) Build the knowledge base from scratch
Only needed to add new documents or re-ingest. Scrape, then ingest:
python src/scraper/fomc_minutes_scraper.py # downloads PDFs + metadata
python scripts/ingest_sample.py --clear # parse β chunk β embed β store
python scripts/ingest_sample.py --limit 5 # quick test on 5 docs
Default backend is pgvector. To use the server-less ChromaDB instead
(no Docker), set VECTOR_BACKEND=chroma in .env (or pass --backend chroma).
4a. Simple semantic search (retrieval only, no LLM)
python scripts/query.py "What did the Fed say about inflation in 2023?"
python scripts/query.py "labor market" --k 10
4b. Ask a question (full RAG: retrieval + generated answer + sources)
python scripts/ask.py "How did the Committee view inflation risks in 2022?"
python scripts/ask.py "What was decided about the federal funds rate?" --k 8
python scripts/ask.py "Balance sheet plans" --provider ollama
The LLM provider is set by LLM_PROVIDER (default auto): OpenAI if
OPENAI_API_KEY is set, else a local Ollama server if reachable, else none
(prints the most relevant excerpts β works fully offline, no keys required).
5. Chat UI (Streamlit)
streamlit run app.py
Then open the URL it prints (usually http://localhost:8501). Pick the backend, LLM provider, and number of retrieved chunks in the sidebar.
Project structure
FedInsight/
βββ README.md
βββ PROJECT_SPEC.md
βββ requirements.txt
βββ .env.example # copy to .env to configure
βββ app.py # Streamlit chat UI (step 4)
βββ src/
β βββ scraper/
β β βββ fomc_minutes_scraper.py
β βββ parser/
β β βββ pdf_parser.py # PyMuPDF-based, column-aware
β βββ chunker/
β β βββ text_chunker.py
β βββ embeddings/
β β βββ embedder.py # sentence-transformers, auto CUDA
β βββ vectorstore/
β β βββ base.py # shared interface
β β βββ chroma_store.py # default local backend
β β βββ pgvector_store.py # PostgreSQL backend
β β βββ __init__.py # get_vector_store() factory
β βββ rag/
β βββ retriever.py # query β top-k chunks
β βββ llm.py # openai / ollama / none
β βββ rag_pipeline.py # retrieve + generate + sources
βββ scripts/
β βββ ingest_sample.py # parseβchunkβembedβstore (step 2)
β βββ query.py # semantic search (step 3a)
β βββ ask.py # full RAG Q&A (step 3b)
βββ data/
β βββ raw/ # downloaded PDFs
β βββ processed/ # metadata + logs
β βββ chroma/ # local Chroma DB (auto-created)
βββ notebooks/
Tech stack
- Scraping: requests + BeautifulSoup
- PDF parsing: PyMuPDF (column-aware), with pypdf / pdfplumber as fallbacks
- Embeddings: sentence-transformers (
all-MiniLM-L6-v2, auto CUDA) - Vector DB: pgvector (PostgreSQL, default via
docker compose) or ChromaDB (server-less) - LLM: OpenAI, local Ollama, or offline excerpts-only fallback
- UI: Streamlit (deployed to Hugging Face Spaces via Docker)
- Logging: loguru
Development philosophy
We follow a working skeleton first approach:
- Build a minimal but complete end-to-end pipeline (scrape β parse β chunk β embed β store β retrieve β generate)
- Then iteratively improve quality, features, and robustness.
Roadmap
See plan.md for the detailed, prioritized next steps. In short: retrieval-quality evaluation, hybrid search + reranking, richer metadata filtering in the UI, additional document types (Beige Book, speeches, SEP), and a test suite.
Contributing
Issues and pull requests are welcome at
github.com/murai1998/FedInsight.
Keep everything in English; lint with python -m ruff check src scripts app.py.
Made with love for monetary policy and clean code β€οΈ
A full RAG + Vector DB system over Federal Reserve communications.