Chat With Your Data
This sample showcases Chat With Your Data is a powerful Teams app template designed to facilitate dynamic interactions with various data sources through an intuitive conversational interface. Utilizing Azure OpenAI's language models and retrieval-augmented generation (RAG) technology, users can seamlessly connect to data stored in Azure AI Search, Azure Blob Storage, and more, allowing for insightful and context-rich exchanges that enhance decision-making and data accessibility within Microsoft Teams.
- The user can set up a datasource such as Azure AI Search, Azure Blob Storage, URL/web address, Azure Cosmos DB for MongoDB vCore, uploaded files, or Elasticsearch.
- The user can then interact with the data through the Teams app template.
Included Features
- Azure Open AI: Azure OpenAI On Your Data leverages OpenAI's language models, like GPT-3.5 and GPT-4, augmented with RAG to provide a conversational interface for interacting with your domain data using the chat completions API.
- Azure AI Search: Azure AI Search is utilized as a data source for Azure OpenAI's chat completions API.
- Azure Blob Storage: The uploaded files are stored in a container in Azure Blob Storage and indexed by Azure AI Search.
Interaction with the app
Set up and run the sample app in Github Codespaces
- Click Open in GitHub Codespaces badge above to create a codespace for the sample app. Wait for the codespace to be setup, it may take a couple of minutes.
- Using the Microsoft 365 Agents Toolkit extension, sign in to your Microsoft 365 account and Azure account under
ACCOUNTS
. - Set up your data source using Azure AI resources.
- Populate the environment files.
- Press Ctrl+Shift+D to open the
Run and Debug
menu. SelectDebug
and pressF5
or click on the play button. - Download the zip file
appPackage/build/appPackage.local.zip
and upload the app to Teams. - You can now run the sample app.
Set up and run the sample app locally
Prerequisites
- Python 3.11
- Node.js
- Rust
- Poetry
- Azure CLI
- Visual Studio Code
- Microsoft 365 Agents Toolkit Extension
- Python Extension
- Clone the repository
git clone https://github.com/t-mbindra/chat-with-your-data.git
- Open the project folder(Microsoft-Teams-Samples/samples/msteams-chat-with-your-data) in VS Code.
- Run
poetry install
- Run
poetry build
- Using the Microsoft 365 Agents Toolkit extension, sign in to your Microsoft 365 account and Azure account under
ACCOUNTS
. - Set up your data source using Azure AI resources.
- Populate the environment files.
- Press Ctrl+Shift+D to open the
Run and Debug
menu. PressF5
or click on the play button. - You can now run the sample.
Note
Check the status of all your local(Debug/F5 flow) bots on Microsoft Bot Framework. Check the status of all your Teams apps on Developer Portal. Microsoft 365 Agents Toolkit will also generate an app registration along with a password which can be seen under App Registrations on the Azure portal.
Set up your data source
- Run
sh deploy.sh
in the terminal. You can use Azure Cloud Shell (Bash) for a Windows device. You will be prompted to login to Azure and select a subscription. - Go to the Azure AI Studio, select relevant subscription and the resource
teamsazureopenai-cognitive
. - Proceed to the
Chat Playground
. Click onAdd a data source
under theAdd your data
tab. - Upload your data with
Upload files
orURL/ web address
. Ensure you have the correct subscription selected. Selectteamsazureopenai
as your storage resource andteamsazureopanai-search
as your search resource. Type the index name you want to use. - Add your data and select search type and chunk size. Select
API Key
as the authentication type. Save and Close and wait for the data to be ingested.
Populate the environment files
- You need to populate the environment variables in
env/.env.local.user
if you are using theDebug
orF5
flow. Else, populate the environment variables inenv/.env.dev.user
if you are deploying the app on Azure. - Go to the the Azure portal and navigate to the resource group
ChatWithYourData
. - To populate
SECRET_AZURE_OPENAI_KEY, SECRET_AZURE_OPENAI_ENDPOINT
variables:- Go to the
teamsazureopenai-cognitive
resource. Select theKeys and Endpoints
tab underResource Management
. UseKey 1
andEndpoint
.
- Go to the
- To populate
SECRET_AZURE_SEARCH_ENDPOINT
variable:- Go to the
teamsazureopenai-search
resource. Use theUrl
given.
- Go to the
- To populate
SECRET_AZURE_SEARCH_KEY
variable:- Go to the
teamsazureopenai-search
resource. Select theKeys
tab underSettings
. UsePrimary admin key
.
- Go to the
- Populate
AZURE_SEARCH_INDEX
based on the index name you chose while setting up the data source.
Upload the app to Teams
- Go to your Teams app and click on the
Apps
icon. SelectManage your apps
followed byUpload an app
. - Select
Upload a custom app
and open the relevant zip file. Click onAdd
when prompted.
If you do not have permission to upload custom apps (uploading), Microsoft 365 Agents 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.
Run the sample app
- The bot sends a welcome message.
- Chat with the bot.
- Clear the chat history.
Deploy/Host the app on Azure
Instead of the Debug
or F5
flow, you can deploy the app on Azure:
- Populate the environment files.
- Using the Microsoft 365 Agents Toolkit Extension tab, click on
Provision
followed byDEPLOY
underLIFECYCLE
. You will be asked to select the subscription and resource group for provisioning. - Download the zip file
appPackage/build/appPackage.dev.zip
and upload the app to Teams.
Note
Check the status of your dev(hosted on Azure) bots on Azure Portal by navigating to the relevant resource group. Check the status of all your Teams apps on Developer Portal. Microsoft 365 Agents Toolkit will also generate an app registration along with a password which can be seen under App Registrations on the Azure portal.