From f4a6449babc2899f778cd28bb466db1ec38b9d98 Mon Sep 17 00:00:00 2001 From: Eric Deandrea Date: Sat, 30 Dec 2023 14:12:21 -0500 Subject: [PATCH] Fix Azure ContainerApps deployment -a option --- scripts/create-azure-openai-resources.sh | 12 ++---------- scripts/deploy-to-azure-containerapps.sh | 19 ++++++------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/scripts/create-azure-openai-resources.sh b/scripts/create-azure-openai-resources.sh index 6f0c2bde3..c7a946f82 100755 --- a/scripts/create-azure-openai-resources.sh +++ b/scripts/create-azure-openai-resources.sh @@ -43,7 +43,7 @@ RESOURCE_GROUP="rg-super-heroes" LOCATION="eastus" TAG="super-heroes" MODEL="gpt-35-turbo" -MODEL_VERSION="0301" +MODEL_VERSION="0613" UNIQUE_IDENTIFIER=$(whoami) # Process the input options @@ -147,13 +147,6 @@ AZURE_OPENAI_KEY=$( | jq -r .key1 ) -AZURE_OPENAI_ENDPOINT=$( - az cognitiveservices account show \ - --name "$COGNITIVE_SERVICE" \ - --resource-group "$RESOURCE_GROUP" \ - | jq -r .properties.endpoint -) - echo echo "Deployment took $SECONDS seconds to complete." echo @@ -162,7 +155,6 @@ echo "[$(date +"%m/%d/%Y %T")]: All services have been deployed" echo "-----------------------------------------" echo "Here are some key values you may need to use in your application's configuration:" echo -echo "API key (quarkus.langchain4j.azure-openai.api-key: $AZURE_OPENAI_KEY" -echo "Endpoint: $AZURE_OPENAI_ENDPOINT" +echo "API key (quarkus.langchain4j.azure-openai.api-key): $AZURE_OPENAI_KEY" echo "Resource Name (quarkus.langchain4j.azure-openai.resource-name): $COGNITIVE_SERVICE" echo "Deployment Name/Id (quarkus.langchain4j.azure-openai.deployment-id): $COGNITIVE_DEPLOYMENT" diff --git a/scripts/deploy-to-azure-containerapps.sh b/scripts/deploy-to-azure-containerapps.sh index 43e0bf544..be61ebcf7 100755 --- a/scripts/deploy-to-azure-containerapps.sh +++ b/scripts/deploy-to-azure-containerapps.sh @@ -16,7 +16,7 @@ help() { echo "Syntax: deploy-to-azure-containerapps.sh [options]" echo "options:" echo " -a Create Azure OpenAI resources and bind to the narration service" - echo " By default this is not created and the narration service will server a default narration on all requests." + echo " By default this is not created and the narration service will serve a default narration on all requests." echo " -g Name of the Azure resource group to use to deploy resources" echo " Default: 'super-heroes'" echo " -h Prints this help message" @@ -316,16 +316,16 @@ create_narration_app() { az containerapp create \ --resource-group "$RESOURCE_GROUP" \ --tags system="$TAG_SYSTEM" application="$NARRATION_APP" \ - --image "$NARRATION_IMAGE" \ + --image "${NARRATION_IMAGE}-azure-openai" \ --name "$NARRATION_APP" \ --environment "$CONTAINERAPPS_ENVIRONMENT" \ --ingress external \ --target-port 8087 \ --min-replicas 1 \ - --env-vars NARRATION_AZURE_OPEN_AI_ENABLED=true \ - NARRATION_AZURE_OPEN_AI_KEY="$AZURE_OPENAI_KEY" \ - NARRATION_AZURE_OPEN_AI_ENDPOINT="$AZURE_OPENAI_ENDPOINT" \ - NARRATION_AZURE_OPEN_AI_DEPLOYMENT_NAME="$NARRATION_COGNITIVE_SERVICE_DEPLOYMENT_NAME" + --env-vars QUARKUS_PROFILE=azure-openai \ + QUARKUS_LANGCHAIN4J_AZURE_OPENAI_API_KEY="$AZURE_OPENAI_KEY" \ + QUARKUS_LANGCHAIN4J_AZURE_OPENAI_RESOURCE_NAME="$NARRATION_COGNITIVE_SERVICE" \ + QUARKUS_LANGCHAIN4J_AZURE_OPENAI_DEPLOYMENT_ID="$NARRATION_COGNITIVE_SERVICE_DEPLOYMENT_NAME" else az containerapp create \ --resource-group "$RESOURCE_GROUP" \ @@ -435,13 +435,6 @@ create_azure_openai_resources() { --resource-group "$RESOURCE_GROUP" \ | jq -r .key1 ) - - AZURE_OPENAI_ENDPOINT=$( - az cognitiveservices account show \ - --name "$NARRATION_COGNITIVE_SERVICE" \ - --resource-group "$RESOURCE_GROUP" \ - | jq -r .properties.endpoint - ) } # Define defaults