Skip to main content
Version: latest

agrag.vectordb.weaviate.WeaviateVectorStore

WeaviateVectorStore(*, settings:WeaviateSettings | None = None, tracer:Tracer | None = None) -> None

Bases: VectorStore

An exclusive external index backed by Weaviate.

Collections persist dimensions in their description, including when empty. Changing that description outside this adapter invalidates the collection. Dense scores use the graph-native scale. Hybrid scores are rank-only. Server-side asynchronous indexing must be disabled for read-after-write consistency. Each collection belongs to exactly one graph.

Functions:

  • close – Close connections after all requests have finished.
  • collection_info – Return persisted dimensions, actual metric and count, or None if absent.
  • collection_name – Capitalize only the first letter of the prefixed collection name.
  • delete – Delete in batches of at most 500 IDs, ignoring missing records.
  • delete_collection – Delete a collection, ignoring one that does not exist.
  • ensure_collection – Create a collection or reject incompatible dimensions and metric.
  • hybrid_search – Fuse dense and BM25 ranks, with exact dense and lexical endpoints.
  • initialize – Connect and verify readiness, raising VectorStoreError on failure.
  • list_ids – Return ascending IDs strictly after the cursor, independent of scan order.
  • search – Return dense matches on the graph-native score scale, best first.
  • upsert – Insert or replace UUIDs in batches, checking every batch response.

Attributes:

Parameters:

  • settings (WeaviateSettings | None) – Connection settings and the graph's collection prefix.
  • tracer (Tracer | None) – Emits database client spans when supplied. None disables tracing even when a global provider is configured.

close​

close() -> None

Close connections after all requests have finished.

The caller owns request lifetimes and must await active operations before closing the store. Repeated calls are harmless.

collection_info​

collection_info(kind:VectorKind, *, exact_count:bool = True) -> CollectionInfo | None

Return persisted dimensions, actual metric and count, or None if absent.

Parameters:

  • kind (VectorKind) – The collection to describe.
  • exact_count (bool) – Also fetch a sample vector to verify its dimensions. When false, only schema metadata and the object count are read.

collection_name​

collection_name(kind:VectorKind) -> str

Capitalize only the first letter of the prefixed collection name.

collection_prefix​

collection_prefix = self._settings.collection_prefix

delete​

delete(kind:VectorKind, ids:Sequence[UUID]) -> None

Delete in batches of at most 500 IDs, ignoring missing records.

delete_collection​

delete_collection(kind:VectorKind) -> None

Delete a collection, ignoring one that does not exist.

ensure_collection​

ensure_collection(kind:VectorKind, *, dimensions:int, distance:Distance) -> None

Create a collection or reject incompatible dimensions and metric.

An existing collection without adapter-owned dimension metadata is rejected rather than silently adopted. DOT raises ValueError.

hybrid_search(kind:VectorKind, vector:Sequence[float], text:str, *, limit:int, alpha:float, labels:Sequence[str] | None = None) -> list[VectorHit]

Fuse dense and BM25 ranks, with exact dense and lexical endpoints.

initialize​

initialize() -> None

Connect and verify readiness, raising VectorStoreError on failure.

list_ids​

list_ids(kind:VectorKind, *, after:UUID | None = None, limit:int = 1000) -> list[UUID]

Return ascending IDs strictly after the cursor, independent of scan order.

Scans all UUIDs with the server cursor and retains only the smallest requested page. Memory is bounded by the page size for all collections.

max_results​

max_results: int = 10000

name​

name: str = 'weaviate'
search(kind:VectorKind, vector:Sequence[float], *, limit:int, labels:Sequence[str] | None = None) -> list[VectorHit]

Return dense matches on the graph-native score scale, best first.

upsert​

upsert(kind:VectorKind, records:Sequence[VectorRecord], *, batch_size:int = 256) -> None

Insert or replace UUIDs in batches, checking every batch response.

Missing collections and wrong vector dimensions raise VectorStoreError. Batch import replaces an object with an existing UUID in Weaviate.