Class NearestNeighborQuery (1.48.0)

NearestNeighborQuery(mapping=None, *, ignore_unknown_fields=False, **kwargs)

A query to find a number of similar entities.

This message has oneof_ fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

Attributes

NameDescription
entity_id str
Optional. The entity id whose similar entities should be searched for. If embedding is set, search will use embedding instead of entity_id. This field is a member of oneof_ instance.
embedding google.cloud.aiplatform_v1.types.NearestNeighborQuery.Embedding
Optional. The embedding vector that be used for similar search. This field is a member of oneof_ instance.
neighbor_count int
Optional. The number of similar entities to be retrieved from feature view for each query.
string_filters MutableSequence[google.cloud.aiplatform_v1.types.NearestNeighborQuery.StringFilter]
Optional. The list of string filters.
per_crowding_attribute_neighbor_count int
Optional. Crowding is a constraint on a neighbor list produced by nearest neighbor search requiring that no more than sper_crowding_attribute_neighbor_count of the k neighbors returned have the same value of crowding_attribute. It's used for improving result diversity.
parameters google.cloud.aiplatform_v1.types.NearestNeighborQuery.Parameters
Optional. Parameters that can be set to tune query on the fly.

Classes

Embedding

Embedding(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The embedding vector.

Parameters

Parameters(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Parameters that can be overrided in each query to tune query latency and recall.

StringFilter

StringFilter(mapping=None, *, ignore_unknown_fields=False, **kwargs)

String filter is used to search a subset of the entities by using boolean rules on string columns. For example: if a query specifies string filter with 'name = color, allow_tokens = {red, blue}, deny_tokens = {purple}',' then that query will match entities that are red or blue, but if those points are also purple, then they will be excluded even if they are red/blue. Only string filter is supported for now, numeric filter will be supported in the near future.

Methods

NearestNeighborQuery

NearestNeighborQuery(mapping=None, *, ignore_unknown_fields=False, **kwargs)

A query to find a number of similar entities.

This message has oneof_ fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields