Skip to main content
Version: 0.0.8 (stable)

agrag.retrieval.methods.vector.vector_search

vector_search(query:str, *, embedder:Embedder, graph_store:GraphStore, labels:Sequence[str], limit:int, filters:SearchFilters | None, query_vector:Sequence[float] | None = None, vector_store:VectorStore | None = None, hybrid:bool = False, alpha:float = 0.5, tracer:Tracer | None = None) -> list[VectorHit]

Embed query and run GraphStore's native vector search for each label.

Native vector search uses one index per label. An external store groups labels by vector kind and joins candidates back to committed graph nodes.

The vector query excludes records an in-flight Cutover Job wrote, so a caller never receives an uncommitted job's node or vector.

Parameters:

  • query (str) – The natural-language query text to embed.
  • embedder (Embedder) – Produces the query's dense vector.
  • graph_store (GraphStore) – Runs the native vector search.
  • labels (Sequence[str]) – The node labels to search, each backed by its own vector index.
  • limit (int) – Maximum hits to return.
  • filters (SearchFilters | None) – Constraints applied as node property filters. Labels choose the searched indexes, so they are not sent as property filters.
  • query_vector (Sequence[float] | None) – Precomputed query embedding. None embeds query.
  • vector_store (VectorStore | None) – Optional external store for vector candidates.
  • hybrid (bool) – Use the store's dense and lexical hybrid search when available.
  • alpha (float) – Dense weight for external hybrid search.
  • tracer (Tracer | None) – Opens the search span. None opens no recorded span.

Returns:

Raises:

  • ValueError – No labels were given to search.