Skip to content

Commit 1fba2b6

Browse files
Copilotchanezon
andcommitted
Add comprehensive Mermaid.js architecture diagram for the Azure Search OpenAI demo app
Co-authored-by: chanezon <[email protected]>
1 parent 91ddf1d commit 1fba2b6

File tree

3 files changed

+150
-0
lines changed

3 files changed

+150
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ The repo includes sample data so it's ready to try end to end. In this sample ap
7070

7171
![RAG Architecture](docs/images/appcomponents.png)
7272

73+
For a detailed interactive architecture diagram with full component descriptions, see the [Architecture Overview](docs/architecture.md).
74+
7375
## Azure account requirements
7476

7577
**IMPORTANT:** In order to deploy and run this example, you'll need:
@@ -246,6 +248,7 @@ The resource group and all the resources will be deleted.
246248

247249
You can find extensive documentation in the [docs](docs/README.md) folder:
248250

251+
- [Architecture Overview](docs/architecture.md)
249252
- Deploying:
250253
- [Troubleshooting deployment](docs/deploy_troubleshooting.md)
251254
- [Debugging the app on App Service](docs/appservice.md)

docs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Consult the main [README](../README.md) for general information about the project.
44
These are advanced topics that are not necessary for a basic deployment.
55

6+
- [Architecture Overview](architecture.md) - Detailed system architecture diagram and component descriptions
7+
68
- Deploying:
79
- [Troubleshooting deployment](docs/deploy_troubleshooting.md)
810
- [Debugging the app on App Service](appservice.md)

docs/architecture.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Architecture Overview
2+
3+
This document provides a detailed architecture diagram of the Azure Search OpenAI demo application, showing the complete RAG (Retrieval Augmented Generation) flow and all components.
4+
5+
## System Architecture
6+
7+
```mermaid
8+
graph TB
9+
%% User Interface Layer
10+
User[👤 User] --> WebApp[🌐 React Frontend<br/>TypeScript/Vite]
11+
12+
%% Application Layer
13+
WebApp --> Backend[🐍 Python Backend<br/>Quart API]
14+
15+
%% Authentication (Optional)
16+
Backend --> Auth{🔐 Authentication<br/>Enabled?}
17+
Auth -->|Yes| EntraID[🏢 Microsoft Entra ID<br/>Azure AD]
18+
Auth -->|No| ProcessRequest[Process Request]
19+
EntraID --> ProcessRequest
20+
21+
%% Core RAG Flow
22+
ProcessRequest --> RAGFlow{📋 Request Type}
23+
RAGFlow -->|Chat| ChatApproach[💬 Chat Approach<br/>chatreadretrieveread.py]
24+
RAGFlow -->|Ask| AskApproach[❓ Ask Approach<br/>retrievethenread.py]
25+
RAGFlow -->|Vision| VisionApproach[👁️ Vision Approach<br/>GPT-4V enabled]
26+
27+
%% Search and Retrieval
28+
ChatApproach --> QueryRewrite[🔄 Query Rewriting<br/>OpenAI API]
29+
QueryRewrite --> SearchIndex[🔍 Azure AI Search<br/>Vector + Keyword Search]
30+
AskApproach --> SearchIndex
31+
VisionApproach --> SearchIndex
32+
VisionApproach --> VisionAPI[👁️ Azure AI Vision<br/>Image Analysis]
33+
34+
%% Document Storage and Processing
35+
SearchIndex --> BlobStorage[💾 Azure Blob Storage<br/>Document Storage]
36+
DocProcessor[📄 Document Processor<br/>prepdocs.py] --> BlobStorage
37+
DocProcessor --> SearchIndex
38+
DocProcessor --> FormRecognizer[📋 Azure AI Document Intelligence<br/>Text Extraction]
39+
DocProcessor --> OpenAIEmbedding[🧮 Azure OpenAI<br/>Embedding Generation]
40+
41+
%% AI Processing
42+
ChatApproach --> OpenAI[🤖 Azure OpenAI Service<br/>GPT Models]
43+
AskApproach --> OpenAI
44+
VisionApproach --> OpenAI
45+
OpenAIEmbedding --> SearchIndex
46+
47+
%% Response Generation
48+
OpenAI --> ResponseProcessor[📝 Response Processing<br/>Citations & Sources]
49+
ResponseProcessor --> WebApp
50+
51+
%% Optional Features
52+
Backend --> ChatHistory{💭 Chat History<br/>Enabled?}
53+
ChatHistory -->|Cosmos DB| CosmosDB[🌌 Azure Cosmos DB<br/>Persistent Storage]
54+
ChatHistory -->|Browser| BrowserStorage[🖥️ Browser Storage<br/>Local Storage]
55+
ChatHistory -->|Disabled| NoHistory[No Storage]
56+
57+
Backend --> Speech{🎤 Speech<br/>Enabled?}
58+
Speech -->|Yes| SpeechService[🗣️ Azure Speech Service<br/>STT/TTS]
59+
Speech -->|No| NoSpeech[No Speech]
60+
61+
%% Monitoring and Observability
62+
Backend --> AppInsights[📊 Azure Application Insights<br/>Monitoring & Telemetry]
63+
OpenAI --> AppInsights
64+
SearchIndex --> AppInsights
65+
66+
%% Deployment Infrastructure
67+
WebApp --> ContainerApps[📦 Azure Container Apps<br/>Default Hosting]
68+
Backend --> ContainerApps
69+
ContainerApps --> ContainerRegistry[📋 Azure Container Registry<br/>Container Images]
70+
71+
%% Alternative Deployment
72+
WebApp -.-> AppService[🌐 Azure App Service<br/>Alternative Hosting]
73+
Backend -.-> AppService
74+
75+
%% Security and Access Control
76+
Backend --> AccessControl{🛡️ Access Control<br/>Enabled?}
77+
AccessControl -->|Yes| SecurityFilter[🔒 Security Filters<br/>OID/Groups based]
78+
AccessControl -->|No| PublicAccess[Public Access]
79+
SecurityFilter --> SearchIndex
80+
81+
%% Styling
82+
classDef userInterface fill:#e1f5fe
83+
classDef application fill:#f3e5f5
84+
classDef azureService fill:#fff3e0
85+
classDef storage fill:#e8f5e8
86+
classDef optional fill:#fce4ec
87+
classDef security fill:#ffebee
88+
89+
class User,WebApp userInterface
90+
class Backend,ProcessRequest,RAGFlow,ChatApproach,AskApproach,VisionApproach,ResponseProcessor application
91+
class OpenAI,SearchIndex,FormRecognizer,OpenAIEmbedding,VisionAPI,AppInsights,ContainerApps,ContainerRegistry,AppService,SpeechService azureService
92+
class BlobStorage,CosmosDB,BrowserStorage storage
93+
class ChatHistory,Speech,NoHistory,NoSpeech,VisionApproach optional
94+
class Auth,EntraID,AccessControl,SecurityFilter,PublicAccess security
95+
```
96+
97+
## Key Components
98+
99+
### Frontend Layer
100+
- **React Frontend**: Modern web application built with TypeScript and Vite
101+
- **User Interface**: Provides Chat and Ask interfaces for different interaction modes
102+
103+
### Backend Layer
104+
- **Python API**: Quart-based asynchronous web framework
105+
- **RAG Approaches**: Different strategies for retrieval and generation
106+
- Chat: Multi-turn conversations with context
107+
- Ask: Single-turn Q&A
108+
- Vision: Image-aware processing with GPT-4V
109+
110+
### Azure Services
111+
- **Azure OpenAI Service**: Core AI model hosting (GPT-4, GPT-3.5, Ada embeddings)
112+
- **Azure AI Search**: Vector and keyword search with semantic ranking
113+
- **Azure Blob Storage**: Document storage and content management
114+
- **Azure AI Document Intelligence**: Text extraction from various document formats
115+
- **Azure Container Apps**: Primary hosting platform (scalable, serverless)
116+
- **Azure Application Insights**: Monitoring, logging, and telemetry
117+
118+
### Optional Components
119+
- **Microsoft Entra ID**: Authentication and authorization
120+
- **Azure Cosmos DB**: Persistent chat history storage
121+
- **Azure AI Vision**: Image analysis for vision-enabled scenarios
122+
- **Azure Speech Service**: Speech-to-text and text-to-speech capabilities
123+
124+
### Data Flow
125+
126+
1. **Document Ingestion**: Documents are processed by `prepdocs.py`, which extracts text using Azure AI Document Intelligence and generates embeddings using Azure OpenAI
127+
2. **User Query**: User submits a question through the React frontend
128+
3. **Authentication** (Optional): User identity is verified against Microsoft Entra ID
129+
4. **Query Processing**: Backend determines the appropriate RAG approach based on request type
130+
5. **Search & Retrieval**: Query is executed against Azure AI Search to find relevant documents
131+
6. **AI Generation**: Retrieved content is combined with the user query and sent to Azure OpenAI for response generation
132+
7. **Response**: AI-generated response with citations is returned to the user
133+
134+
### Security Features
135+
- **Access Control**: Optional row-level security based on user identity
136+
- **Security Filters**: OID and group-based filtering of search results
137+
- **Private Endpoints**: Network isolation capabilities for enhanced security
138+
139+
## Deployment Options
140+
141+
The application supports two primary deployment modes:
142+
- **Azure Container Apps** (Default): Serverless container hosting with automatic scaling
143+
- **Azure App Service**: Traditional PaaS hosting option
144+
145+
Both options use Azure Container Registry for container image management and Azure Application Insights for monitoring.

0 commit comments

Comments
 (0)