Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qinezh/assistantbot
https://github.com/qinezh/assistantbot
Last synced: 12 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/qinezh/assistantbot
- Owner: qinezh
- Created: 2023-12-05T08:58:36.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-08T07:26:02.000Z (about 1 year ago)
- Last Synced: 2024-04-14T23:03:43.599Z (9 months ago)
- Language: TypeScript
- Size: 3.79 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Overview of the AI Assistant Bot template
This app template is built on top of [Teams AI library](https://aka.ms/teams-ai-library) and [OpenAI Assistants API](https://platform.openai.com/docs/assistants/overview).
It showcases how to build an intelligent chat bot in Teams capable of helping users accomplish a specific task using natural language right in the Teams conversations, such as solving a math problem.- [Overview of the AI Assistant Bot template](#overview-of-the-ai-assistant-bot-template)
- [Get started with the AI Assistant Bot template](#get-started-with-the-ai-assistant-bot-template)
- [What's included in the template](#whats-included-in-the-template)
- [Extend the AI Assistant Bot template with more AI capabilities](#extend-the-ai-assistant-bot-template-with-more-ai-capabilities)
- [Additional information and references](#additional-information-and-references)## Get started with the AI Assistant Bot template
> **Prerequisites**
>
> To run the AI Assistant Bot template in your local dev machine, you will need:
>
> - [Node.js](https://nodejs.org/), supported versions: 16, 18
> - A [Microsoft 365 account for development](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts)
> - [Teams Toolkit Visual Studio Code Extension](https://aka.ms/teams-toolkit) version 5.0.0 and higher or [Teams Toolkit CLI](https://aka.ms/teamsfx-cli)
> - An account with [OpenAI](https://platform.openai.com/).
>
> **Note**
>
> Teams AI Library is currently in preview version.### Create your own OpenAI Assistant
Before running or debugging your bot, please follow these steps to setup your own [OpenAI Assistant](https://platform.openai.com/docs/assistants/overview).
**If you haven't setup any Assistant yet**
> This app template provides script `src/creator.ts` to help create assistant. You can change the instructions and settings in the script to customize the assistant.
>
> After creation, you can change and manage your assistants on [OpenAI](https://platform.openai.com/assistants).1. Open terminal and run command `npm install` to install all dependency packages
```
> npm install
```
1. After `npm install` completed, run command `npm run assistant:create -- `
```
> npm run assistant:create -- xxxxxx
```
1. The above command will output something like "*Created a new assistant with an ID of: **asst_xxx...***"
1. Fill in both OpenAI API Key and the created Assistant ID into `env/.env.*.user`
```
SECRET_OPENAI_API_KEY=
SECRET_OPENAI_ASSISTANT_ID=
```**If you already have an Assistant created**
1. Fill in both OpenAI API Key and the created Assistant ID into `env/.env.*.user`
```
SECRET_OPENAI_API_KEY=
SECRET_OPENAI_ASSISTANT_ID=
```### Run Teams Bot locally
1. First, select the Teams Toolkit icon on the left in the VS Code toolbar.
1. In the Account section, sign in with your [Microsoft 365 account](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts) if you haven't already.
1. Press F5 to start debugging which launches your app in Teams using a web browser. Select `Debug (Edge)` or `Debug (Chrome)`.
1. When Teams launches in the browser, select the Add button in the dialog to install your app to Teams.
1. 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:
![ai assistant bot in Teams](https://github.com/OfficeDev/TeamsFx/assets/7642967/21480d90-307d-4074-84e0-c68a20e38134)
## 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/creator.ts`| One-time tool to create OpenAI Assistant.|The following are Teams Toolkit specific project files. You can [visit a complete guide on Github](https://github.com/OfficeDev/TeamsFx/wiki/Teams-Toolkit-Visual-Studio-Code-v5-Guide#overview) 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.|## Extend the AI Assistant Bot template with more AI capabilities
You can follow [Get started with Teams AI library](https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/teams%20conversational%20ai/how-conversation-ai-get-started) to extend the AI Assistant Bot template with more AI capabilities.
## Additional information and references
- [Teams AI library](https://aka.ms/teams-ai-library)
- [Teams Toolkit Documentations](https://docs.microsoft.com/microsoftteams/platform/toolkit/teams-toolkit-fundamentals)
- [Teams Toolkit CLI](https://docs.microsoft.com/microsoftteams/platform/toolkit/teamsfx-cli)
- [Teams Toolkit Samples](https://github.com/OfficeDev/TeamsFx-Samples)
- [OpenAI Assistants API](https://platform.openai.com/docs/assistants/overview)