Skip to content

Commit

Permalink
Fix Azure ContainerApps deployment -a option
Browse files Browse the repository at this point in the history
  • Loading branch information
edeandrea committed Dec 30, 2023
1 parent 499cfd2 commit f4a6449
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 23 deletions.
12 changes: 2 additions & 10 deletions scripts/create-azure-openai-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"
19 changes: 6 additions & 13 deletions scripts/deploy-to-azure-containerapps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <resource_group_name> Name of the Azure resource group to use to deploy resources"
echo " Default: 'super-heroes'"
echo " -h Prints this help message"
Expand Down Expand Up @@ -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" \
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f4a6449

Please sign in to comment.