Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joshuakr/update ai search version #756

Merged
merged 3 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions azure_search/create_vector_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"analyzer": "$SEARCH_INDEX_ANALYZER",
"normalizer": null,
"dimensions": null,
"vectorSearchConfiguration": null,
"vectorSearchProfile": null,
"synonymMaps": []
},
{
Expand All @@ -38,7 +38,7 @@
"analyzer": null,
"normalizer": null,
"dimensions": null,
"vectorSearchConfiguration": null,
"vectorSearchProfile": null,
"synonymMaps": []
},
{
Expand All @@ -55,7 +55,7 @@
"analyzer": null,
"normalizer": null,
"dimensions": null,
"vectorSearchConfiguration": null,
"vectorSearchProfile": null,
"synonymMaps": []
},
{
Expand All @@ -72,7 +72,7 @@
"analyzer": null,
"normalizer": null,
"dimensions": null,
"vectorSearchConfiguration": null,
"vectorSearchProfile": null,
"synonymMaps": []
},
{
Expand All @@ -89,7 +89,7 @@
"analyzer": null,
"normalizer": null,
"dimensions": null,
"vectorSearchConfiguration": null,
"vectorSearchProfile": null,
"synonymMaps": []
},
{
Expand All @@ -106,7 +106,7 @@
"analyzer": null,
"normalizer": null,
"dimensions": null,
"vectorSearchConfiguration": null,
"vectorSearchProfile": null,
"synonymMaps": []
},
{
Expand All @@ -123,7 +123,7 @@
"analyzer": null,
"normalizer": null,
"dimensions": null,
"vectorSearchConfiguration": null,
"vectorSearchProfile": null,
"synonymMaps": []
},
{
Expand All @@ -140,7 +140,7 @@
"analyzer": null,
"normalizer": null,
"dimensions": null,
"vectorSearchConfiguration": null,
"vectorSearchProfile": null,
"synonymMaps": []
},
{
Expand All @@ -157,7 +157,7 @@
"analyzer": "$SEARCH_INDEX_ANALYZER",
"normalizer": null,
"dimensions": null,
"vectorSearchConfiguration": null,
"vectorSearchProfile": null,
"synonymMaps": []
},
{
Expand All @@ -174,7 +174,7 @@
"analyzer": "$SEARCH_INDEX_ANALYZER",
"normalizer": null,
"dimensions": null,
"vectorSearchConfiguration": null,
"vectorSearchProfile": null,
"synonymMaps": []
},
{
Expand All @@ -191,7 +191,7 @@
"analyzer": "$SEARCH_INDEX_ANALYZER",
"normalizer": null,
"dimensions": null,
"vectorSearchConfiguration": null,
"vectorSearchProfile": null,
"synonymMaps": []
},
{
Expand All @@ -208,7 +208,7 @@
"analyzer": "$SEARCH_INDEX_ANALYZER",
"normalizer": null,
"dimensions": null,
"vectorSearchConfiguration": null,
"vectorSearchProfile": null,
"synonymMaps": []
},
{
Expand All @@ -225,7 +225,7 @@
"analyzer": "$SEARCH_INDEX_ANALYZER",
"normalizer": null,
"dimensions": null,
"vectorSearchConfiguration": null,
"vectorSearchProfile": null,
"synonymMaps": []
},
{
Expand All @@ -234,7 +234,7 @@
"searchable": true,
"retrievable": true,
"dimensions": $EMBEDDING_VECTOR_SIZE,
"vectorSearchConfiguration": "vector-config"
"vectorSearchProfile": "vector-config-profile"
}
],
"suggesters": [],
Expand All @@ -245,7 +245,7 @@
"charFilters": [],
"tokenFilters": [],
"vectorSearch": {
"algorithmConfigurations": [
"algorithms": [
{
"name": "vector-config",
"kind": "hnsw",
Expand All @@ -256,6 +256,12 @@
"metric": "cosine"
}
}
],
"profiles": [
{
"name": "vector-config-profile",
"algorithm": "vector-config"
}
]
},
"tokenizers": [],
Expand Down
6 changes: 3 additions & 3 deletions scripts/deploy-search-indexes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export AZURE_SEARCH_ADMIN_KEY=$search_key
# Fetch existing index definition if it exists
index_vector_json=$(cat ${DIR}/../azure_search/create_vector_index.json | envsubst | tr -d "\n" | tr -d "\r")
index_vector_name=$(echo $index_vector_json | jq -r .name )
existing_index=$(curl -s --header "api-key: $AZURE_SEARCH_ADMIN_KEY" $search_url/indexes/$index_vector_name?api-version=2023-07-01-Preview)
existing_index=$(curl -s --header "api-key: $AZURE_SEARCH_ADMIN_KEY" $search_url/indexes/$index_vector_name?api-version=2024-05-01-preview)

if [[ "$existing_index" != *"No index with the name"* ]]; then
existing_dimensions=$(echo "$existing_index" | jq -r '.fields | map(select(.name == "contentVector")) | .[0].dimensions')
Expand All @@ -46,15 +46,15 @@ if [[ "$existing_index" != *"No index with the name"* ]]; then
exit 0
else
echo "Deleting the existing index $existing_index_name..."
curl -X DELETE --header "api-key: $AZURE_SEARCH_ADMIN_KEY" $search_url/indexes/$existing_index_name?api-version=2023-07-01-Preview
curl -X DELETE --header "api-key: $AZURE_SEARCH_ADMIN_KEY" $search_url/indexes/$existing_index_name?api-version=2024-05-01-preview
echo "Index $index_vector_name deleted."
fi
fi
fi

# Create vector index
echo "Creating index $index_vector_name ..."
curl -s -X PUT --header "Content-Type: application/json" --header "api-key: $AZURE_SEARCH_ADMIN_KEY" --data "$index_vector_json" $search_url/indexes/$index_vector_name?api-version=2023-07-01-Preview
curl -s -X PUT --header "Content-Type: application/json" --header "api-key: $AZURE_SEARCH_ADMIN_KEY" --data "$index_vector_json" $search_url/indexes/$index_vector_name?api-version=2024-05-01-preview

echo -e "\n"
echo "Successfully deployed $index_vector_name."
Loading