This is a conversational bot for Microsoft Teams that thinks it's a Chef to help you cook apps using the Teams AI Library. The bot uses the gpt-3.5-turbo
model to chat with Teams users and respond in a polite and respectful manner, staying within the scope of the conversation.
This sample illustrates how to use Retrieval Augmented Generation (RAG) to easily inject contextual relevant information into the prompt sent to the model. This results in better and more accurate replies from the bot.
The sample uses a local Vector Database, called Vectra, and Semantic Search to find the most relevant information to include in the prompt for the users input. The index can be found in ./index/teams-ai
and includes all of the projects Getting Started docs and the source code for the Teams AI Library. This means you can ask the Teams Chef Bot anything about the library and it can answer it. You can even ask it to write sample code for you!
-
Clone the repository
git clone https://github.com/Microsoft/teams-ai.git
-
In the root JavaScript folder, install and build all dependencies
cd teams-ai/js yarn install yarn build
-
In a terminal, navigate to the sample root.
cd teams-ai/js/samples/04.ai.a.teamsChefBot/
-
Duplicate the
sample.env
in this folder. Rename the file to.env
. -
Add your bot's credentials and any other related credentials to that file. If you are using OpenAI then only keep the
OPENAI_KEY
and add in your key. Otherwise if you are using AzureOpenAI then only keep theAZURE_OPENAI_KEY
,AZURE_OPENAI_ENDPOINT
variables and fill them in appropriately.
Please note: If you are use Azure OpenAI, you will need both a GPT model and embedding model deployment to get this sample working. See
OpenAIModel
inindex.ts
andOpenAIEmbeddings
inVectraDataSource.ts
. If these are using different endpoints and/or keys, be sure to update your.env
file and Teams Toolkit files (if applicable) accordingly.
- Update
config.json
andindex.ts
with your model deployment name.
The easiest and fastest way to get up and running is with Teams Toolkit as your development guide. To use Teams Toolkit to automate setup and debugging, please continue below.
Otherwise, if you only want to run the bot locally and build manually, please jump to the BotFramework Emulator section. For different ways to test a sample see: Multiple ways to test
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 sample's directory from the repo
- Using the extension, sign in with your Microsoft 365 account where you have permissions to upload custom apps
- Ensure that you have set up the sample from the previous step.
- 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.