How d-hackmt/enterprise-rag-with-guardrails-gateways-evals works
Enterprise Agentic RAG accepts user questions through a Streamlit chat interface and FastAPI. The API applies NeMo Guardrails and an optional Redis semantic-cache check before invoking a LangGraph planner, retrieval, and response workflow; answers use Portkey-routed LLMs, with conversation state checkpointed to memory. Separately, GCS uploads trigger document parsing, chunking, embedding, and Qdrant indexing. The evaluation dashboard runs live queries and guardrail checks, scores results, and persists history. Edges reflect the README and shown source references; some cloud wiring and evaluation internals are documented but not sampled.
Main entry points: graph.py Agent Graph · processor.py Ingestion Processor · app.py Evaluation Dashboard · main.py Query API
Components 34
Query and Agent
- Chat UI
ui/app.py - Query API
app/main.py - Guardrails
app/guardrails/rails.py - Safety Rules
app/guardrails/colang_rules.py - Agent Graph
app/agents/graph.py - Agent State
app/agents/state.py - Planner
app/agents/nodes/planner.py - Retriever
app/agents/nodes/retriever.py - Responder
app/agents/nodes/responder.py
Knowledge Ingestion
- Qdrant Search
app/services/retrieval/qdrant_service.py - Qdrant Vector DB
- FlashRank Reranker
app/services/retrieval/ranking_service.py - GCS Upload
- Eventarc Trigger
- Ingestion Processor
app/ingestion/processor.py - Document Loaders
app/ingestion/loaders - Text Chunker
app/ingestion/chunking/splitter.py - Processed Documents
State and Integrations
- Semantic Cache
app/services/gcp/redis_semantic_cache.py - Redis Cache
- Embedding Service
app/services/retrieval/embedding.py - Portkey Gateway
app/gateway/client.py - Groq Models
- Conversation Checkpointer
app/agents/graph.py - Postgres Connection
app/services/gcp/database_service.py - Cloud SQL Postgres
Evaluation
- Evaluation Dashboard
evals/app.py - Live Query Pipeline
evals/pipeline.py - Guardrails Evaluation
evals/guardrails_eval.py - RAGAS Metrics
evals/metrics.py - Evaluation History
evals/store.py - GCS Eval History
Other components
- User
- Evaluator
Connections 35
- User → Chat UI: asks
- Chat UI → Query API: submits query
- Query API → Guardrails: checks safety
app/main.py - Guardrails → Safety Rules: uses rules
app/guardrails/rails.py - Query API → Semantic Cache: checks and stores
app/main.py - Semantic Cache → Redis Cache: reads and writes
- Query API → Agent Graph: invokes
app/main.py - Agent Graph → Planner: dispatches
app/agents/graph.py - Agent Graph → Retriever: routes technical
app/agents/graph.py - Agent Graph → Responder: routes conversational
app/agents/graph.py - Agent Graph → Agent State: uses schema
app/agents/graph.py - Retriever → Qdrant Search: searches
app/agents/nodes/retriever.py - Qdrant Search → Embedding Service: embeds query
app/services/retrieval/qdrant_service.py - Qdrant Search → Qdrant Vector DB: queries vectors
- Retriever → FlashRank Reranker: reranks results
app/agents/nodes/retriever.py - Retriever → Responder: provides context
app/agents/graph.py - Responder → Portkey Gateway: requests generation
- Portkey Gateway → Groq Models: routes with fallback
app/gateway/client.py - Agent Graph → Conversation Checkpointer: persists conversation
app/agents/graph.py - Conversation Checkpointer → Postgres Connection: uses connection
app/agents/graph.py - Postgres Connection → Cloud SQL Postgres: connects to
- GCS Upload → Eventarc Trigger: emits finalized event
- Eventarc Trigger → Ingestion Processor: triggers processing
- Ingestion Processor → Document Loaders: parses files
app/ingestion/processor.py - Ingestion Processor → Text Chunker: chunks text
app/ingestion/processor.py - Ingestion Processor → Embedding Service: embeds chunks
app/ingestion/processor.py - Ingestion Processor → Processed Documents: stores processed data
app/ingestion/processor.py - Ingestion Processor → Qdrant Vector DB: indexes vectors
app/ingestion/processor.py - Evaluator → Evaluation Dashboard: runs evaluation
- Evaluation Dashboard → Live Query Pipeline: starts live runs
evals/app.py - Live Query Pipeline → Query API: posts queries
evals/pipeline.py - Evaluation Dashboard → Guardrails Evaluation: runs safety checks
evals/app.py - Evaluation Dashboard → RAGAS Metrics: scores results
evals/app.py - Evaluation Dashboard → Evaluation History: loads and saves runs
evals/app.py - Evaluation History → GCS Eval History: persists history