U10 · Secondary

IRS Helper — RAG over US tax documents

A RAG system over IRS forms and publications. It crawls PDFs and EPUBs from irs.gov, indexes them in pgvector and answers through an OpenAI-compatible API that OpenWebUI uses as if it were a model.

private

Engineering decisions

  • Scrapy crawling: separate spiders for irs.gov PDFs and EPUBs, stored in Postgres. EPUBs are converted to PDF and uploaded to Cloudflare R2.
  • Vectorization with OpenAI embeddings (1536 dimensions), skipping non-English versions of the same document.
  • Two retrieval modes: when the question asks for a form ("Form 1040"), a regex pulls the form number and returns a direct link with no LLM call. Otherwise, vector search with Cohere reranking and an answer grounded in the retrieved context.
  • FastAPI server compatible with `/v1/chat/completions` (including `stream: true` over SSE), so any OpenAI client works unchanged.
  • Exposed in OpenWebUI through LiteLLM, which registers the server as a model named `irs-helper`.
  • Web dashboard with index stats and a list of documents not yet vectorized.

Stack

PythonScrapyPostgreSQLpgvectorOpenAI EmbeddingsCohere RerankFastAPILiteLLMOpenWebUIDocker

What it shows

People who need to quickly find a form or a rule in a large set of tax documents, from a chat interface they already use.