How shivp102/emp_policy_assistant works
Employee Policy Assistant is a Streamlit chat application that grounds policy answers in uploaded or stored PDFs. Its principal workflow checks or rebuilds the index, retrieves and reranks relevant chunks for a question, then generates a cited answer and displays its sources. Separate product branches support policy uploads, Langfuse tracing, and offline retrieval evaluation. The README documents these capabilities; sampled source confirms the main ingestion, retrieval, chat, tracing, and evaluation orchestration, while some component details are documented but not sampled.
Main entry points: rag_trace.py RAG turn trace · pipeline.py Ingestion pipeline · streamlit_app.py Streamlit app · runner.py Evaluation runner
Components 23
Policy ingestion
- Policy PDFs
data/company_policies - Ingestion pipeline
src/ingestion/pipeline.py - PDF loader
src/ingestion/document_loader.py - Policy chunker
src/ingestion/chunker.py - HuggingFace embedder
src/ingestion/embedder.py - Ingest state
src/utils/ingest_state.py - Ingest manifest
- Chroma store
src/vector_store/chroma_store.py - ChromaDB index
Search and answers
- Retrieval pipeline
src/retrieval/pipeline.py - Vector retriever
src/retrieval/retriever.py - Cross-encoder reranker
src/retrieval/reranker.py - Answer generator
src/generation/answer_generator.py
Chat interface
- Streamlit app
app/streamlit_app.py - PDF uploads
src/utils/pdf_upload.py
Tracing
- RAG turn trace
src/observability/rag_trace.py - Langfuse client
src/observability/langfuse_client.py - Langfuse Cloud
Evaluation
- Policy QA dataset
eval/datasets/policy_qa_v1.jsonl - Evaluation runner
src/evaluation/runner.py - Retrieval metrics
src/evaluation/metrics.py
Other components
- Employee
- OpenAI model
Connections 29
- Employee → Streamlit app: asks policy
- Streamlit app → PDF uploads: saves uploads
- PDF uploads → Policy PDFs: writes PDFs
- Streamlit app → Ingestion pipeline: checks and rebuilds
- Ingestion pipeline → PDF loader: loads PDFs
- PDF loader → Policy PDFs: reads
- Ingestion pipeline → Policy chunker: chunks pages
- Ingestion pipeline → Chroma store: rebuilds index
- Ingestion pipeline → Ingest state: checks and saves fingerprints
- Ingest state → Ingest manifest: reads and writes
- Chroma store → HuggingFace embedder: uses embeddings
- Chroma store → ChromaDB index: persists chunks
- Streamlit app → RAG turn trace: runs chat turn
- RAG turn trace → Retrieval pipeline: retrieves context
- RAG turn trace → Answer generator: generates answer
- Retrieval pipeline → Vector retriever: gets candidates
- Retrieval pipeline → Cross-encoder reranker: reranks candidates
- Vector retriever → HuggingFace embedder: embeds query
- Vector retriever → Chroma store: searches vectors
- Answer generator → OpenAI model: invokes model
- RAG turn trace → Langfuse client: configures and flushes
- RAG turn trace → Langfuse Cloud: records trace and spans
- Langfuse client → Langfuse Cloud: gets client
- Streamlit app → Employee: shows answer and sources
- Policy QA dataset → Evaluation runner: provides questions
- Evaluation runner → Retrieval pipeline: evaluates retrieval
- Evaluation runner → RAG turn trace: runs optional full RAG
- Evaluation runner → Retrieval metrics: scores results
- Evaluation runner → Langfuse Cloud: runs experiment