How shreya2338/epa-consultant-agent works
EPA Consultant Agent is a browser-based RAG question-answering system for EPA permit documents. Users can ask for grounded answers with citations and retrieved evidence, inspect raw matching excerpts, or browse and open extracted tables. The documented preparation path extracts PDF content and tables, creates heading-based chunks, and adds table content; retrieval combines keyword, semantic, and diversity search before reranking. The excerpts show the frontend/API and retrieval wiring, but not all table-serving and document-preparation connections, so those links are omitted where unverified.
Main entry points: retrieval_langchain.py Hybrid retrieval and reranking · api.py FastAPI endpoints · heading-chunks-w-title.json Heading and table chunks · 2026-pgp.pdf Permit PDF
Components 15
User interface
- Chat and table UI
frontend/script.js
API and answers
- FastAPI endpoints
api.py - Grounded answer generation
api.py - Runtime settings
config.py
Search and ranking
- Hybrid retrieval and reranking
retrieval/retrieval_langchain.py - FAISS document index
official_faiss_store_with_tables.faiss
Document preparation
- Heading and table chunks
data/heading-chunks-w-title.json - Heading-based chunking
data/chunk_by_heading.py - Character chunking
data/chunk_by_char.py - PDF and table extraction
data/document_processor.py - Table-to-chunk conversion
data/prepare_table_data.py - Processed table data
data/processed_document.json
Other components
- Browser user
- OpenAI services
- Permit PDF
2026-pgp.pdf
Connections 15
- Browser user → Chat and table UI: asks or browses
frontend/script.js - Chat and table UI → FastAPI endpoints: sends requests
frontend/script.js - FastAPI endpoints → Hybrid retrieval and reranking: retrieves passages
api.py - FastAPI endpoints → Grounded answer generation: requests answer
api.py - Grounded answer generation → OpenAI services: generates answer
api.py - Hybrid retrieval and reranking → Runtime settings: reads settings
retrieval/retrieval_langchain.py - Hybrid retrieval and reranking → FAISS document index: searches index
retrieval/retrieval_langchain.py - Hybrid retrieval and reranking → Heading and table chunks: loads chunks
retrieval/retrieval_langchain.py - Hybrid retrieval and reranking → OpenAI services: embeds queries
retrieval/retrieval_langchain.py - Heading-based chunking → Permit PDF: loads pages
data/chunk_by_heading.py - Heading-based chunking → Heading and table chunks: writes chunks
data/chunk_by_heading.py - Character chunking → Permit PDF: loads pages
data/chunk_by_char.py - PDF and table extraction → Permit PDF: processes PDF
data/document_processor.py - Table-to-chunk conversion → Processed table data: loads tables
data/prepare_table_data.py - Table-to-chunk conversion → Heading and table chunks: extends chunks
data/prepare_table_data.py