CoolFace
Apppublic

Aigenthix/Graph_RAG

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
base.py48 linesDownload Raw Back to vector_dbs
1"""Abstract base class for vector database providers"""2 3from abc import ABC, abstractmethod4from typing import List, Dict, Any, Optional5 6 7class VectorDBProvider(ABC):8    """Abstract base class for vector database implementations"""9 10    @abstractmethod11    def initialize(self, config: Dict[str, Any]) -> None:12        """Initialize database connection"""13        pass14 15    @abstractmethod16    def add_vectors(17        self,18        vectors: List[List[float]],19        ids: List[str],20        metadata: List[Dict[str, Any]],21    ) -> bool:22        """Add vectors to database"""23        pass24 25    @abstractmethod26    def search(27        self,28        query_vector: List[float],29        top_k: int = 5,30    ) -> List[Dict[str, Any]]:31        """Search for similar vectors"""32        pass33 34    @abstractmethod35    def delete(self, doc_id: str) -> bool:36        """Delete document from database"""37        pass38 39    @abstractmethod40    def health_check(self) -> bool:41        """Check database connection health"""42        pass43 44    @abstractmethod45    def get_stats(self) -> Dict[str, Any]:46        """Get database statistics"""47        pass48