This sample is now being maintained in a new GitHub repository.
For the latest version please visit: https://github.com/AzureCosmosDB/cosmosdb-nosql-copilot
This sample application shows how to build a Generative-AI application using Azure Cosmos DB 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 NoSQL.
- 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 NoSQL vector search for improved performance and cost.
- Using the Semantic Kernel SDK for completion and embeddings generation.
- Azure Subscription
- 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.
- Azure Cosmos DB for NoSQL Vector Search Preview enrollment
This lab utilizes a preview feature, Vector search for Azure Cosmos DB for NoSQL which requires preview feature registration. Follow the below steps to register. You must be enrolled before you can deploy this solution:
- Navigate to your Azure Cosmos DB for NoSQL resource page.
- Select the "Features" pane under the "Settings" menu item.
- Select for “Vector Search in Azure Cosmos DB for NoSQL”.
- Read the description to confirm you want to enroll in the preview.
- Select "Enable" to enroll in the preview.
-
Log in to AZD.
azd auth login
[!NOTE]
This is only required once per install. -
Initialize the project in the current directory.
azd init --template cosmosdb-chatgpt
-
Deploy the services to Azure, build your container, and deploy the application.
azd up
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
To remove all the resources used by this sample, delete the resource group for your deployment.
To learn more about the services and features demonstrated in this sample, see the following: