This sample creates a web-based app that allows workers at a company called Contoso Manufacturing to report issues via text or speech. Audio input is translated to text and then summarized to hightlight important information and specifiy the department the report should be sent to.
This project template provides the following features:
In order to deploy and run this example, you'll need:
gpt-35-turbo
You have a few options for setting up this project. The easiest way to get started is GitHub Codespaces, since it will setup all the tools for you, but you can also set it up locally.
You can run this template virtually by using GitHub Codespaces. The button will open a web-based VS Code instance in your browser:
Open a terminal window.
Sign in to your Azure account:
azd auth login
Provision the resources and deploy the code:
azd up
This project uses gpt-3.5-turbo which may not be available in all Azure regions. Check for up-to-date region availability and select a region during deployment accordingly.
Install the necessary Python packages:
cd src
pip install -r requirements.txt
Once the above steps are completed you can jump straight to exploring the sample.
A related option is VS Code Dev Containers, which will open the project in your local VS Code using the Dev Containers extension:
Start Docker Desktop (install it if not already installed)
Open the project:
In the VS Code window that opens, once the project files show up (this may take several minutes), open a terminal window.
Once you've completed these steps jump to deployment.
Create a new folder and switch to it in the terminal, then run this command to download the project code:
```shell
azd init -t summarization-openai-python-promptflow
```
Note that this command will initialize a git repository, so you do not need to clone this repository.
Once you've opened the project in Dev Containers, or locally, you can deploy it to Azure.
Sign in to your Azure account:
azd auth login
If you have any issues with that command, you may also want to try azd auth login --use-device-code
.
Provision the resources and deploy the code:
azd up
Install the necessary Python packages:
cd src
pip install -r requirements.txt
This project uses gpt-3.5-turbo which may not be available in all Azure regions. Check for up-to-date region availability and select a region during deployment accordingly.
This sample repository contains a summarize prompty file you can explore. In this sample we are telling the model to summarize the reports given by a worker in a specific format.
The prompty file contains the following:
If you ran the provisioning step above correctly, all of the variables should already be set for you. You can edit the prompt to see what changes this makes to the summary created.
This repository contains sample data to be able to test the project end to end. To run this project you'll need to pass in as input a reported issue to be summarized. You can pass this input as either a .wav
file or a string of text. The data/audio-data/
folder contains sample audio files for you to use or you can use the example string shown below. Below are the commands you can use in your terminal to run the project locally with promptflow.
Testing with sample audio data. Make sure you are in the src
directory:
pf flow test --flow summarizationapp --inputs problem="data/audio-data/issue0.wav"
Testing with sample text data:
pf flow test --flow summarizationapp --inputs problem="I need to open a problem report for part number ABC123. The brake rotor is overheating causing glazing on the pads. We track temperature above 24 degrees Celsius and we are seeing this after three to four laps during runs when the driver is braking late and aggressively into corners. The issue severity is to be prioritized as a 2. This is impacting the front brake assembly EFG234"
To understand how the code works look through the summarize.py
file.
Pricing may vary per region and usage. Exact costs cannot be estimated. You may try the Azure pricing calculator for the resources below:
This template uses Managed Identity for authenticating to the Azure services used (Azure OpenAI, Azure PostgreSQL Flexible Server).
Additionally, we have added a GitHub Action that scans the infrastructure-as-code files and generates a report containing any detected issues. To ensure continued best practices in your own repository, we recommend that anyone creating solutions based on our templates ensure that the Github secret scanning setting is enabled.
This project has adopted the Microsoft Open Source Code of Conduct.
Resources:
For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.