How riesyaf/policy-agentic-rag works
The product is a Streamlit chat assistant that routes questions to QBE policy or general-insurance retrieval, then returns a grounded, cited answer. Its supporting data workflow extracts PDFs through separate hierarchical-policy and general-document pipelines, then indexes the resulting chunks in ChromaDB. The graph preserves both paths and the runtime’s routing, retrieval, citation construction, and answer generation. Relationships follow the excerpts and README; generated chunk files are pipeline intermediates, not present in the supplied tree.
Main entry points: agent.py Intent Router · rag_engine.py QBE Retrieval · indexing.py Chunk Indexer · data PDF Collection
Components 18
Chat and Routing
- Chat UI
app.py - Intent Router
src/agent.py - QBE Search Tool
src/agent.py - General Search Tool
src/agent.py
Document Preparation
- QBE Policy PDFs
data/qbe - Industry Standards PDF
data/general/10.sn-general-2008_eng_2017update.pdf - Policy Parser
src/ingestion.py - General Text Splitter
src/ingestion.py - Chunk Indexer
src/indexing.py - PDF Collection
data
Retrieval and Answers
- QBE Retrieval
src/rag_engine.py - General Retrieval
src/rag_engine.py - Citation Prompt Builder
src/rag_engine.py - Answer Generation
src/rag_engine.py
Data and Model Services
- ChromaDB
- Routing LLM
src/agent.py - Ollama Service
Other components
- Questioner
Connections 19
- Questioner → Chat UI: asks
app.py - Chat UI → Intent Router: streams to
app.py - Intent Router → Routing LLM: routes with
src/agent.py - Routing LLM → Ollama Service: queries
- Intent Router → QBE Search Tool: dispatches
src/agent.py - Intent Router → General Search Tool: dispatches
src/agent.py - QBE Search Tool → QBE Retrieval: calls
src/agent.py - General Search Tool → General Retrieval: calls
src/agent.py - QBE Retrieval → ChromaDB: queries
src/rag_engine.py - General Retrieval → ChromaDB: queries
src/rag_engine.py - QBE Retrieval → Citation Prompt Builder: formats context
src/rag_engine.py - General Retrieval → Citation Prompt Builder: formats context
src/rag_engine.py - Citation Prompt Builder → Answer Generation: supplies prompt
src/rag_engine.py - Answer Generation → Ollama Service: generates with
src/rag_engine.py - PDF Collection → Policy Parser: provides PDFs
README.md - PDF Collection → General Text Splitter: provides PDFs
README.md - Policy Parser → Chunk Indexer: indexes chunks
README.md - General Text Splitter → Chunk Indexer: indexes chunks
README.md - Chunk Indexer → ChromaDB: upserts chunks
src/indexing.py