File size: 971 Bytes
640b1c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# src/vectorstores/base_vectorstore.py
from abc import ABC, abstractmethod
from typing import List, Callable, Any

class BaseVectorStore(ABC):
    @abstractmethod
    def add_documents(
        self, 
        documents: List[str], 
        embeddings: List[List[float]]
    ) -> None:
        """
        Add documents to the vector store
        
        Args:
            documents (List[str]): List of document texts
            embeddings (List[List[float]]): Corresponding embeddings
        """
        pass
    
    @abstractmethod
    def similarity_search(
        self, 
        query_embedding: List[float], 
        top_k: int = 3
    ) -> List[str]:
        """
        Perform similarity search
        
        Args:
            query_embedding (List[float]): Embedding of the query
            top_k (int): Number of top similar documents to retrieve
        
        Returns:
            List[str]: List of most similar documents
        """
        pass