-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix custom connection provision, update location var in provision scr…
…ipt, add deployment.sh, update docker image (#71) * update deployment sku * add support and chat endpoint to env and checks in notebook * move chat questions up to the top * add ai sdk eval notebook for contoso-chat * add df as input * Add deployment of pf to provision.sh * update provision script to westus2 and gpt4t * remove gpt4turbo * updating gpt4 to 35 for testing * revert changes * fix gpt * remove github env var * add register model as promptflow * update region * change deployment name * update deployment logic in provision script * update endpoint name * change to dynamic naming * change names to random numbers * update chat env to dockerfile * revert chat deployment file * split out deployment script * move deployment script * remove unused txt file * add bicep changes for testing * fix bicep to include metadata for connection
- Loading branch information
1 parent
314cedc
commit cc2e808
Showing
6 changed files
with
56 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineEndpoint.schema.json | ||
name: contoso-chat-store | ||
auth_mode: key |
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,43 @@ | ||
# get config.json | ||
echo "Writing config.json file for PromptFlow usage..." | ||
subscriptionId=$(az account show --query id -o tsv) | ||
resourceGroupName=$(az group show --name $resourceGroupName --query name -o tsv) | ||
mlProjectName=$(az deployment group show --name contchat --resource-group $resourceGroupName --query properties.outputs.mlproject_name.value -o tsv) | ||
|
||
# create a random hash for the endpoint name all lowercase letters | ||
endpointName="contoso-chat-$RANDOM" | ||
# create a random hash for the deployment name | ||
deploymentName="contoso-chat-$RANDOM" | ||
|
||
echo "{\"subscription_id\": \"$subscriptionId\", \"resource_group\": \"$resourceGroupName\", \"workspace_name\": \"$mlProjectName\"}" > config.json | ||
$(cat principal.txt) --secret-permissions get list | ||
|
||
# register promptflow as model | ||
echo "Registering PromptFlow as a model in Azure ML..." | ||
az extension add -n ml -y | ||
az ml model create --file deployment/chat-model.yaml -g $resourceGroupName -w $mlProjectName | ||
|
||
# Deploy prompt flow | ||
echo "Deploying PromptFlow to Azure ML..." | ||
az ml online-endpoint create --file deployment/chat-endpoint.yaml -n $endpointName -g $resourceGroupName -w $mlProjectName | ||
|
||
# Setup deployment | ||
echo "Setting up deployment..." | ||
az ml online-deployment create --file deployment/chat-deployment.yaml --name $deploymentName --endpoint-name $endpointName --all-traffic -g $resourceGroupName -w $mlProjectName | ||
az ml online-endpoint show -n $endpointName -g $resourceGroupName -w $mlProjectName | ||
az ml online-deployment get-logs --name $deploymentName --endpoint-name $endpointName -g $resourceGroupName -w $mlProjectName | ||
|
||
# Read endpoint principal | ||
echo "Reading endpoint principal..." | ||
az ml online-endpoint show -n $endpointName -g $resourceGroupName -w $mlProjectName > endpoint.json | ||
jq -r '.identity.principal_id' endpoint.json > principal.txt | ||
echo "Principal is: $(cat principal.txt)" | ||
|
||
#Assign Permission to Endpoint Principal | ||
echo "Assigning permissions to Principal..." | ||
az role assignment create --assignee $(cat principal.txt) --role "AzureML Data Scientist" --scope "/subscriptions/$subscription_id/resourcegroups/$resourceGroupName/providers/Microsoft.MachineLearningServices/workspaces/$mlProjectName" | ||
az role assignment create --assignee $(cat principal.txt) --role "Azure Machine Learning Workspace Connection Secrets Reader" --scope "/subscriptions/$subscription_id/resourcegroups/$resourceGroupName/providers/Microsoft.MachineLearningServices/workspaces/$mlProjectName/onlineEndpoints/$endpointName" | ||
# Get keyValueName from Azure ML | ||
keyValueName=$(az ml online-endpoint show -n $endpointName -g $resourceGroupName -w $mlProjectName --query "identity.principal_id" -o tsv) | ||
echo "assigning permissions to Principal to Key vault.." | ||
az keyvault set-policy --name $keyValueName --resource-group $resourceGroupName --object-id |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM mcr.microsoft.com/azureml/promptflow/promptflow-runtime:latest | ||
FROM mcr.microsoft.com/azureml/promptflow/promptflow-runtime-stable:latest | ||
COPY requirements.txt requirements.txt | ||
RUN python -m pip install --upgrade pip | ||
RUN pip install -r requirements.txt |
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