This sample application shows how to build a Generative-AI application using Azure Cosmos DB for MongoDB using its new vector search capabilities and Azure OpenAI Service and Semantic Kernel. The sample provides practical guidance on many concepts you will need to design and build these types of applications.
This application demonstrates the following concepts and how to implement them:
- The basics of building a highly scalable Generative-AI chat application using Azure Cosmos DB for MongoDB.
- Generating completions and embeddings using Azure OpenAI Service.
- Managing a context window (chat history) for natural conversational interactions with an LLM.
- Manage token consumption and payload sizes for Azure OpenAI Service requests.
- Building a semantic cache using Azure Cosmos DB for MonogDB vector index and the Semantic Kernel Connector for improved performance and cost.
- Using the Semantic Kernel SDK for vector search from Azure Cosmos DB for MongoDB as well as completion and embeddings generation.
- Azure subscription. Start free
- .NET 8 or above. Download
- Azure Developer CLI
- Subscription access to Azure OpenAI service. Start here to Request Access to Azure OpenAI Service
- Visual Studio, VS Code, GitHub Codespaces or another editor to edit or view the source for this sample.
-
Run the following command to download this project code:
azd init -t AzureCosmosDB/cosmosdb-mongo-copilot
-
Open a terminal and navigate to the /infra directory in this solution.
-
Log in to AZD.
azd auth login
-
Deploy the services to Azure, build your container, and deploy the application.
azd up
-
To load the data needed for this sample you will need navigate to the web app and click on the "Admin : Load Data" button. You can monitor the loading of the data through the application logs.
This solution has a number of quickstarts than you can run through to learn about the features in this sample and how to implement them yourself.
Please see Quickstarts
-
Open a terminal and navigate to the /infra directory in this solution.
-
Type azd down
azd down
To learn more about the services and features demonstrated in this sample, see the following: