Performs semantic search in a Vertex AI Vector Search 2.0 Collection.
Semantic search automatically generates embeddings from the search text using Vertex AI models, so you don't need to manually create embeddings.
semantic_search(
project_id: str,
region: str,
collection_id: str,
search_text: str,
search_field: str,
num_neighbors: int,
task_type: str = 'RETRIEVAL_QUERY',
filter_: dict | None = None,
credentials: Optional[Credentials] = None
) -> 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. |
search_text* | str | Natural language query text. |
search_field* | str | Name of the vector field to search (must have auto-embedding config). |
num_neighbors* | int | Number of neighbors to return. |
task_type | str | Default: 'RETRIEVAL_QUERY'Embedding task type. Options:
|
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. |