Class MatchingEngineIndexEndpoint (1.14.0)

MatchingEngineIndexEndpoint(
    index_endpoint_name: str,
    project: Optional[str] = None,
    location: Optional[str] = None,
    credentials: Optional[google.auth.credentials.Credentials] = None,
)

Matching Engine index endpoint resource for Vertex AI.

Inheritance

builtins.object > google.cloud.aiplatform.base.VertexAiResourceNoun > builtins.object > google.cloud.aiplatform.base.FutureManager > google.cloud.aiplatform.base.VertexAiResourceNounWithFutureManager > MatchingEngineIndexEndpoint

Properties

deployed_indexes

Returns a list of deployed indexes on this endpoint.

description

Description of the index endpoint.

Methods

MatchingEngineIndexEndpoint

MatchingEngineIndexEndpoint(
    index_endpoint_name: str,
    project: Optional[str] = None,
    location: Optional[str] = None,
    credentials: Optional[google.auth.credentials.Credentials] = None,
)

Retrieves an existing index endpoint given a name or ID.

Example Usage:

my_index_endpoint = aiplatform.MatchingEngineIndexEndpoint(
    index_endpoint_name='projects/123/locations/us-central1/index_endpoint/my_index_id'
)
or
my_index_endpoint = aiplatform.MatchingEngineIndexEndpoint(
    index_endpoint_name='my_index_endpoint_id'
)
Parameters
Name Description
index_endpoint_name str

Required. A fully-qualified index endpoint resource name or a index ID. Example: "projects/123/locations/us-central1/index_endpoints/my_index_id" or "my_index_id" when project and location are initialized or passed.

project str

Optional. Project to retrieve index endpoint from. If not set, project set in aiplatform.init will be used.

location str

Optional. Location to retrieve index endpoint from. If not set, location set in aiplatform.init will be used.

credentials auth_credentials.Credentials

Optional. Custom credentials to use to retrieve this IndexEndpoint. Overrides credentials set in aiplatform.init.

create

create(
    display_name: str,
    network: str,
    description: Optional[str] = None,
    labels: Optional[Dict[str, str]] = None,
    project: Optional[str] = None,
    location: Optional[str] = None,
    credentials: Optional[google.auth.credentials.Credentials] = None,
    request_metadata: Optional[Sequence[Tuple[str, str]]] = (),
    sync: bool = True,
)

Creates a MatchingEngineIndexEndpoint resource.

Example Usage:

my_index_endpoint = aiplatform.IndexEndpoint.create(
    display_name='my_endpoint',
)
Parameters
Name Description
display_name str

Required. The display name of the IndexEndpoint. The name can be up to 128 characters long and can be consist of any UTF-8 characters.

network str

Required. The full name of the Google Compute Engine network <https://cloud.google.com/compute/docs/networks-and-firewalls#networks> to which the IndexEndpoint should be peered. Private services access must already be configured for the network. If left unspecified, the Endpoint is not peered with any network. Format <https://cloud.google.com/compute/docs/reference/rest/v1/networks/insert>: projects/{project}/global/networks/{network}. Where {project} is a project number, as in '12345', and {network} is network name.

description str

Optional. The description of the IndexEndpoint.

labels Dict[str, str]

Optional. The labels with user-defined metadata to organize your IndexEndpoint. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information on and examples of labels. No more than 64 user labels can be associated with one IndexEndpoint (System labels are excluded)." System reserved label keys are prefixed with "aiplatform.googleapis.com/" and are immutable.

project str

Optional. Project to create EntityType in. If not set, project set in aiplatform.init will be used.

location str

Optional. Location to create EntityType in. If not set, location set in aiplatform.init will be used.

credentials auth_credentials.Credentials

Optional. Custom credentials to use to create EntityTypes. Overrides credentials set in aiplatform.init.

request_metadata Sequence[Tuple[str, str]]

Optional. Strings which should be sent along with the request as metadata.

sync bool

Optional. Whether to execute this creation synchronously. If False, this method will be executed in concurrent Future and any downstream object will be immediately returned and synced when the Future has completed.

delete

delete(force: bool = False, sync: bool = True)

Deletes this MatchingEngineIndexEndpoint resource. If force is set to True, all indexes on this endpoint will be undeployed prior to deletion.

Parameters
Name Description
force bool

Required. If force is set to True, all deployed indexes on this endpoint will be undeployed first. Default is False.

sync bool

Whether to execute this method synchronously. If False, this method will be executed in concurrent Future and any downstream object will be immediately returned and synced when the Future has completed.

Exceptions
Type Description
FailedPrecondition If indexes are deployed on this MatchingEngineIndexEndpoint and force = False.

deploy_index

deploy_index(
    index: google.cloud.aiplatform.matching_engine.matching_engine_index.MatchingEngineIndex,
    deployed_index_id: str,
    display_name: Optional[str] = None,
    machine_type: Optional[str] = None,
    min_replica_count: Optional[int] = None,
    max_replica_count: Optional[int] = None,
    enable_access_logging: Optional[bool] = None,
    reserved_ip_ranges: Optional[Sequence[str]] = None,
    deployment_group: Optional[str] = None,
    auth_config_audiences: Optional[Sequence[str]] = None,
    auth_config_allowed_issuers: Optional[Sequence[str]] = None,
    request_metadata: Optional[Sequence[Tuple[str, str]]] = (),
)

Deploys an existing index resource to this endpoint resource.

Parameters
Name Description
index MatchingEngineIndex

Required. The Index this is the deployment of. We may refer to this Index as the DeployedIndex's "original" Index.

deployed_index_id str

Required. The user specified ID of the DeployedIndex. The ID can be up to 128 characters long and must start with a letter and only contain letters, numbers, and underscores. The ID must be unique within the project it is created in.

display_name str

The display name of the DeployedIndex. If not provided upon creation, the Index's display_name is used.

machine_type str

Optional. The type of machine. Not specifying machine type will result in model to be deployed with automatic resources.

min_replica_count int

Optional. The minimum number of machine replicas this deployed model will be always deployed on. If traffic against it increases, it may dynamically be deployed onto more replicas, and as traffic decreases, some of these extra replicas may be freed. If this value is not provided, the value of 2 will be used.

max_replica_count int

Optional. The maximum number of replicas this deployed model may be deployed on when the traffic against it increases. If requested value is too large, the deployment will error, but if deployment succeeds then the ability to scale the model to that many replicas is guaranteed (barring service outages). If traffic against the deployed model increases beyond what its replicas at maximum may handle, a portion of the traffic will be dropped. If this value is not provided, the larger value of min_replica_count or 2 will be used. If value provided is smaller than min_replica_count, it will automatically be increased to be min_replica_count.

enable_access_logging bool

Optional. If true, private endpoint's access logs are sent to StackDriver Logging. These logs are like standard server access logs, containing information like timestamp and latency for each MatchRequest. Note that Stackdriver logs may incur a cost, especially if the deployed index receives a high queries per second rate (QPS). Estimate your costs before enabling this option.

reserved_ip_ranges Sequence[str]

Optional. A list of reserved ip ranges under the VPC network that can be used for this DeployedIndex. If set, we will deploy the index within the provided ip ranges. Otherwise, the index might be deployed to any ip ranges under the provided VPC network. The value sohuld be the name of the address (https://cloud.google.com/compute/docs/reference/rest/v1/addresses) Example: 'vertex-ai-ip-range'.

deployment_group str

Optional. The deployment group can be no longer than 64 characters (eg: 'test', 'prod'). If not set, we will use the 'default' deployment group. Creating deployment_groups with reserved_ip_ranges is a recommended practice when the peered network has multiple peering ranges. This creates your deployments from predictable IP spaces for easier traffic administration. Also, one deployment_group (except 'default') can only be used with the same reserved_ip_ranges which means if the deployment_group has been used with reserved_ip_ranges: [a, b, c], using it with [a, b] or [d, e] is disallowed. Note: we only support up to 5 deployment groups(not including 'default').

auth_config_audiences Sequence[str]

The list of JWT audiences <https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3>__. that are allowed to access. A JWT containing any of these audiences will be accepted. auth_config_audiences and auth_config_allowed_issuers must be passed together.

auth_config_allowed_issuers Sequence[str]

A list of allowed JWT issuers. Each entry must be a valid Google service account, in the following format: service-account-name@project-id.iam.gserviceaccount.com auth_config_audiences and auth_config_allowed_issuers must be passed together.

request_metadata Sequence[Tuple[str, str]]

Optional. Strings which should be sent along with the request as metadata.

match

match(deployed_index_id: str, queries: List[List[float]], num_neighbors: int = 1)

Retrieves nearest neighbors for the given embedding queries on the specified deployed index.

Parameters
Name Description
deployed_index_id str

Required. The ID of the DeployedIndex to match the queries against.

queries List[List[float]]

Required. A list of queries. Each query is a list of floats, representing a single embedding.

num_neighbors int

Required. The number of nearest neighbors to be retrieved from database for each query.

mutate_deployed_index

mutate_deployed_index(
    deployed_index_id: str,
    min_replica_count: int = 1,
    max_replica_count: int = 1,
    request_metadata: Optional[Sequence[Tuple[str, str]]] = (),
)

Updates an existing deployed index under this endpoint resource.

Parameters
Name Description
deployed_index_id str

Required. The user specified ID of the DeployedIndex. The ID can be up to 128 characters long and must start with a letter and only contain letters, numbers, and underscores. The ID must be unique within the project it is created in.

min_replica_count int

Optional. The minimum number of machine replicas this deployed model will be always deployed on. If traffic against it increases, it may dynamically be deployed onto more replicas, and as traffic decreases, some of these extra replicas may be freed.

max_replica_count int

Optional. The maximum number of replicas this deployed model may be deployed on when the traffic against it increases. If requested value is too large, the deployment will error, but if deployment succeeds then the ability to scale the model to that many replicas is guaranteed (barring service outages). If traffic against the deployed model increases beyond what its replicas at maximum may handle, a portion of the traffic will be dropped. If this value is not provided, the larger value of min_replica_count or 1 will be used. If value provided is smaller than min_replica_count, it will automatically be increased to be min_replica_count.

request_metadata Sequence[Tuple[str, str]]

Optional. Strings which should be sent along with the request as metadata.

index_id str

Required. The ID of the MatchingEnginIndex associated with the DeployedIndex.

undeploy_all

undeploy_all(sync: bool = True)

Undeploys every index deployed to this MatchingEngineIndexEndpoint.

Parameter
Name Description
sync bool

Whether to execute this method synchronously. If False, this method will be executed in concurrent Future and any downstream object will be immediately returned and synced when the Future has completed.

undeploy_index

undeploy_index(
    deployed_index_id: str, request_metadata: Optional[Sequence[Tuple[str, str]]] = ()
)

Undeploy a deployed index endpoint resource.

Parameters
Name Description
deployed_index_id str

Required. The ID of the DeployedIndex to be undeployed from the IndexEndpoint.

request_metadata Sequence[Tuple[str, str]]

Optional. Strings which should be sent along with the request as metadata.

update

update(
    display_name: str,
    description: Optional[str] = None,
    labels: Optional[Dict[str, str]] = None,
    request_metadata: Optional[Sequence[Tuple[str, str]]] = (),
)

Updates an existing index endpoint resource.

Parameters
Name Description
display_name str

Required. The display name of the IndexEndpoint. The name can be up to 128 characters long and can be consist of any UTF-8 characters.

description str

Optional. The description of the IndexEndpoint.

labels Dict[str, str]

Optional. The labels with user-defined metadata to organize your Indexs. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information on and examples of labels. No more than 64 user labels can be associated with one IndexEndpoint (System labels are excluded)." System reserved label keys are prefixed with "aiplatform.googleapis.com/" and are immutable.

request_metadata Sequence[Tuple[str, str]]

Optional. Strings which should be sent along with the request as metadata.