How richie-rk/rag-app-azure works
This is a multi-tenant Azure RAG application: users authenticate, select a project, upload documents for parsing and indexing, then ask questions and receive streamed, cited answers. The graph preserves the documented UI, chat, ingestion, project/access, and storage capabilities. Sampled source supports the chat and per-file ingestion calls; some utils endpoints and several UI flows are documented but unsampled, so their internal wiring is not expanded.
Main entry points: main.py Chat endpoint · orchestrator.py File processing · client.ts API client · azure_clients.py Azure client factory
Components 32
Web client
- React application
ui/src/App.tsx - Sign-in and identity
ui/src/auth/graph-service.ts - Chat and streaming UI
ui/src/hooks/useStreamChat.ts - Project management UI
ui/src/pages/ProjectsPage.tsx - Data loader UI
ui/src/pages/DataLoaderPage.tsx - API client
ui/src/api/client.ts
Application services
- Chat endpoint
services/chat/main.py - Hybrid retrieval
services/chat/pipeline/search.py - Prompt assembly
services/chat/pipeline/prompt.py - Streaming completion
services/chat/pipeline/llm.py - Citations and follow-ups
services/chat/pipeline/citations.py - NDJSON formatting
services/chat/streaming.py - Project and utility API
services/utils/endpoints/projects.py - Session and feedback APIs
services/utils/endpoints/sessions.py - Document APIs
services/utils/endpoints/documents.py
Document ingestion
- Ingestion trigger
services/ingestion/function_app.py - File processing
services/ingestion/orchestrator.py - Document parsers
services/ingestion/parsers/__init__.py - Chunking strategies
services/ingestion/chunking/__init__.py - Text embeddings
services/ingestion/embedding.py - Search indexing
services/ingestion/indexer.py
Shared backend
- Authentication and authorization
services/shared/authz.py - Domain models
services/shared/models.py - SQL database access
services/shared/database.py - Azure client factory
services/shared/azure_clients.py
Azure services
- Microsoft Entra ID
- Azure AI Search
- Azure OpenAI
- Blob Storage
- Table Storage
- Azure SQL
Other components
- User
Connections 39
- User → React application: uses
- React application → Sign-in and identity: authenticates through
- Sign-in and identity → Microsoft Entra ID: signs in with
- Chat and streaming UI → API client: sends chat
- API client → Chat endpoint: posts request
- Chat endpoint → Authentication and authorization: authorizes index
- Chat endpoint → Hybrid retrieval: queries
- Hybrid retrieval → Azure AI Search: hybrid searches
- Chat endpoint → Prompt assembly: builds messages
- Chat endpoint → Streaming completion: streams prompt
- Streaming completion → Azure OpenAI: requests tokens
- Chat endpoint → Citations and follow-ups: extracts follow-ups
- Chat endpoint → NDJSON formatting: formats chunks
- NDJSON formatting → Chat and streaming UI: streams NDJSON
- Project management UI → API client: calls project APIs
- Data loader UI → API client: calls upload APIs
- API client → Project and utility API: manages projects
- API client → Document APIs: accesses documents
- API client → Session and feedback APIs: manages sessions
- Data loader UI → Ingestion trigger: starts ingestion
- Ingestion trigger → File processing: dispatches files
- File processing → Blob Storage: downloads files
- File processing → Document parsers: extracts content
- File processing → Chunking strategies: creates chunks
- File processing → Text embeddings: embeds chunks
- Text embeddings → Azure OpenAI: creates embeddings
- File processing → Search indexing: indexes chunks
- Search indexing → Azure AI Search: writes documents
- File processing → SQL database access: records audit
- SQL database access → Azure SQL: reads and writes
- Project and utility API → SQL database access: accesses records
- Session and feedback APIs → Table Storage: stores chat history
- Document APIs → Blob Storage: reads documents
- Chat endpoint → SQL database access: checks project access
- Azure client factory → Azure AI Search: creates clients
- Azure client factory → Azure OpenAI: creates clients
- Azure client factory → Blob Storage: creates clients
- Azure client factory → Table Storage: creates clients
- Authentication and authorization → Microsoft Entra ID: validates identity