name | description | languages | products | page_type | urlFragment | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Contoso Retail copilot with Azure AI |
Build, evaluate and deploy a RAG-based retail copilot with promptflow on Azure AI |
|
|
sample |
contoso-chat |
In this sample we build, evaluate and deploy a support chat agent for Contoso Outdoors, a fictitious retailer who sells hiking and camping equipment. The implementation uses a Retrieval Augmented Generation approach to answer customer queries with responses grounded in the company's product catalog and customer purchase history.
This sample uses the Azure AI Search service to store product indexes, and the Azure Cosmos DB service to store customer history data. It uses the Azure OpenAI service to vectorize the user query (with text-embeddings-ada-002
), conduct AI-assisted evaluation (with gpt-4
) and generate the chat response (with gpt-35-turbo
).
The Contoso Chat application teaches you how to:
- Build a retail copilot application using the RAG pattern.
- Ideate & iterate on application using the Promptflow framework.
- Build & manage the solution using the Azure AI platform & tools.
- Provision & deploy the solution using the Azure Developer CLI.
- Support Responsible AI practices with evaluation & content safety.
Once deployed, you can integrate the chat AI (backend) with a chat UI (frontend) as shown, to deliver the retail copilot experience. To get more details on the applications scenario, architecture, codebase, and developer workflow, check out the documentation section of this repo.
The project comes with:
- Sample promptflow assets for a RAG-based copilot application
- Sample model configurations for a RAG-based copilot application
- Sample evaluation prompts for a RAG-based copilot application
- Sample product and customer data for retail application scenario
- Sample application code for copilot chat and evaluation functions
- Sample azd-template configuration for managing application on Azure
The sample is also a signature application for demonstrating new the capabilities of the Azure AI platform. Expect regular updates to showcase cutting-edge features and best practices for generative AI development. Planned updates include support for:
- New flexflow implementation (instead of existing
flow.dag.yaml
) - New prompty assets (to simplify prompt creation & iteration)
- New
azd
ai.endpoint host type (to configure AI deployments in Azure)
🚧 Embed DevDiv designed architecture diagram here
🚧 Embed Advocacy generated video here
- Azure Subscription - Signup for a free account.
- Visual Studio Code - Download it for free.
- GitHub Account - Signup for a free account.
- Access to Azure Open AI Services - Learn about getting access.
- Ability to provision Azure AI Search (Paid) - Required for Semantic Ranker
- Ability to deploy these models -
gpt-35-turbo
,gpt-4
,text-embeddings-ada-002
Note that the Azure AI Search and Azure Open AI services are paid services that may also have regional availability and quota constraints. Check the Azure documentation for more details.
The repository is configured with a devcontainer.json
that has the required dependencies pre-installed. Use the following commands to verify the install:
azd version
- Verify Azure Developer CLI is v1.8.2+pf version
- Verify Promptflow is v1.9.0+az version
- Verify Azure CLI is v2.60+.python3 --version
- Verify Python is v3.11+
Local development is done using a Python environment (runtime) with the Promptflow extension on VS Code (IDE). No other installs are needed in the pre-built environment. For other options, check the documentation.
The quickest way to get started is to use the pre-built dev environment by following these steps:
- Fork this repo, then launch it in GitHub Codespaces
- Run
azd auth login
in the VS Code terminal to authenticate with Azure. - Run
azd up
to deploy the application to Azure and wait for completion. - Launch browser and navigate to
https://ai.azure.com/build
. - Look for the recently-created project and explore it!
This process illustrates the ease of provisioning and deploying the completed application to Azure with a single commandline tool. To understand how to build the application from scratch, follow the steps described in the documentation section of this repo.
The core functionality of the copilot application is developed using the Promptflow framework with Python. In this project, we use the Promptflow extension in Visual Studio Code, with its pf
commandline tool, for all our local development needs. More details can be found in the documentation section of this repo.
You can estimate the cost of this project's architecture with Azure's pricing calculator
- Azure OpenAI - Standard tier, GPT-4, GPT-35-turbo and Ada models. See Pricing
- Azure AI Search - Basic tier, Semantic Ranker enabled See Pricing
- Azure Cosmos DB for NoSQL - Serverless, Free Tier See Pricing
We recommend using keyless authentication for this project. Read more about why you should use managed identities on our blog.
- Azure AI Studio Documentation
- Promptflow Documentation
- Prompty Assets
- Flex Flow
- [Link to similar sample] 🚧
Have questions or issues to report? Please open a new issue after first verifying that the same question or issue has not already been reported. In the latter case, please add any additional comments you may have, to the existing issue.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.