Architecture
Describes the components and data flow of a Q&A system built with React, Azure Functions, and OpenAI.
What this file does
Describes the components and data flow of a Q&A system built with React, Azure Functions, and OpenAI.
When to use it
- Documenting a multi-service architecture for a new team member
- Planning a similar system with frontend, backend, and Azure services
- Reviewing integration points between React, Azure Functions, and OpenAI
Assumes this stack
Architecture Diagram Description
Components
-
Frontend (React Application)
- Components: Answer, QuestionInput, Chat, ChatHistoryList, etc.
- API Integration: Interacts with the backend via API calls.
-
Backend (Azure Functions)
- Functions: add_url_embeddings, batch_push_results, batch_start_processing, get_conversation_response.
- Helpers: env_helper, config_helper, llm_helper, etc.
-
Data Processing
- Document Chunking: chunking_strategy, document_chunking_base, layout, page, paragraph, fixed_size_overlap.
- Embedding Generation: embedder_base, embedder_factory, integrated_vectorization_embedder, push_embedder.
- Search Handlers: azure_search_handler, integrated_vectorization_search_handler, search_handler_base, search.
-
Orchestration
- Strategies: orchestration_strategy, orchestrator_base, open_ai_functions, lang_chain_agent, semantic_kernel, prompt_flow.
- Tools: question_answer_tool, text_processing_tool, post_prompt_tool, chat_plugin, post_answering_plugin.
-
Azure Services
- Azure Functions: Hosts the backend functions.
- Azure Search: Provides search capabilities.
- Azure Blob Storage: Stores documents and other data.
- Azure OpenAI: Provides natural language processing capabilities.
- Azure Monitor and Application Insights: Monitors application performance and health.
-
Teams Extension
- Bot: Handles interactions within Microsoft Teams.
- Configuration: config.ts, index.ts, model.ts.
Data Flow
-
User Interaction
- Users interact with the frontend application (React) via a web browser or Microsoft Teams.
- Users send queries and receive responses through the UI components.
-
API Calls
- The frontend makes API calls to the backend (Azure Functions) to process user queries and retrieve responses.
-
Data Processing
- The backend functions handle data ingestion, document chunking, and embedding generation.
- Processed data is stored in Azure Blob Storage and indexed in Azure Search.
-
Search and Retrieval
- The backend performs search operations using Azure Search and retrieves relevant documents.
- Vector-based search improves the accuracy and relevance of search results.
-
Orchestration
- The backend uses various orchestration strategies to handle user queries and generate responses.
- Azure OpenAI is used for natural language processing to generate accurate responses.
-
Teams Integration
- The Teams bot handles interactions within Microsoft Teams.
- The bot communicates with the backend to process queries and retrieve responses.
Diagram Elements
-
Frontend
- Box labeled "Frontend (React Application)"
- Inside the box, list components: Answer, QuestionInput, Chat, ChatHistoryList, etc.
- Arrow from "Frontend" to "Backend" labeled "API Calls"
-
Backend
- Box labeled "Backend (Azure Functions)"
- Inside the box, list functions: add_url_embeddings, batch_push_results, batch_start_processing, get_conversation_response.
- Arrow from "Backend" to "Data Processing" labeled "Data Processing"
- Arrow from "Backend" to "Search and Retrieval" labeled "Search Operations"
- Arrow from "Backend" to "Orchestration" labeled "Orchestration"
-
Data Processing
- Box labeled "Data Processing"
- Inside the box, list components: Document Chunking, Embedding Generation, Search Handlers
- Arrow from "Data Processing" to "Azure Blob Storage" labeled "Store Data"
- Arrow from "Data Processing" to "Azure Search" labeled "Index Data"
-
Search and Retrieval
- Box labeled "Search and Retrieval"
- Inside the box, list components: Azure Search, Vector-Based Search
- Arrow from "Search and Retrieval" to "Backend" labeled "Retrieve Data"
-
Orchestration
- Box labeled "Orchestration"
- Inside the box, list strategies: open_ai_functions, lang_chain_agent, semantic_kernel, prompt_flow
- Arrow from "Orchestration" to "Azure OpenAI" labeled "NLP"
-
Azure Services
- Box labeled "Azure Services"
- Inside the box, list services: Azure Functions, Azure Search, Azure Blob Storage, Azure OpenAI, Azure Monitor, Application Insights
-
Teams Extension
- Box labeled "Teams Extension"
- Inside the box, list components: Bot, Configuration
- Arrow from "Teams Extension" to "Backend" labeled "API Calls"
Example Diagram
+-------------------+ +-------------------+ +-------------------+
| Frontend | | Backend | | Data Processing |
| (React App) | | (Azure Functions)| | |
| | | | | |
| +---------------+ | | +---------------+ | | +---------------+ |
| | Answer | | | | add_url_embed | | | | Doc Chunking | |
| | QuestionInput | | | | batch_push | | | | Embed Gen | |
| | Chat | | | | batch_start | | | | Search Handlers| |
| | ChatHistory | | | | get_conv_resp | | | +---------------+ |
| +---------------+ | | +---------------+ | | |
+-------------------+ +-------------------+ +-------------------+
| | |
| API Calls | Data Processing | Store Data
v v v
+-------------------+ +-------------------+ +-------------------+
| Search and | | Orchestration | | Azure Blob |
| Retrieval | | | | Storage |
| | | +---------------+ | +-------------------+
| +---------------+ | | | open_ai_func | |
| | Azure Search | | | | lang_chain | |
| | Vector Search | | | | semantic_ker | |
| +---------------+ | | | prompt_flow | |
+-------------------+ | +---------------+ |
+-------------------+
|
| NLP
v
+-------------------+
| Azure OpenAI |
+-------------------+
+-------------------+
| Teams Extension |
| |
| +---------------+ |
| | Bot | |
| | Configuration | |
| +---------------+ |
+-------------------+
|
| API Calls
v
+-------------------+
| Backend |
| (Azure Functions)|
+-------------------+
Conclusion
This architecture diagram provides a high-level overview of the components and data flow within the "Percy AI" solution. It illustrates how the frontend, backend, data processing, search and retrieval, orchestration, Azure services, and Teams extension interact with each other to provide a seamless user experience.
What's inside
7 component groups, 6 data flow steps, 1 ASCII diagram, 1 conclusion
Change this for your project
- Replace
Percy AIwith your project name - Replace
add_url_embeddings,batch_push_results,batch_start_processing,get_conversation_responsewith your function names - Replace
open_ai_functions,lang_chain_agent,semantic_kernel,prompt_flowwith your orchestration strategies
Where it goes
Save in docs/ or the repository root. Gives agents and new contributors a map of the codebase.
Worth borrowing
- Separating data processing into chunking, embedding, and search handlers
- Using a diagram to show both component hierarchy and data flow arrows
Related Documents
Design Document: BharatSeva AI
Describes a 10-agent AWS system that helps India's informal workers access government schemes via voice-first, serverless architecture.
OpenClaw Enterprise Transformation Plan
Transforms a single-user AI agent into a dual-mode platform supporting both viral open-source and Fortune 500 enterprise deployments through phased security, IAM, audit, multi-tenancy, and Kubernetes features.
Qwen Image and Edit: Open-sourcing and Local GGUF Generations with Lightning
Documents the Qwen-Image and Qwen-Image-Edit models, covering architecture, training, benchmarks, ComfyUI setup, and prompting techniques for local GGUF deployment.
University of Guelph Rocketry Club - Complete Tech Stack
Documents the full tech stack of a university rocketry club website with AI chatbot, member management, and project showcases.