chatbot-backend / src /vctorstores /base_vectorstore.py
TalatMasood's picture
initial commit
640b1c8
raw
history blame
971 Bytes
# 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