Compare commits

...
2 Commits
Author SHA1 Message Date
Andrew Ferlitsch 3a4d7b0132 vpc 2023-10-06 17:20:50 +00:00
Andrew Ferlitsch 620bdb3b69 fix: clean and rebrand 2023-10-05 20:18:24 +00:00
@@ -24,13 +24,12 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "JAPoU8Sm5E6e"
},
"source": [
"# Create Vertex AI Matching Engine index\n",
"# Create Vertex AI Vector Search index\n",
"![ ](https://www.google-analytics.com/collect?v=2&tid=G-L6X3ECH596&cid=1&en=page_view&sid=1&dt=sdk_matching_engine_for_indexing.ipynb&dl=notebooks%2Fofficial%2Fmatching_engine%2Fsdk_matching_engine_for_indexing.ipynb)\n",
"<table align=\"left\">\n",
" <td>\n",
@@ -63,7 +62,7 @@
"\n",
"This example demonstrates how to use the Vertex AI ANN Service. It is a high scale, low latency solution, to find similar vectors (or more specifically \"embeddings\") for a large corpus. Moreover, it is a fully managed offering, further reducing operational overhead. It is built upon [Approximate Nearest Neighbor (ANN) technology](https://ai.googleblog.com/2020/07/announcing-scann-efficient-vector.html) developed by Google Research.\n",
"\n",
"Learn more about [Vertex AI Matching Engine](https://cloud.google.com/vertex-ai/docs/matching-engine/overview)."
"Learn more about [Vertex AI Vector Search](https://cloud.google.com/vertex-ai/docs/matching-engine/overview)."
]
},
{
@@ -78,7 +77,7 @@
"\n",
"This tutorial uses the following Google Cloud ML services:\n",
"\n",
"- `Vertex AI Matching Engine`\n",
"- `Vertex AI Vector Search`\n",
"\n",
"The steps performed include:\n",
"\n",
@@ -123,7 +122,7 @@
"source": [
"# Install the packages\n",
"! pip3 install --upgrade google-cloud-aiplatform \\\n",
" google-cloud-storage"
" google-cloud-storage"
]
},
{
@@ -293,7 +292,7 @@
},
"outputs": [],
"source": [
"VPC_NETWORK = \"[your-vpc-network-name]\" # @param {type:\"string\"}\n",
"VPC_NETWORK = \"default\" # @param {type:\"string\"}\n",
"\n",
"PEERING_RANGE_NAME = \"ann-haystack-range\""
]
@@ -427,7 +426,7 @@
},
"outputs": [],
"source": [
"BUCKET_URI = \"gs://your-bucket-name-unique\" # @param {type:\"string\"}"
"BUCKET_URI = f\"gs://your-bucket-name-{PROJECT_ID}-unique\" # @param {type:\"string\"}"
]
},
{
@@ -447,7 +446,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION -p $PROJECT_ID $BUCKET_URI"
"! gsutil mb -l {REGION} -p {PROJECT_ID} {BUCKET_URI}"
]
},
{
@@ -667,7 +666,7 @@
"outputs": [],
"source": [
"INDEX_RESOURCE_NAME = tree_ah_index.resource_name\n",
"INDEX_RESOURCE_NAME"
"print(INDEX_RESOURCE_NAME)"
]
},
{
@@ -730,7 +729,7 @@
"outputs": [],
"source": [
"INDEX_BRUTE_FORCE_RESOURCE_NAME = brute_force_index.resource_name\n",
"INDEX_BRUTE_FORCE_RESOURCE_NAME"
"print(INDEX_BRUTE_FORCE_RESOURCE_NAME)"
]
},
{
@@ -846,7 +845,7 @@
"outputs": [],
"source": [
"INDEX_RESOURCE_NAME = tree_ah_index.resource_name\n",
"INDEX_RESOURCE_NAME"
"print(INDEX_RESOURCE_NAME)"
]
},
{
@@ -872,7 +871,7 @@
"\n",
"VPC_NETWORK = \"[your-network-name]\"\n",
"VPC_NETWORK_FULL = \"projects/{}/global/networks/{}\".format(PROJECT_NUMBER, VPC_NETWORK)\n",
"VPC_NETWORK_FULL"
"print(VPC_NETWORK_FULL)"
]
},
{
@@ -899,7 +898,7 @@
"outputs": [],
"source": [
"INDEX_ENDPOINT_NAME = my_index_endpoint.resource_name\n",
"INDEX_ENDPOINT_NAME"
"print(INDEX_ENDPOINT_NAME)"
]
},
{
@@ -1014,7 +1013,7 @@
" filter=[Namespace(\"class\", [\"even\"])],\n",
")\n",
"\n",
"response"
"print(response)"
]
},
{
@@ -1097,21 +1096,19 @@
},
"outputs": [],
"source": [
"import os\n",
"\n",
"delete_bucket = False\n",
"\n",
"# Force undeployment of indexes and delete endpoint\n",
"my_index_endpoint.delete(force=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "omj7N9iWv-Tq"
},
"outputs": [],
"source": [
"my_index_endpoint.delete(force=True)\n",
"\n",
"# Delete indexes\n",
"tree_ah_index.delete()\n",
"brute_force_index.delete()"
"brute_force_index.delete()\n",
"\n",
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil -m rm -r $BUCKET_URI"
]
}
],