# src/vectorstores/base_vectorstore.py from abc import ABC, abstractmethod from typing import List, Callable, Any, Dict, Optional class BaseVectorStore(ABC): @abstractmethod def add_documents( self, documents: List[str], embeddings: Optional[List[List[float]]] = None ) -> None: """ Add documents to the vector store Args: documents (List[str]): List of document texts embeddings (Optional[List[List[float]]]): Corresponding embeddings. If not provided, they will be generated using the embedding function. """ pass @abstractmethod def similarity_search( self, query_embedding: List[float], top_k: int = 3, **kwargs ) -> List[str]: """ Perform similarity search Args: query_embedding (List[float]): Embedding of the query top_k (int): Number of top similar documents to retrieve **kwargs: Additional search parameters Returns: List[str]: List of most similar documents """ pass @abstractmethod def get_all_documents( self, include_embeddings: bool = False ) -> List[Dict[str, Any]]: """ Retrieve all documents from the vector store Args: include_embeddings (bool): Whether to include embeddings in the response Returns: List[Dict[str, Any]]: List of documents with their IDs and optionally embeddings """ pass