Skip to main content
Version: 0.0.9

agrag.vectordb.placement.validate_placement

validate_placement(graph_store:GraphStore, *, vector_store:VectorStore | None, dimensions:int, distance:Distance, embedding_model:str, probe_vector:list[float], write:bool) -> None

Compare the graph's placement with the embedder used to open it.

The store, collection prefix, dimensions, distance, and embedding model name must all match a recorded placement, and the recorded probe vector must agree with the embedder's output for PROBE_TEXT. A graph that holds vectors but has no placement is refused. A graph without vectors may claim the identity when write is true, including when its record predates the embedding identity fields. A read-only check defers the identity comparison until a writer can claim that older record. A writer whose claim loses to another checks the identity of the winning record.

Parameters:

  • graph_store (GraphStore) – The graph that holds the placement record.
  • vector_store (VectorStore | None) – The external store in use, or None for graph-native indexes.
  • dimensions (int) – The dimensions of the embedding in use.
  • distance (Distance) – The distance metric of the embedding in use.
  • embedding_model (str) – Name of the embedding model in use.
  • probe_vector (list[float]) – This embedder's embedding of PROBE_TEXT.
  • write (bool) – Whether to record the placement on an empty graph.

Raises:

  • VectorPlacementError – A field or the probe differs from the stored placement, or the graph has content without a placement record.