refactor: remove pgvector runtime

This commit is contained in:
2026-08-08 21:38:03 +02:00
parent 5c12d9bb79
commit 8826f8ac6b
34 changed files with 200 additions and 3362 deletions
+12 -12
View File
@@ -6,11 +6,11 @@ from uuid import NAMESPACE_URL, uuid5
import requests
from tht.adapters.vector.pgvector import (
from tht.adapters.vector._shared import (
COLLECTION_KINDS,
_collection,
_validate_collection_kinds,
_validate_known_kinds,
validate_collection,
validate_collection_kinds,
validate_known_kinds,
)
from tht.ports.vector import (
VectorCapabilities,
@@ -165,8 +165,8 @@ class QdrantVectorStore:
return sorted(hits, key=lambda hit: (-hit.similarity, hit.id))[:limit]
def existing_hashes(self, collection: str, kinds: list[str]) -> dict[str, str]:
_collection("vectors", collection)
_validate_collection_kinds(collection, kinds)
validate_collection(collection)
validate_collection_kinds(collection, kinds)
points = self._scroll(
[
*self._workspace_filter(),
@@ -186,11 +186,11 @@ class QdrantVectorStore:
return hashes
def upsert(self, collection: str, records: list[VectorWriteRecord]) -> int:
_collection("vectors", collection)
validate_collection(collection)
self._ensure_collection(strict=True)
points = []
for write_record in records:
_validate_collection_kinds(collection, [write_record.record.kind])
validate_collection_kinds(collection, [write_record.record.kind])
self._validate_embedding(write_record.embedding, query=False)
semantic_kind = qdrant_semantic_kind(write_record.record.kind)
points.append(
@@ -213,8 +213,8 @@ class QdrantVectorStore:
return len(records)
def delete_kinds(self, collection: str, kinds: list[str]) -> int:
_collection("vectors", collection)
_validate_collection_kinds(collection, kinds)
validate_collection(collection)
validate_collection_kinds(collection, kinds)
must = [
*self._workspace_filter(),
{"key": "record_kind", "match": {"any": sorted(kinds)}},
@@ -284,10 +284,10 @@ class QdrantVectorStore:
) -> list[str]:
selected: set[str] = set()
for collection in collections:
_collection("vectors", collection)
validate_collection(collection)
selected.update(COLLECTION_KINDS[collection])
if kinds:
_validate_known_kinds(kinds)
validate_known_kinds(kinds)
selected &= set(kinds)
return sorted(selected)