Home

Awesome


page_type: sample languages:


Build a Copilot app using Azure Cosmos DB for NoSQL, Azure OpenAI Service, Azure App Service and Semantic Kernel

Open in GitHub Codespaces Open in Dev Containers

This sample application shows how to build a multi-tenant, multi-user, Generative-AI RAG Pattern application using Azure Cosmos DB for NoSQL with its new vector database capabilities with Azure OpenAI Service on Azure App Service. This sample shows both using Native SDKs as well as Semantic Kernel integration. The sample provides practical guidance on many concepts you will need to design and build these types of applications.

Important Security Notice

This template, the application code and configuration it contains, has been built to showcase Microsoft Azure specific services and tools. We strongly advise our customers not to make this code part of their production environments without implementing or enabling additional security features.

Features

This application demonstrates the following concepts and how to implement them:

Architecture Diagram

Architecture Diagram

User Experience

Cosmos Copilot app user interface

Getting Started

Prerequisites

GitHub Codespaces

You can run this template virtually by using GitHub Codespaces. The button will open a web-based VS Code instance in your browser:

  1. Open the template (this may take several minutes):

    Open in GitHub Codespaces

  2. Open a terminal window

  3. Continue with the deploying steps

Local Environment

If you're not using one of the above options for opening the project, then you'll need to:

  1. Make sure the following tools are installed:

  2. Download the project code:

    azd init -t cosmosdb-nosql-copilot
    
  3. If you're using Visual Studio, open the src/cosmos-copilot.sln solution file. If you're using VS Code, open the src folder.

  4. Continue with the deploying steps.

VS Code Dev Containers

A related option is VS Code Dev Containers, which will open the project in your local VS Code using the Dev Containers extension:

  1. Start Docker Desktop (install it if not already installed)

  2. Open the project:

    Open in Dev Containers

  3. In the VS Code window that opens, once the project files show up (this may take several minutes), open a terminal window.

  4. Continue with the deploying steps

Deployment

  1. Open a terminal and navigate to where you would like to clone this solution

  2. Run the following command to download the solution locally to your machine:

    azd init -t AzureCosmosDB/cosmosdb-nosql-copilot
    
  3. From the terminal, navigate to the /infra directory in this solution.

  4. Log in to AZD.

    azd auth login
    
  5. Provision the Azure services, build your local solution container, and deploy the application.

    azd up
    

Setting up local debugging

When you deploy this solution it automatically injects endpoints and configuration values into the secrets.json file used by .NET applications.

To modify values for the Quickstarts, locate the value of UserSecretsId in the csproj file in the /src folder of this sample and save the value.

<PropertyGroup>
  <UserSecretsId>your-guid-here</UserSecretsId>
</PropertyGroup>

Locate the secrets.json file and open with a text editor.

Quickstart

Follow the Quickstarts in this solution to go through the concepts for building RAG Pattern apps and the features in this sample and how to implement them yourself.

Please see Quickstarts

Clean up

  1. Open a terminal and navigate to the /infra directory in this solution.

  2. Type azd down

    azd down
    

Guidance

Region Availability

This template uses gpt-4o and text-embedding-3-large models which may not be available in all Azure regions. Check for up-to-date region availability and select a region during deployment accordingly

Costs

You can estimate the cost of this project's architecture with Azure's pricing calculator

As an example in US dollars, here's how the sample is currently built:

Average Monthly Cost:

Resources

To learn more about the services and features demonstrated in this sample, see the following: