Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 29, 2025

This PR adds detailed Mermaid diagrams to visualize the architecture of the Azure Search OpenAI demo application, providing a maintainable and version-controlled alternative to static PNG diagrams.

Changes Made

New Architecture Documentation (docs/architecture.md)

Created comprehensive documentation with three detailed Mermaid diagrams:

  1. Main Architecture Diagram - Shows the complete system architecture including:

    • User interface layer (browser, React frontend)
    • Application layer (Python backend with chat approaches)
    • Azure services (OpenAI, AI Search, Blob Storage, Container Apps, etc.)
    • Data flow connections between all components
  2. Chat Query Flow - Sequence diagram illustrating:

    • User question processing
    • Document retrieval from Azure AI Search
    • OpenAI integration for response generation
    • Citation and source handling
  3. Document Ingestion Flow - Sequence diagram showing:

    • Document upload to Blob Storage
    • Text extraction via Document Intelligence
    • Embedding generation through OpenAI
    • Indexing in Azure AI Search

Updated Documentation Links

  • README.md: Added architecture documentation link to the main documentation list
  • docs/README.md: Added architecture overview to the documentation index

Diagram Syntax Fixes

  • Fixed Mermaid parse errors by removing problematic dash characters from node labels
  • Ensured all diagrams render correctly in GitHub's Mermaid renderer
  • Updated service names to current Azure naming conventions (Azure AI Vision)

Benefits

  • Maintainable: Text-based diagrams can be easily updated with code changes
  • Version Controlled: Architecture changes are tracked in git history
  • Interactive: GitHub renders Mermaid with zoom and pan capabilities
  • Accessible: Text-based format works with screen readers
  • Comprehensive: Covers user flows, system components, and data processing pipelines

The diagrams complement the existing PNG architecture image by providing detailed, interactive visualizations that can evolve with the codebase.

Fixes #2598.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Create a the mermaid diagram for the architecture of this app Add comprehensive Mermaid architecture diagrams for application documentation Jul 29, 2025
@Copilot Copilot AI requested a review from pamelafox July 29, 2025 19:14
Copilot finished work on behalf of pamelafox July 29, 2025 19:14
docs/README.md Outdated
Consult the main [README](../README.md) for general information about the project.
These are advanced topics that are not necessary for a basic deployment.

- **[Architecture Overview](architecture.md)** - Detailed diagrams and component descriptions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the link to the list below, above "HTTP Protocol"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the Architecture Overview link to the list above HTTP Protocol as requested (commit 481c539).

@Copilot Copilot AI requested a review from pamelafox July 29, 2025 23:28
Copilot finished work on behalf of pamelafox July 29, 2025 23:29
README.md Outdated

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

📋 **[View detailed architecture documentation with interactive Mermaid diagrams](docs/architecture.md)**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the link to the documentation list later in the README

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the architecture documentation link to the documentation list later in the README as requested (commit 0ebaa1f).


The following diagram illustrates the complete architecture including user interaction flow, application components, and Azure services:

```mermaid
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error:

Parse error on line 25:
...ddings
- GPT-4V (optional)]
-----------------------^
Expecting 'SQE', 'DOUBLECIRCLEEND', 'PE', '-)', 'STADIUMEND', 'SUBROUTINEEND', 'PIPE', 'CYLINDEREND', 'DIAMOND_STOP', 'TAGEND', 'TRAPEND', 'INVTRAPEND', 'UNICODE_TEXT', 'TEXT', 'TAGSTART', got 'PS'

For more information, see https://docs.github.com/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams#creating-mermaid-diagrams

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the Mermaid diagram parse error by removing the problematic vision approaches syntax. The diagram should now render correctly (commit 0ebaa1f).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still says--

Unable to render rich display

Parse error on line 24:
...ddings
- GPT-4V (optional)]
-----------------------^
Expecting 'SQE', 'DOUBLECIRCLEEND', 'PE', '-)', 'STADIUMEND', 'SUBROUTINEEND', 'PIPE', 'CYLINDEREND', 'DIAMOND_STOP', 'TAGEND', 'TRAPEND', 'INVTRAPEND', 'UNICODE_TEXT', 'TEXT', 'TAGSTART', got 'PS'

For more information, see https://docs.github.com/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams#creating-mermaid-diagrams

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the Mermaid parse error by removing parentheses from the GPT-4V text. Changed "GPT-4V (optional)" to "GPT-4 Vision" to resolve the syntax issue (commit a7bd26d).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still error'ing

Parse error on line 27:
...Azure AI Vision
(optional)]
-----------------------^
Expecting 'SQE', 'DOUBLECIRCLEEND', 'PE', '-)', 'STADIUMEND', 'SUBROUTINEEND', 'PIPE', 'CYLINDEREND', 'DIAMOND_STOP', 'TAGEND', 'TRAPEND', 'INVTRAPEND', 'UNICODE_TEXT', 'TEXT', 'TAGSTART', got 'PS'

For more information, see https://docs.github.com/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams#creating-mermaid-diagrams

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Fix mermaid parse error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the Mermaid parse error by removing parentheses from the optional service labels. Changed "(optional)" to "optional" for Azure AI Vision, Azure Speech Services, and Azure Cosmos DB (commit 7e033d7).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the Mermaid parse error by removing dashes from node labels throughout the diagram. The issue was caused by the dash characters (-) within the node text, which Mermaid was interpreting as syntax elements rather than display text (commit 7e9761e).

@@ -0,0 +1,200 @@
# Application Architecture
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Application Architecture
# RAG Chat: Application Architecture

All documents use "RAG Chat" as prefix in title, I believe

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the title to "RAG Chat: Application Architecture" to match the pattern used in other documents (commit 0ebaa1f).


This document provides a detailed architectural overview of the Azure Search OpenAI demo application using Mermaid diagrams.

## Overview
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combine Overview with intro sentence, remove mention of Mermaid

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link back to README as well, for people who find this that want to get started with the repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combined the Overview with the intro sentence, removed mention of Mermaid, and added a link back to README as requested (commit 0ebaa1f).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added link back to README for people who find this document and want to get started with the repo (commit 0ebaa1f).

OpenAI[🤖 Azure OpenAI<br/>- GPT-4 Mini<br/>- Text Embeddings<br/>- GPT-4V (optional)]
Search[🔍 Azure AI Search<br/>- Vector Search<br/>- Semantic Ranking<br/>- Full-text Search]
DocIntel[📄 Azure Document<br/>Intelligence<br/>- Text Extraction<br/>- Layout Analysis]
Vision2[👁️ Azure Computer Vision<br/>(optional)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename "Azure Computer Vision" to "Azure AI Vision"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed "Azure Computer Vision" to "Azure AI Vision" in the diagram (commit 0ebaa1f).

- **Approach Patterns**: Different strategies for processing queries
- `ChatReadRetrieveRead`: Multi-turn conversation with retrieval
- `RetrieveThenRead`: Single-turn Q&A with retrieval
- `Vision Approaches`: Support for image-based documents
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "Vision Approaches" as they're going away soon

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed "Vision Approaches" from both the diagram and documentation as they're going away soon (commit 0ebaa1f).


### Backend (Python)

- **API Layer**: RESTful endpoints for chat, search, and configuration
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to HTTP protocol doc here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added link to the HTTP protocol documentation in the Backend section (commit 0ebaa1f).

- **Azure OpenAI**: Powers the conversational AI capabilities
- **Azure AI Search**: Provides semantic and vector search over documents
- **Azure Blob Storage**: Stores original documents and processed content
- **Azure Container Apps**: Hosts the application with automatic scaling
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove Container Apps from this list since its below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed Container Apps from the Azure Services Integration list since it's mentioned separately in the Deployment Options section (commit 0ebaa1f).


## Optional Features

The architecture supports several optional features that can be enabled:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to the guide about optional features

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added link to the optional features guide in the Optional Features section (commit 0ebaa1f).

The application can be deployed using:

- **Azure Container Apps** (default): Serverless container hosting
- **Azure App Service**: Traditional PaaS hosting option
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to doc about app service hosting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added link to the App Service hosting guide in the Deployment Options section (commit 0ebaa1f).

Copilot finished work on behalf of pamelafox July 29, 2025 23:44
@Copilot Copilot AI requested a review from pamelafox July 29, 2025 23:44
README.md Outdated
- [Sharing deployment environments](docs/sharing_environments.md)
- [Local development](docs/localdev.md)
- [Customizing the app](docs/customization.md)
- **[Architecture documentation with interactive diagrams](docs/architecture.md)**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't bold it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed bold formatting from the architecture link in the documentation list (commit a7bd26d).

@@ -0,0 +1,190 @@
# RAG Chat: Application Architecture

This document provides a detailed architectural overview of the Azure Search OpenAI demo application. The Azure Search OpenAI demo is a Retrieval Augmented Generation (RAG) application that creates a ChatGPT-like experience over your own documents. It combines Azure OpenAI Service for AI capabilities with Azure AI Search for document indexing and retrieval.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This document provides a detailed architectural overview of the Azure Search OpenAI demo application. The Azure Search OpenAI demo is a Retrieval Augmented Generation (RAG) application that creates a ChatGPT-like experience over your own documents. It combines Azure OpenAI Service for AI capabilities with Azure AI Search for document indexing and retrieval.
This document provides a detailed architectural overview of this application, a Retrieval Augmented Generation (RAG) application that creates a ChatGPT-like experience over your own documents. It combines Azure OpenAI Service for AI capabilities with Azure AI Search for document indexing and retrieval.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the intro text to be more concise and focused on "this application" (commit a7bd26d).


The following diagram illustrates the complete architecture including user interaction flow, application components, and Azure services:

```mermaid
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still says--

Unable to render rich display

Parse error on line 24:
...ddings
- GPT-4V (optional)]
-----------------------^
Expecting 'SQE', 'DOUBLECIRCLEEND', 'PE', '-)', 'STADIUMEND', 'SUBROUTINEEND', 'PIPE', 'CYLINDEREND', 'DIAMOND_STOP', 'TAGEND', 'TRAPEND', 'INVTRAPEND', 'UNICODE_TEXT', 'TEXT', 'TAGSTART', got 'PS'

For more information, see https://docs.github.com/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams#creating-mermaid-diagrams

@Copilot Copilot AI requested a review from pamelafox July 29, 2025 23:56
Copilot finished work on behalf of pamelafox July 29, 2025 23:56
@Copilot Copilot AI requested a review from pamelafox July 30, 2025 03:33
Copilot finished work on behalf of pamelafox July 30, 2025 03:33
Copilot finished work on behalf of pamelafox July 30, 2025 03:41
@pamelafox pamelafox marked this pull request as ready for review July 30, 2025 05:05
@pamelafox pamelafox merged commit b5b4090 into main Jul 30, 2025
5 checks passed
hasithb pushed a commit to hasithb/azure-search-openai-demo that referenced this pull request Oct 19, 2025
…entation (Azure-Samples#2653)

* Initial plan

* Add comprehensive Mermaid architecture diagrams and documentation

Co-authored-by: pamelafox <[email protected]>

* Move Architecture Overview link to list above HTTP Protocol

Co-authored-by: pamelafox <[email protected]>

* Address PR feedback: fix Mermaid syntax, update architecture docs

Co-authored-by: pamelafox <[email protected]>

* Fix formatting and Mermaid syntax issues per PR feedback

Co-authored-by: pamelafox <[email protected]>

* Update README.md

* Update docs/README.md

* Fix Mermaid parse error by removing parentheses from optional service labels

Co-authored-by: pamelafox <[email protected]>

* Fix Mermaid parse error by removing dashes from node labels

Co-authored-by: pamelafox <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: pamelafox <[email protected]>
Co-authored-by: Pamela Fox <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a the mermaid diagram for the architecture of this app

2 participants