Skip to content

Commit bbe105d

Browse files
authored
feat: Added matching engine integration (#995)
* Added matching engine index * Added matching engine index endpoint * Added deploy_index and undeploy_index to MatchingEngineIndexEndpoint * Added mutate_deployed_index to MatchingEngineIndexEndpoint * Fixed logging * Added unit tests * Removed unneeded parameter * Fixed tests * Fixed compat types for matching engine * Added test_matching_engine_index_endpoint.py * Initial integration test for matching engine added * Added metadata parameters to MatchingEngineIndex * Added unit tests for config * Fixes to integration test * Added missing config file * Cleaned up docstrings and removed immutable update parameters * Removed metadata_schema_uri * Various matching engine fixes * Finished main logic for MatchingEngineIndex * Fixed deployment test * Added matching engine deployment and tests * Added undeploy_all tests * Fixed e2e matching engine test * Improved tests and docstrings * Test cleanup and removal of unused mutate_deployed_index parameters * fix: Updated docstrings * Updated copyright * Improved comments * Removed index_id paramater * Fixed update bug * Removed unneeded id parameters * Added prediction service * Update tests * Ran linter * Removed enable_private_service_connect parameter as it will be deprecated soon * Cleaned up tests * Fixed test * Added teardown and network code * Fixed undeploy * Match tweaks * Removed batch match test for now * Added MatchingEngineIndexConfig to init * Removed unneeded index_id parameter on mutate_deployed_index * Fixed imports * Switched to returning MatchNeighbor's * Import tweaks * Ran linter * Cleaned up tests * Added comments * Fixed lint issues * Lint * Updated copyright * Added remaining docstrings * Reverted unwanted change * Fixed comment * Added undeploy step for index_endpoint system test * Added more system tests * Fixed lint issues * Added unique id to prevent conflicts * Addressed PR comments * Reordered imports * Fixed init file * Fix lint and brute_force issue * Addressed PR comments * Remove unused parameter * Fixed system test * Removed vpc reliant system tests * Fixed unit tests * Fixed lint error * Fixed test * Fixed lint issues
1 parent f3338fc commit bbe105d

15 files changed

+3786
-2
lines changed

google/cloud/aiplatform/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
Feature,
3939
Featurestore,
4040
)
41+
from google.cloud.aiplatform.matching_engine import (
42+
MatchingEngineIndex,
43+
MatchingEngineIndexEndpoint,
44+
)
4145
from google.cloud.aiplatform.metadata import metadata
4246
from google.cloud.aiplatform.models import Endpoint
4347
from google.cloud.aiplatform.models import Model
@@ -104,6 +108,8 @@
104108
"EntityType",
105109
"Feature",
106110
"Featurestore",
111+
"MatchingEngineIndex",
112+
"MatchingEngineIndexEndpoint",
107113
"ImageDataset",
108114
"HyperparameterTuningJob",
109115
"Model",

google/cloud/aiplatform/compat/__init__.py

+10
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@
7676
types.job_state = types.job_state_v1beta1
7777
types.machine_resources = types.machine_resources_v1beta1
7878
types.manual_batch_tuning_parameters = types.manual_batch_tuning_parameters_v1beta1
79+
types.matching_engine_deployed_index_ref = (
80+
types.matching_engine_deployed_index_ref_v1beta1
81+
)
82+
types.matching_engine_index = types.matching_engine_index_v1beta1
83+
types.matching_engine_index_endpoint = types.matching_engine_index_endpoint_v1beta1
7984
types.metadata_service = types.metadata_service_v1beta1
8085
types.metadata_store = types.metadata_store_v1beta1
8186
types.model = types.model_v1beta1
@@ -147,6 +152,11 @@
147152
types.job_state = types.job_state_v1
148153
types.machine_resources = types.machine_resources_v1
149154
types.manual_batch_tuning_parameters = types.manual_batch_tuning_parameters_v1
155+
types.matching_engine_deployed_index_ref = (
156+
types.matching_engine_deployed_index_ref_v1
157+
)
158+
types.matching_engine_index = types.matching_engine_index_v1
159+
types.matching_engine_index_endpoint = types.matching_engine_index_endpoint_v1
150160
types.metadata_service = types.metadata_service_v1
151161
types.metadata_store = types.metadata_store_v1
152162
types.model = types.model_v1

google/cloud/aiplatform/compat/services/__init__.py

+16
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
from google.cloud.aiplatform_v1beta1.services.featurestore_service import (
2828
client as featurestore_service_client_v1beta1,
2929
)
30+
from google.cloud.aiplatform_v1beta1.services.index_service import (
31+
client as index_service_client_v1beta1,
32+
)
33+
from google.cloud.aiplatform_v1beta1.services.index_endpoint_service import (
34+
client as index_endpoint_service_client_v1beta1,
35+
)
3036
from google.cloud.aiplatform_v1beta1.services.job_service import (
3137
client as job_service_client_v1beta1,
3238
)
@@ -61,6 +67,12 @@
6167
from google.cloud.aiplatform_v1.services.featurestore_service import (
6268
client as featurestore_service_client_v1,
6369
)
70+
from google.cloud.aiplatform_v1.services.index_service import (
71+
client as index_service_client_v1,
72+
)
73+
from google.cloud.aiplatform_v1.services.index_endpoint_service import (
74+
client as index_endpoint_service_client_v1,
75+
)
6476
from google.cloud.aiplatform_v1.services.job_service import (
6577
client as job_service_client_v1,
6678
)
@@ -89,6 +101,8 @@
89101
endpoint_service_client_v1,
90102
featurestore_online_serving_service_client_v1,
91103
featurestore_service_client_v1,
104+
index_service_client_v1,
105+
index_endpoint_service_client_v1,
92106
job_service_client_v1,
93107
metadata_service_client_v1,
94108
model_service_client_v1,
@@ -101,6 +115,8 @@
101115
endpoint_service_client_v1beta1,
102116
featurestore_online_serving_service_client_v1beta1,
103117
featurestore_service_client_v1beta1,
118+
index_service_client_v1beta1,
119+
index_endpoint_service_client_v1beta1,
104120
job_service_client_v1beta1,
105121
model_service_client_v1beta1,
106122
pipeline_service_client_v1beta1,

google/cloud/aiplatform/compat/types/__init__.py

+12
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
data_labeling_job as data_labeling_job_v1beta1,
2929
dataset as dataset_v1beta1,
3030
dataset_service as dataset_service_v1beta1,
31+
deployed_index_ref as matching_engine_deployed_index_ref_v1beta1,
3132
deployed_model_ref as deployed_model_ref_v1beta1,
3233
encryption_spec as encryption_spec_v1beta1,
3334
endpoint as endpoint_v1beta1,
@@ -45,6 +46,8 @@
4546
featurestore_monitoring as featurestore_monitoring_v1beta1,
4647
featurestore_online_service as featurestore_online_service_v1beta1,
4748
featurestore_service as featurestore_service_v1beta1,
49+
index as matching_engine_index_v1beta1,
50+
index_endpoint as matching_engine_index_endpoint_v1beta1,
4851
hyperparameter_tuning_job as hyperparameter_tuning_job_v1beta1,
4952
io as io_v1beta1,
5053
job_service as job_service_v1beta1,
@@ -86,6 +89,7 @@
8689
data_labeling_job as data_labeling_job_v1,
8790
dataset as dataset_v1,
8891
dataset_service as dataset_service_v1,
92+
deployed_index_ref as matching_engine_deployed_index_ref_v1,
8993
deployed_model_ref as deployed_model_ref_v1,
9094
encryption_spec as encryption_spec_v1,
9195
endpoint as endpoint_v1,
@@ -103,6 +107,8 @@
103107
featurestore_online_service as featurestore_online_service_v1,
104108
featurestore_service as featurestore_service_v1,
105109
hyperparameter_tuning_job as hyperparameter_tuning_job_v1,
110+
index as matching_engine_index_v1,
111+
index_endpoint as matching_engine_index_endpoint_v1,
106112
io as io_v1,
107113
job_service as job_service_v1,
108114
job_state as job_state_v1,
@@ -167,6 +173,9 @@
167173
job_state_v1,
168174
machine_resources_v1,
169175
manual_batch_tuning_parameters_v1,
176+
matching_engine_deployed_index_ref_v1,
177+
matching_engine_index_v1,
178+
matching_engine_index_endpoint_v1,
170179
metadata_service_v1,
171180
metadata_store_v1,
172181
model_v1,
@@ -223,6 +232,9 @@
223232
job_state_v1beta1,
224233
machine_resources_v1beta1,
225234
manual_batch_tuning_parameters_v1beta1,
235+
matching_engine_deployed_index_ref_v1beta1,
236+
matching_engine_index_v1beta1,
237+
matching_engine_index_endpoint_v1beta1,
226238
metadata_service_v1beta1,
227239
metadata_store_v1beta1,
228240
model_v1beta1,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Copyright 2022 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
from google.cloud.aiplatform.matching_engine.matching_engine_index import (
19+
MatchingEngineIndex,
20+
)
21+
from google.cloud.aiplatform.matching_engine.matching_engine_index_config import (
22+
BruteForceConfig as MatchingEngineBruteForceAlgorithmConfig,
23+
MatchingEngineIndexConfig as MatchingEngineIndexConfig,
24+
TreeAhConfig as MatchingEngineTreeAhAlgorithmConfig,
25+
)
26+
from google.cloud.aiplatform.matching_engine.matching_engine_index_endpoint import (
27+
MatchingEngineIndexEndpoint,
28+
)
29+
30+
__all__ = (
31+
"MatchingEngineIndex",
32+
"MatchingEngineIndexEndpoint",
33+
"MatchingEngineIndexConfig",
34+
"MatchingEngineBruteForceAlgorithmConfig",
35+
"MatchingEngineTreeAhAlgorithmConfig",
36+
)

0 commit comments

Comments
 (0)