ChatGPT + Enterprise Data with Azure OpenAI and Azure AI Search (C#)
Features
The ChatGPT + Enterprise Data project is a C# sample application demonstrating how to create interactive, AI-driven experiences similar to ChatGPT using your own data. It leverages the Retrieval Augmented Generation pattern, deploying Microsoft Azure technologies such as Azure OpenAI and Azure AI Search to process and retrieve information.
Key features include:
- Voice Chat and Q&A interfaces: Allows users to interact via voice or text queries.
- Trustworthiness Evaluation: Provides options to validate responses with citations and content tracking.
- Data Preparation and Prompt Construction: Facilitates data prep and orchestration between model (ChatGPT) and retriever (Azure AI Search).
The application allows users to query a simulated enterprise (Contoso Electronics) about topics like benefits, internal policies, and job roles.
Application Architecture
The application's architecture comprises two main components:
- User Interface: Built using Blazor WebAssembly, it collects user queries and displays responses.
- Backend: Implemented using ASP.NET Core Minimal API. It acts as the service orchestrator, handling interactions among services like:
- Azure AI Search: Indexes and retrieves documents stored within Azure Storage.
- Azure OpenAI Service: Employs large language models to generate responses, using Semantic Kernel for sophisticated AI workflows.
Getting Started
Azure Account Requirements
To run the application, users need:
- An Azure Account. New users can sign up for a free account to receive introductory credits.
- Permissions for Azure account management, like creating resource groups and role assignments.
Cost Estimation
The cost of running the application can vary based on usage and region.
- Azure Container Apps: Charges for environment consumption.
- Azure OpenAI Service: Cost determined per 1,000 tokens processed.
- Azure AI Document Intelligence: Costs accrued per document page analyzed.
- Azure AI Search: Billed hourly with options for free or paid tiers.
- Azure Blob Storage and Monitor: Costs associated with data storage and monitoring, respectively.
For cost efficiency, users can switch to free SKUs within limitations.
Project Setup
Users can set up the project using multiple environments:
- GitHub Codespaces: Offers the simplest way to initiate the project.
- VS Code Remote Containers: Enables local project setup with VS Code using the Dev Containers extension.
- Local Environment: Requires tools like Azure Developer CLI, .NET 8, Git, PowerShell, and Docker.
Deployment
Deploying from Scratch
For new deployments:
- Ensure Docker is running.
- Use
azd up
to provision resources and deploy the app. Upon deployment, an endpoint URL will be available to test the app.
Utilizing Existing Resources
Users can configure the environment to use pre-existing Azure services by setting appropriate environment variables.
Enabling Optional Features
- Application Insights: Provides performance tracking and error logging.
- Authentication: Can be added to restrict access through Azure AD.
- Vision (Multi-modal) Support: Supports enhanced retrieval using both text and image sources.
Guidance and Resources
The project includes comprehensive documentation on advanced features like resource cleanup, running locally, and enabling additional functionalities to fine-tune the application performance and user experience.