page_type | description | products | languages | extensions | urlFragment | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
This sample demonstrates how to integrate Open AI into a Teams message extension to evaluate contract proposals against policy checklists. |
|
|
|
officedev-microsoft-teams-samples-msgext-ai-doc-compliance-checker-js |
Explore this sample application that integrates Azure Open AI into a Teams message extension, enabling users to evaluate contract proposals for compliance with specific policy guidelines stored in Azure Blob Storage.
The solution not only presents results as interactive adaptive cards but is also compatible with Microsoft 365 Copilot, offering seamless compliance checks in your workflow.
Please find below demo manifest which is deployed on Microsoft Azure and you can try it yourself by uploading the app package (.zip file link below) to your teams and/or as a personal app. (Sideloading must be enabled for your tenant, see steps here).
Compliance Checker sample app: Manifest
- Node.js 18.x
- Visual Studio Code
- Blob Storage
- Teams Toolkit
- You will need a Microsoft work or school account with permissions to upload custom Teams applications. The account will also need a Microsoft Copilot for Microsoft 365 license to use the extension in Copilot.
- Azure Open AI
- In Azure portal, create an Azure Open AI service.
- Deploy Azure Open AI model: Deploy the
gpt-35-turbo
model in your created Azure Open AI service for the application to perform translation. - Collect
AzureOpenAIEndpoint
,AzureOpenAIApiKey
,AzureOpenAIDeploymentId
values and save these values to update in.env
file later.
-
Create Azure Blob Storage: Refer to the Create Blob Storage documentation Blob Storage to create a blob storage in Azure.
-
Add the files to be checked for compliance: Upload the policy guideline document (keep the file-name handy for adding into the .localConfigs file) and also the proposal documents to compare against the guideline.
-
Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
-
Navigate to the
samples/msgext-ai-doc-compliance-checker
folder and open with Visual Studio Code. -
Navigate to the
samples/msgext-ai-doc-compliance-checker/.localConfigs
directory and update the values below.When running the sample using the toolkit, the BOT_ID and BOT_PASSWORD are automatically generated for you. You do not need to manually configure these credentials
BOT_ID={{Azure_Bot_Id}} BOT_PASSWORD={{Azure_Bot_Password}} END_POINT={{AzureOpenAIEndpoint}} API_KEY={{AzureOpenAIApiKey}} DEPLOYMENT_ID={{AzureOpenAIDeploymentId}} AZURE_STORAGE_CONNECTION_STRING={{Azure_Storage_Connection_String}} AZURE_CONTAINER_NAME={{Azure_Container_Name}} CHECKLIST_NAME={{The name of the Policy Guideline document uploaded in Azure Blob should include the file extension. Supported file formats are: .pdf , .docx, .txt}}
The simplest way to run this sample in Teams is to use Teams Toolkit for Visual Studio Code.
- Ensure you have downloaded and installed Visual Studio Code
- Install the Teams Toolkit extension
- Select File > Open Folder in VS Code and choose this samples directory from the repo
- Using the extension, sign in with your Microsoft 365 account where you have permissions to upload custom apps
- Select Debug > Start Debugging or F5 to run the app in a Teams web client.
- In the browser that launches, select the Add button to install the app to Teams.
If you do not have permission to upload custom apps (sideloading), Teams Toolkit will recommend creating and using a Microsoft 365 Developer Program account - a free program to get your own dev environment sandbox that includes Teams.
-
Search for the Compliance Checker app from the Messaging Extensions:
-
Search for the file name of the proposal document to compare against the policy document:
-
Compliance Assessment Result. The proposal document is checked against the guideline document and the results are shown in an adaptive card:
-
Click on the arrow to expand the card and get contextual reasoning for the complaince status being Yes or No:
-
Open Microsoft Teams, navigate to the Copilot section from the left-hand menu, look for the "Plug-ins" section on the right side of the screen, and use the search bar within the Plug-ins menu to search for "Compliance Checker":
-
Using Compliance Checker, evaluate Acme Suppliers Proposal for compliance
-
The Compliance Checker has evaluated the Acme Suppliers Proposal and here are the results:
-
Click on the arrow to expand the card and get contextual reasoning for the complaince status being Yes or No:
If you want to deploy the app to Azure, you can follow the below steps:
- Provision cloud resources
- Deploy Microsoft Teams app to the cloud using Microsoft Visual Studio Code