Skip to content

This sample has the full End2End process of creating RAG application with Prompt Flow and AI Studio. It includes GPT 3.5 Turbo LLM application code, evaluations, deployment automation with AZD CLI, GitHub actions for evaluation and deployment and intent mapping for multiple LLM task mapping.

License

octodemo/contoso-chat

 
 

Repository files navigation

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
python
bicep
azdeveloper
azure-openai
azure-cognitive-search
azure
azure-cosmos-db
sample
contoso-chat

Contoso Retail copilot with Azure AI

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.

Contoso Retail copilot with Azure AI

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.

Image shows a retailer website with backpacks - and a chat session with a customer

Features

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)

Architecture Diagram

🚧 Embed DevDiv designed architecture diagram here

Demo Video (optional)

🚧 Embed Advocacy generated video here

Getting Started

Pre-Requisites

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.

Installation

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.

Quickstart

The quickest way to get started is to use the pre-built dev environment by following these steps:

  1. Fork this repo, then launch it in GitHub Codespaces
  2. Run azd auth login in the VS Code terminal to authenticate with Azure.
  3. Run azd up to deploy the application to Azure and wait for completion.
  4. Launch browser and navigate to https://ai.azure.com/build.
  5. 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.

Local Development

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.

Costs

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

Security Guidelines

We recommend using keyless authentication for this project. Read more about why you should use managed identities on our blog.

Resources


Troubleshooting

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.

Contributing

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.

Trademarks

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.

About

This sample has the full End2End process of creating RAG application with Prompt Flow and AI Studio. It includes GPT 3.5 Turbo LLM application code, evaluations, deployment automation with AZD CLI, GitHub actions for evaluation and deployment and intent mapping for multiple LLM task mapping.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Bicep 76.3%
  • Jupyter Notebook 15.5%
  • Python 4.1%
  • Shell 3.5%
  • Dockerfile 0.6%