-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update rag ai search template for dotnet (#12341)
* feat: add rag ai search template
- Loading branch information
Showing
41 changed files
with
1,976 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
templates/csharp/custom-copilot-rag-azure-ai-search/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# TeamsFx files | ||
build | ||
appPackage/build | ||
env/.env.*.user | ||
env/.env.local | ||
appsettings.Development.json | ||
appsettings.TestTool.json | ||
.deployment | ||
|
||
# User-specific files | ||
*.user | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
x64/ | ||
x86/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
[Ll]og/ | ||
|
||
# Notification local store | ||
.notification.localstore.json | ||
.notification.testtoolstore.json | ||
|
||
# devTools | ||
devTools/ |
116 changes: 116 additions & 0 deletions
116
templates/csharp/custom-copilot-rag-azure-ai-search/.{{NewProjectTypeName}}/README.md.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Overview of the Chat With Your Data (Custom Data Source) template | ||
|
||
This app template showcases how to build one of the most powerful applications enabled by LLM - sophisticated question-answering (Q&A) chat bots that can answer questions about specific source information right in the Microsoft Teams. | ||
This app template also demonstrates usage of techniques like: | ||
- [Retrieval Augmented Generation](https://python.langchain.com/docs/use_cases/question_answering/#what-is-rag), or RAG. | ||
- [Teams AI Library](https://learn.microsoft.com/microsoftteams/platform/bots/how-to/teams%20conversational%20ai/teams-conversation-ai-overview) | ||
|
||
## Get started with the template | ||
|
||
> **Prerequisites** | ||
> | ||
> To run the template in your local dev machine, you will need: | ||
> | ||
> - Prepare your own [Azure AI Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search). | ||
{{#useOpenAI}} | ||
> - Prepare an account with [OpenAI](https://platform.openai.com). | ||
{{/useOpenAI}} | ||
{{#useAzureOpenAI}} | ||
> - Prepare [Azure OpenAI](https://aka.ms/oai/access) resource | ||
{{/useAzureOpenAI}} | ||
|
||
## Create your Azure AI Search document index | ||
**Before running or debugging your bot, please follow these steps to create your document index in Auzre AI Search.** | ||
|
||
> This app template provides script `Indexer.ps1` to help create assistant. You can change the instructions and settings in the script to customize the document index. | ||
{{#useOpenAI}} | ||
1. Make sure your OpenAI and Azure AI search settings in `appsettings.TestTool.json`. | ||
``` | ||
"OpenAI": { | ||
"ApiKey": "<your-openai-api-key>", | ||
"EmbeddingModel": "<your-openai-embedding-model>" | ||
}, | ||
"Azure": { | ||
"AISearchApiKey": "<your-azure-ai-search-api-key>", | ||
"AISearchEndpoint": "<your-azure-ai-search-endpoint>" | ||
} | ||
``` | ||
{{/useOpenAI}} | ||
{{#useAzureOpenAI}} | ||
1. Make sure your Azure OpenAI and Azure AI search settings in `appsettings.TestTool.json`. | ||
``` | ||
"Azure": { | ||
"OpenAIApiKey": "<your-azure-openai-api-key>", | ||
"OpenAIEndpoint": "<your-azure-openai-endpoint>", | ||
"OpenAIDeploymentName": "<your-azure-openai-deployment-name>" | ||
"OpenAIEmbeddingDeploymentName": "<your-azure-openai-embedding-deployment-name>", | ||
"AISearchApiKey": "<your-azure-ai-search-api-key>", | ||
"AISearchEndpoint": "<your-azure-ai-search-endpoint>" | ||
} | ||
``` | ||
{{/useAzureOpenAI}} | ||
1. Open PowerShell, change the current working directory to this project root and run command `. ./Indexer.ps1 -run create`. | ||
``` | ||
> . ./Indexer.ps1 -run create | ||
``` | ||
1. Once you're done using the sample it's good practice to delete the index. You can do so with the `. ./Indexer.ps1 -run delete`. | ||
|
||
### Debug bot app in Teams Web Client | ||
1. Create your Azure AI Search document index as mentioned above. | ||
{{#useOpenAI}} | ||
1. Make sure your OpenAI and Azure AI search settings in `env/.env.local.user`. | ||
``` | ||
SECRET_OPENAI_API_KEY="<your-openai-api-key>" | ||
OPENAI_EMBEDDING_MODEL="<your-openai-embedding-model>" | ||
SECRET_AI_SEARCH_API_KEY="<your-azure-ai-search-api-key>" | ||
AI_SEARCH_ENDPOINT="<your-azure-ai-search-endpoint>" | ||
``` | ||
{{/useOpenAI}} | ||
{{#useAzureOpenAI}} | ||
1. Make sure your Azure OpenAI and Azure AI search settings in `env/.env.local.user`. | ||
``` | ||
SECRET_AZURE_OPENAI_API_KEY="<your-azure-openai-api-key>" | ||
AZURE_OPENAI_ENDPOINT="<your-azure-openai-endpoint>" | ||
AZURE_OPENAI_DEPLOYMENT_NAME="<your-azure-openai-deployment-name>" | ||
AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME="<your-azure-openai-embedding-deployment-name>" | ||
SECRET_AI_SEARCH_API_KEY="<your-azure-ai-search-api-key>" | ||
AI_SEARCH_ENDPOINT="<your-azure-ai-search-endpoint>" | ||
``` | ||
{{/useAzureOpenAI}} | ||
1. Create your Azure AI Search document index as mentioned above. | ||
1. In the debug dropdown menu, select Dev Tunnels > Create A Tunnel (set authentication type to Public) or select an existing public dev tunnel. | ||
1. Right-click your project and select Teams Toolkit > Prepare Teams App Dependencies. | ||
1. If prompted, sign in with a Microsoft 365 account for the Teams organization you want to install the app to | ||
1. Press F5, or select the Debug > Start Debugging menu in Visual Studio. | ||
1. In the launched browser, select the Add button to load the app in Teams. | ||
1. In the chat bar, type and send anything to your bot to trigger a response. | ||
|
||
> For local debugging using Teams Toolkit CLI, you need to do some extra steps described in [Set up your Teams Toolkit CLI for local debugging](https://aka.ms/teamsfx-cli-debugging). | ||
|
||
### Debug bot app in Teams App Test Tool | ||
1. Create your Azure AI Search document index as mentioned above. | ||
1. Select `Teams App Test Tool (browser)` in debug dropdown menu. | ||
1. Press F5, or select the Debug > Start Debugging menu in Visual Studio. | ||
1. In Teams App Test Tool from the launched browser, type and send anything to your bot to trigger a response. | ||
|
||
**Congratulations**! You are running an application that can now interact with users in Teams App Test Tool: | ||
|
||
![RAG Bot](https://github.com/OfficeDev/TeamsFx/assets/13211513/f56e7602-a5d3-436a-ae01-78546d61717d) | ||
|
||
## Extend the template | ||
|
||
- Follow [Build a Basic AI Chatbot in Teams](https://aka.ms/teamsfx-basic-ai-chatbot) to extend the template with more AI capabilities. | ||
- Understand more about [build your own data ingestion](https://aka.ms/teamsfx-rag-bot#build-your-own-data-ingestion). | ||
- Understand more about [Azure AI Search as data source](https://aka.ms/teamsfx-rag-bot#azure-ai-search-as-data-source). | ||
|
||
## Additional information and references | ||
|
||
- [Teams Toolkit Documentations](https://docs.microsoft.com/microsoftteams/platform/toolkit/teams-toolkit-fundamentals) | ||
- [Teams Toolkit CLI](https://aka.ms/teamsfx-toolkit-cli) | ||
- [Teams Toolkit Samples](https://github.com/OfficeDev/TeamsFx-Samples) | ||
|
||
## Report an issue | ||
|
||
Select Visual Studio > Help > Send Feedback > Report a Problem. | ||
Or, you can create an issue directly in our GitHub repository: | ||
https://github.com/OfficeDev/TeamsFx/issues. |
25 changes: 25 additions & 0 deletions
25
...csharp/custom-copilot-rag-azure-ai-search/.{{NewProjectTypeName}}/launchSettings.json.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"profiles": { | ||
{{#enableTestToolByDefault}} | ||
// Launch project within Teams App Test Tool | ||
"Teams App Test Tool (browser)": { | ||
"commandName": "Project", | ||
"launchTestTool": true, | ||
"launchUrl": "http://localhost:56150", | ||
}, | ||
{{/enableTestToolByDefault}} | ||
// Launch project within Teams | ||
"Microsoft Teams (browser)": { | ||
"commandName": "Project", | ||
"launchUrl": "https://teams.microsoft.com/l/app/${{TEAMS_APP_ID}}?installAppPackage=true&webjoin=true&appTenantId=${{TEAMS_APP_TENANT_ID}}&login_hint=${{TEAMSFX_M365_USER_NAME}}", | ||
}, | ||
{{^enableTestToolByDefault}} | ||
// Launch project within Teams App Test Tool | ||
"Teams App Test Tool (browser)": { | ||
"commandName": "Project", | ||
"launchTestTool": true, | ||
"launchUrl": "http://localhost:56150", | ||
}, | ||
{{/enableTestToolByDefault}} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...-azure-ai-search/.{{NewProjectTypeName}}/{{NewProjectTypeName}}.{{NewProjectTypeExt}}.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" Sdk="Microsoft.TeamsFx.Sdk"> | ||
<ItemGroup> | ||
<ProjectCapability Include="ProjectConfigurationsDeclaredDimensions" /> | ||
</ItemGroup> | ||
</Project> |
14 changes: 14 additions & 0 deletions
14
...e-ai-search/.{{NewProjectTypeName}}/{{NewProjectTypeName}}.{{NewProjectTypeExt}}.user.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
{{#enableTestToolByDefault}} | ||
<ActiveDebugProfile>Teams App Test Tool (browser)</ActiveDebugProfile> | ||
{{/enableTestToolByDefault}} | ||
{{^enableTestToolByDefault}} | ||
<ActiveDebugProfile>Microsoft Teams (browser)</ActiveDebugProfile> | ||
{{/enableTestToolByDefault}} | ||
</PropertyGroup> | ||
</Project> |
Oops, something went wrong.