forked from langchain4j/langchain4j
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Azure CLI script to deploy the Azure AI Search resources (lang…
…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
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
langchain4j-azure-ai-search/src/test/script/deploy-azure-ai-search.sh
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,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 |