Source code for swarmauri.standard.document_stores.base.DocumentStoreRetrieveBase

from abc import ABC, abstractmethod
from typing import List
from swarmauri.core.document_stores.IDocumentRetrieve import IDocumentRetrieve
from swarmauri.core.documents.IDocument import IDocument
from swarmauri.standard.document_stores.base.DocumentStoreBase import DocumentStoreBase

[docs] class DocumentStoreRetrieveBase(DocumentStoreBase, IDocumentRetrieve, ABC):
[docs] @abstractmethod def retrieve(self, query: str, top_k: int = 5) -> List[IDocument]: """ Retrieve the top_k most relevant documents based on the given query. Args: query (str): The query string used for document retrieval. top_k (int): The number of top relevant documents to retrieve. Returns: List[IDocument]: A list of the top_k most relevant documents. """ pass