Skip to content

Commit

Permalink
Make deploying the web searcher plugin optional (#517)
Browse files Browse the repository at this point in the history
### Motivation and Context

<!-- Thank you for your contribution to the chat-copilot repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
The Web Searcher plugin requires a Bing resource, which may require
elevated permission. This will fail the whole deployment, blocking
developers from deploying the latest CC.

Issues:
#498

### Description
This PR makes deploying the Web Searcher plugin optional. And by
default, it's NOT deployed.

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [Contribution
Guidelines](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
  • Loading branch information
TaoChenOSU committed Oct 17, 2023
1 parent a8cbe87 commit 10cfc04
Show file tree
Hide file tree
Showing 6 changed files with 280 additions and 474 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/copilot-deploy-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ jobs:
inlineScript: |
AI_SERVICE_KEY=$(az cognitiveservices account keys list --name ${{vars.AZUREOPENAI__NAME}} --resource-group ${{vars.AZUREOPENAI_DEPLOYMENT_GROUP_NAME}} | jq -r '.key1')
echo "::add-mask::$AI_SERVICE_KEY"
scripts/deploy/deploy-azure.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{steps.deployment-id.outputs.deployment_name}} --region ${{vars.CC_DEPLOYMENT_REGION}} --client-id ${{vars.BACKEND_CLIENT_ID}} --frontend-client-id ${{vars.APPLICATION_CLIENT_ID}} --tenant-id ${{secrets.AZURE_TENANT_ID}} --instance ${{vars.AZURE_INSTANCE}} --ai-service AzureOpenAI --ai-endpoint ${{secrets.AZURE_OPENAI_ENDPOINT}} --ai-service-key $AI_SERVICE_KEY --app-service-sku ${{vars.WEBAPP_API_SKU}} --no-deploy-package --debug-deployment
scripts/deploy/deploy-azure.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{steps.deployment-id.outputs.deployment_name}} --region ${{vars.CC_DEPLOYMENT_REGION}} --client-id ${{vars.BACKEND_CLIENT_ID}} --frontend-client-id ${{vars.APPLICATION_CLIENT_ID}} --tenant-id ${{secrets.AZURE_TENANT_ID}} --instance ${{vars.AZURE_INSTANCE}} --ai-service AzureOpenAI --ai-endpoint ${{secrets.AZURE_OPENAI_ENDPOINT}} --ai-service-key $AI_SERVICE_KEY --app-service-sku ${{vars.WEBAPP_API_SKU}} --no-deploy-package --debug-deployment --deploy-web-searcher-plugin
11 changes: 7 additions & 4 deletions scripts/deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,13 @@ chmod +x ./deploy-webapi.sh

# Deploy Hosted Plugins

> **_NOTE:_** This step can be skipped if the previous Azure Resources creation step succeeded without errors. The `deployWebSearcherPackage = true` setting in main.bicep ensures that the WebSearcher is deployed.
> **_NOTE:_** This step can be skipped if the required resources for the web searcher plugin are not deployed. The required resources include a Bing resource and an Azure Function. The required resources are NOT deployed by default. To deploy the required resources, use the `-DeployWebSearcherPlugin` or `--deploy-web-searcher-plugin` flag when running the **deploy-azure.ps1/deploy-azure.sh** script.
> **_NOTE:_** This step can be skipped if the previous Azure Resources creation step, including the resources required by the Web Search plugin, succeeded without errors. The `deployPackages = true` setting in main.bicep ensures that the WebSearcher is deployed.
> **_NOTE:_** More hosted plugins will be available.
To deploy the plugins, build the packages first and deploy then to the Azure resources created above.
To deploy the plugins, build the packages first and deploy them to the Azure resources created above.

## PowerShell

Expand All @@ -177,9 +180,9 @@ chmod +x ./deploy-plugins.sh

# (Optional) Deploy Memory Pipeline

> **_NOTE:_** This step can be skipped if the WebApi is not configured to run asynchronously for document processing. By default, the WebApi is configured to run asynchronously for document processing in deployment.
> **_NOTE:_** This step can be skipped if the WebApi is NOT configured to run asynchronously for document processing. By default, the WebApi is configured to run asynchronously for document processing in deployment.
> **_NOTE:_** This step can be skipped if the previous Azure Resources creation step succeeded without errors. The deployMemoryPipelinePackage = true setting in main.bicep ensures that the latest Chat Copilot memory pipeline is deployed.
> **_NOTE:_** This step can be skipped if the previous Azure Resources creation step succeeded without errors. The deployPackages = true setting in main.bicep ensures that the latest Chat Copilot memory pipeline is deployed.
To deploy the memorypipeline, build the deployment package first and deploy it to the Azure resources created above.

Expand Down
7 changes: 6 additions & 1 deletion scripts/deploy/deploy-azure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ param(
# Don't deploy Speech Services to enable speech as chat input
$NoSpeechServices,

[switch]
# Deploy the web searcher plugin
$DeployWebSearcherPlugin,

[switch]
# Switches on verbose template deployment output
$DebugDeployment,
Expand Down Expand Up @@ -118,7 +122,8 @@ $jsonConfig = "
`\`"deployNewAzureOpenAI`\`": { `\`"value`\`": $(If ($DeployAzureOpenAI) {"true"} Else {"false"}) },
`\`"memoryStore`\`": { `\`"value`\`": `\`"$MemoryStore`\`" },
`\`"deployCosmosDB`\`": { `\`"value`\`": $(If (!($NoCosmosDb)) {"true"} Else {"false"}) },
`\`"deploySpeechServices`\`": { `\`"value`\`": $(If (!($NoSpeechServices)) {"true"} Else {"false"}) }
`\`"deploySpeechServices`\`": { `\`"value`\`": $(If (!($NoSpeechServices)) {"true"} Else {"false"}) },
`\`"deployWebSearcherPlugin`\`": { `\`"value`\`": $(If ($DeployWebSearcherPlugin) {"true"} Else {"false"}) }
}
"

Expand Down
9 changes: 8 additions & 1 deletion scripts/deploy/deploy-azure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ usage() {
echo " \"AzureCognitiveSearch\" (default) and \"Qdrant\""
echo " -nc, --no-cosmos-db Don't deploy Cosmos DB for chat storage - Use volatile memory instead"
echo " -ns, --no-speech-services Don't deploy Speech Services to enable speech as chat input"
echo " -ws, --deploy-web-searcher-plugin Deploy the web searcher plugin"
echo " -dd, --debug-deployment Switches on verbose template deployment output"
echo " -ndp, --no-deploy-package Skips deploying binary packages to cloud when set."
}
Expand Down Expand Up @@ -105,6 +106,10 @@ while [[ $# -gt 0 ]]; do
NO_SPEECH_SERVICES=true
shift
;;
-ws | --deploy-web-searcher-plugin)
DEPLOY_WEB_SEARCHER_PLUGIN=true
shift
;;
-dd | --debug-deployment)
DEBUG_DEPLOYMENT=true
shift
Expand Down Expand Up @@ -182,6 +187,7 @@ az account set -s "$SUBSCRIPTION"
: "${MEMORY_STORE:="AzureCognitiveSearch"}"
: "${NO_COSMOS_DB:=false}"
: "${NO_SPEECH_SERVICES:=false}"
: "${DEPLOY_WEB_SEARCHER_PLUGIN:=false}"

# Create JSON config
JSON_CONFIG=$(
Expand All @@ -199,7 +205,8 @@ JSON_CONFIG=$(
"deployNewAzureOpenAI": { "value": $([ "$NO_NEW_AZURE_OPENAI" = true ] && echo "false" || echo "true") },
"memoryStore": { "value": "$MEMORY_STORE" },
"deployCosmosDB": { "value": $([ "$NO_COSMOS_DB" = true ] && echo "false" || echo "true") },
"deploySpeechServices": { "value": $([ "$NO_SPEECH_SERVICES" = true ] && echo "false" || echo "true") }
"deploySpeechServices": { "value": $([ "$NO_SPEECH_SERVICES" = true ] && echo "false" || echo "true") },
"deployWebSearcherPlugin": { "value": $([ "$DEPLOY_WEB_SEARCHER_PLUGIN" = true ] && echo "true" || echo "false") }
}
EOF
)
Expand Down
Loading

0 comments on commit 10cfc04

Please sign in to comment.