How akilanpl/enterprise-rag-platform works
This is an enterprise-oriented, multi-tenant RAG API. A chat request binds its tenant, embeds the query, retrieves and reranks documents, then generates an answer from sanitized context; generation records estimated token cost. The repository also has a separate orchestration function, ingestion and evaluation modules, and security and observability components. The README describes these capabilities but gives little implementation detail; links for unsampled subsystems are therefore omitted rather than inferred.
Main entry points: chat.py Chat endpoint · generator.py Answer generator · retriever.py Vector retrieval · rag_pipeline.py RAG pipeline
Components 25
API and orchestration
- FastAPI application
app/main.py - Chat endpoint
app/api/chat.py - RAG pipeline
app/orchestration/rag_pipeline.py
Knowledge pipeline
- Document ingestion
app/ingestion - Document loader
app/ingestion/loader.py - Document chunker
app/ingestion/chunker.py - Vector indexer
app/ingestion/indexer.py - Vector retrieval
app/retrieval/retriever.py - Result reranker
app/retrieval/reranker.py
Answer generation
- Answer generator
app/generation/generator.py
Tenant and security
- Context sanitizer
app/core/prompt_firewall.py - Tenant context
app/core/tenant.py - Access controls
app/core/auth.py - Redis cache
app/core/cache.py
Evaluation and observability
- Cost tracking
app/observability/cost.py - Latency tracking
app/observability/latency.py - Runtime metrics
app/observability/metrics.py - Request tracing
app/observability/tracing.py - User feedback
app/observability/feedback.py - RAG evaluation
app/evaluation/ragas_eval.py
Other components
- API client
- Qdrant
- Embedding model
- OpenAI API
- Redis
Connections 19
- API client → Chat endpoint: submits query
- FastAPI application → Chat endpoint: mounts router
- Chat endpoint → Tenant context: sets tenant
- Chat endpoint → Embedding model: embeds query
- Chat endpoint → Vector retrieval: retrieves documents
- Chat endpoint → Result reranker: reranks documents
- Chat endpoint → Answer generator: requests answer
- Vector retrieval → Tenant context: reads tenant
- Vector retrieval → Qdrant: searches vectors
- Vector indexer → Embedding model: embeds documents
- Vector indexer → Qdrant: writes vectors
- Answer generator → Context sanitizer: sanitizes context
- Answer generator → OpenAI API: requests completion
- Answer generator → Cost tracking: records usage
- Cost tracking → Tenant context: reads tenant
- RAG pipeline → Vector retrieval: retrieves documents
- RAG pipeline → Answer generator: generates answer
- RAG pipeline → Latency tracking: tracks duration
- Redis cache → Redis: reads and writes