Skip to content

1openwindow/tbb-ai-bot-sample

Repository files navigation

Overview of the AI Chat Bot template

This template showcases a bot app that responds to user questions like an AI assistant. This enables your users to talk with the AI assistant in Teams to find information.

The app template is built using the Teams AI library, which provides the capabilities to build AI-based Teams applications.

Get started with the AI Chat Bot template

Prerequisites

To run the AI Chat Bot template in your local dev machine, you will need:

Note

Teams AI Library is currently in preview version.

  1. First, select the Teams Toolkit icon on the left in the VS Code toolbar.
  2. In file env/.env.testtool.user, fill in your OpenAI key SECRET_OPENAI_API_KEY=<your-key>.
  3. Press F5 to start debugging which launches your app in Teams App Test Tool using a web browser. Select Debug in Test Tool.
  4. You will receive a welcome message from the bot, or send any message to get a response.

Congratulations! You are running an application that can now interact with users in Teams App Test Tool:

ai chat bot

Use Azure OpenAI

Above steps use OpenAI as AI service, optionally, you can also use Azure OpenAI as AI service.

Prerequisites

  1. In file env/.env.local.user, fill in your Azure OpenAI key SECRET_AZURE_OPENAI_API_KEY=<your-key> and endpoint SECRET_AZURE_OPENAI_ENDPOINT=<your-endpoint>.
  2. In src/app.ts, comment out "Use OpenAI" part and uncomment "use Azure OpenAI" part, e.g.
    // Use OpenAI
    /**
    const planner = new OpenAIPlanner({
      apiKey: config.openAIKey,
      defaultModel: "gpt-3.5-turbo",
      useSystemMessage: true,
      logRequests: true
    });
    */
    // Uncomment the following lines to use Azure OpenAI
    const planner = new AzureOpenAIPlanner({
      apiKey: config.azureOpenAIKey,
      endpoint: config.azureOpenAIEndpoint,
      defaultModel: "gpt-35-turbo",
      useSystemMessage: true,
      logRequests: true,
    });
  3. In src/app.ts, update defaultModel to your own model deployment name.

What's included in the template

Folder Contents
.vscode VSCode files for debugging
appPackage Templates for the Teams application manifest
env Environment files
infra Templates for provisioning Azure resources
src The source code for the application

The following files can be customized and demonstrate an example implementation to get you started.

File Contents
src/index.ts Sets up and configures the AI Chat Bot.
src/app.ts Handles business logics for the AI Chat Bot.
src/config.ts Defines the environment variables.
src/prompts/chat/skprompt.txt Defines the prompt.
src/prompts/chat/config.json Configures the prompt.

The following are Teams Toolkit specific project files. You can visit a complete guide on Github to understand how Teams Toolkit works.

File Contents
teamsapp.yml This is the main Teams Toolkit project file. The project file defines two primary things: Properties and configuration Stage definitions.
teamsapp.local.yml This overrides teamsapp.yml with actions that enable local execution and debugging.
teamsapp.testtool.yml This overrides teamsapp.yml with actions that enable local execution and debugging in Teams App Test Tool.

Extend the AI Chat Bot template with more AI capabilities

You can follow Get started with Teams AI library to extend the AI Chat Bot template with more AI capabilities.

Additional information and references

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published