primus.analysis.qdrant_vector_store module

Qdrant-backed vector store adapter for semantic reinforcement memory.

Implements the topic-memory vector operations used by VectorTopicMemory while preserving the same high-level method contract as the S3 Vectors adapter.

class primus.analysis.qdrant_vector_store.QdrantTopicMemoryVectorStore(url: str, collection_name: str, client: Any = None)

Bases: object

Qdrant-backed topic memory store.

Supports health check, full rebuild, cluster persistence, and metadata updates used by Semantic Reinforcement Memory.

__init__(url: str, collection_name: str, client: Any = None)
build_index(documents: List[Dict[str, Any]], old_index_for_swap: str | None = None) → Dict[str, Any]

Rebuild collection contents by clearing existing points and writing new items.

old_index_for_swap is accepted for API compatibility and ignored.

bulk_update_cluster_weights(clusters: List[Dict[str, Any]], index_name: str | None = None) → None

Update memory_weight and memory_tier on existing cluster vectors.

clear_index(index_name: str | None = None) → int

Delete all vectors in the collection. Returns number of deleted vectors.

find_nearest_clusters(embedding: ndarray, k: int = 5, threshold: float | None = None) → List[Dict[str, Any]]

Query nearest cluster points.

Returns results ordered by descending similarity, matching previous topic-memory adapter behavior.

get_all_clusters() → List[Dict[str, Any]]

Retrieve all cluster vectors from the collection.

health_check() → bool

Return True if the configured collection is reachable.

persist_clusters(clusters: List[Dict[str, Any]], index_name: str | None = None) → None

Bulk-persist cluster vectors and metadata.