How azure-samples/azure-search-openai-demo works
This is an Azure-backed RAG chat application: employees ask questions over indexed documents and receive generated answers with citations and reasoning details. The main path runs from the chat UI through the API and retrieval approach to Azure AI Search and Azure OpenAI, then renders the response. A separate ingestion path parses and chunks documents, creates embeddings, and indexes them; cloud ingestion can delegate processing to Azure Functions. The README also describes optional speech, multimodal processing, Entra authentication, persistent history, and monitoring. Some subsystem links are documented capabilities rather than inspected call paths.
Main entry points: cloudingestionstrategy.py Cloud ingestion strategy · approach.py Retrieval approach · Chat.tsx Chat UI · app.py HTTP API
Components 29
Chat experience
- Chat UI
app/frontend/src/pages/chat/Chat.tsx - Chat settings
app/frontend/src/components/Settings/Settings.tsx - Answer and citations
app/frontend/src/components/Answer/AnswerParser.tsx - Speech input/output
app/frontend/src/components/QuestionInput/SpeechInput.tsx - Reasoning display
app/frontend/src/components/AnalysisPanel/AnalysisPanel.tsx - Frontend API
app/frontend/src/api/api.ts
Chat backend
- HTTP API
app/backend/app.py - Retrieval approach
app/backend/approaches/approach.py - Prompt manager
app/backend/approaches/promptmanager.py - Azure AI Search
Document ingestion
- Ingestion setup
app/backend/setup_cloud_ingestion.py - Cloud ingestion strategy
app/backend/prepdocslib/cloudingestionstrategy.py - Local document preparation
app/backend/prepdocs.py - File listing and storage
app/backend/prepdocslib/listfilestrategy.py - Parsing and chunking
app/backend/prepdocslib/servicesetup.py - Text and image embeddings
app/backend/prepdocslib/embeddings.py - Search index manager
app/backend/prepdocslib/searchmanager.py - Blob storage
app/backend/prepdocslib/blobmanager.py - Document extractor
app/functions/document_extractor/function_app.py - Figure processor
app/functions/figure_processor/function_app.py - Text processor
app/functions/text_processor/function_app.py
Identity and history
- Authentication
app/backend/core/authentication.py - Chat history
app/backend/chat_history/cosmosdb.py - History providers
app/frontend/src/components/HistoryProviders/HistoryManager.ts
Other components
- Employee
- Azure OpenAI
- Azure AI Vision
- Azure Cosmos DB
- Application Insights
Connections 31
- Employee → Chat UI: asks questions
README.md - Chat UI → Frontend API: sends requests
app/frontend/src/pages/chat/Chat.tsx - Frontend API → HTTP API: calls API
- HTTP API → Retrieval approach: invokes
app/backend/app.py - Retrieval approach → Prompt manager: builds prompts
app/backend/approaches/approach.py - Retrieval approach → Azure AI Search: retrieves documents
- Retrieval approach → Azure OpenAI: generates answers
- Retrieval approach → Text and image embeddings: uses embeddings
app/backend/approaches/approach.py - HTTP API → Authentication: authenticates requests
app/backend/app.py - Chat UI → Chat settings: configures chat
app/frontend/src/pages/chat/Chat.tsx - HTTP API → Chat history: persists history
app/backend/app.py - Chat UI → History providers: manages history
app/frontend/src/pages/chat/Chat.tsx - History providers → Azure Cosmos DB: selects provider
- Retrieval approach → Answer and citations: returns response
- Answer and citations → Reasoning display: renders reasoning
app/frontend/src/components/Answer/AnswerParser.tsx - Chat UI → Speech input/output: accepts speech
- Ingestion setup → Cloud ingestion strategy: configures and runs
app/backend/setup_cloud_ingestion.py - Cloud ingestion strategy → Search index manager: configures indexing
app/backend/prepdocslib/cloudingestionstrategy.py - Cloud ingestion strategy → File listing and storage: uses file strategy
app/backend/prepdocslib/cloudingestionstrategy.py - Cloud ingestion strategy → Blob storage: uses storage
app/backend/prepdocslib/cloudingestionstrategy.py - Cloud ingestion strategy → Text and image embeddings: uses embeddings
app/backend/prepdocslib/cloudingestionstrategy.py - Local document preparation → Parsing and chunking: prepares documents
- Parsing and chunking → File listing and storage: reads files
- Parsing and chunking → Text and image embeddings: creates vectors
app/backend/prepdocslib/servicesetup.py - Cloud ingestion strategy → Document extractor: dispatches skill
- Cloud ingestion strategy → Figure processor: dispatches skill
- Cloud ingestion strategy → Text processor: dispatches skill
- Text processor → Text and image embeddings: creates vectors
app/functions/text_processor/function_app.py - Figure processor → Azure AI Vision: creates image vectors
- Search index manager → Azure AI Search: creates index
- HTTP API → Application Insights: traces activity