Skip to content

Class swarmauri_base.vector_stores.VectorStoreRetrieveMixin.VectorStoreRetrieveMixin

swarmauri_base.vector_stores.VectorStoreRetrieveMixin.VectorStoreRetrieveMixin

Bases: IVectorStoreRetrieve, BaseModel

retrieve abstractmethod

retrieve(query, top_k=5)

Retrieve the top_k most relevant documents based on the given query.

PARAMETER DESCRIPTION
query

The query string used for document retrieval.

TYPE: str

top_k

The number of top relevant documents to retrieve.

TYPE: int DEFAULT: 5

RETURNS DESCRIPTION
List[Document]

List[IDocument]: A list of the top_k most relevant documents.

Source code in swarmauri_base/vector_stores/VectorStoreRetrieveMixin.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
@abstractmethod
def retrieve(self, query: str, top_k: int = 5) -> List[Document]:
    """
    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