Searches for neighbors in a Vertex AI Vector Search 2.0 Collection.
find_neighbors(
project_id: str,
region: str,
collection_id: str,
queries: List[List[float]],
num_neighbors: int,
filter_: dict | None = None,
credentials: Optional[Credentials] = None,
vector_field_name: str = 'embedding',
sparse_queries: List[dict[str, List[int] | List[float]]] | None = None,
rrf_ranking_alpha: float = 1.0
) -> List[List[dict[str, Any]]]| Name | Type | Description |
|---|---|---|
project_id* | str | The GCP project ID. |
region* | str | The GCP region. |
collection_id* | str | The collection ID. |
queries* | List[List[float]] | List of query embeddings. |
num_neighbors* | int | Number of neighbors to return. |
filter_ | dict | None | Default: NoneOptional filter dict. Examples: {"genre": {"$eq": "Drama"}}, {"$and": [{"year": {"$gte": 1990}}, {"genre": {"$eq": "Action"}}]} |
credentials | Optional[Credentials] | Default: NoneOptional credentials to use. |
vector_field_name | str | Default: 'embedding'Name of the vector field in the collection schema. |
sparse_queries | List[dict[str, List[int] | List[float]]] | None | Default: NoneOptional list of sparse query embeddings for hybrid search. Each sparse query should be: {"values": [...], "indices": [...]} |
rrf_ranking_alpha | float | Default: 1.0RRF ranking alpha parameter for hybrid search (0.0 to 1.0). NOTE: This parameter is currently not used in V2 API. |