Skip to content

Commit

Permalink
Adding Azure CLI script to deploy the Azure AI Search resources (lang…
Browse files Browse the repository at this point in the history
…chain4j#1396)

Adding Azure CLI script to deploy the Azure AI Search resources needed
to pass the IT tests `AzureAiSearchEmbeddingStoreIT` and
`AzureAiSearchContentRetrieverIT`

cc @jdubois I've used part of your existing script #Thanks
  • Loading branch information
agoncal authored Jul 3, 2024
1 parent 038f24d commit 631bc78
Showing 1 changed file with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

# Execute this script to deploy the needed Azure AI Search resources to execute the integration tests.
# For this, you need Azure CLI installed: https://learn.microsoft.com/cli/azure/install-azure-cli

echo "Setting up environment variables..."
echo "----------------------------------"
PROJECT="langchain4j-ai-search"
RESOURCE_GROUP="rg-$PROJECT"
LOCATION="eastus"
AI_SEARCH_SERVICE="ai-$PROJECT"
TAG="$PROJECT"

echo "Creating the resource group..."
echo "------------------------------"
az group create \
--name "$RESOURCE_GROUP" \
--location "$LOCATION" \
--tags system="$TAG"

echo "Creating the AI Search Service..."
echo "---------------------------------"
az search service create \
--name "$AI_SEARCH_SERVICE" \
--resource-group "$RESOURCE_GROUP" \
--location "$LOCATION" \
--sku Standard \
--partition-count 1 \
--replica-count 1

echo "Storing the key and endpoint in environment variables..."
echo "--------------------------------------------------------"
AZURE_SEARCH_ENDPOINT="https://$AI_SEARCH_SERVICE.search.windows.net"
AZURE_SEARCH_KEY=$(
az search admin-key show \
--service-name "$AI_SEARCH_SERVICE" \
--resource-group "$RESOURCE_GROUP" \
| jq -r .primaryKey
)

echo "AZURE_SEARCH_ENDPOINT=$AZURE_SEARCH_ENDPOINT"
echo "AZURE_SEARCH_KEY=$AZURE_SEARCH_KEY"

# Once you finish the tests, you can delete the resource group with the following command:
echo "Deleting the resource group..."
echo "------------------------------"
az group delete \
--name "$RESOURCE_GROUP" \
--yes

0 comments on commit 631bc78

Please sign in to comment.