swarmauri.core.document_stores.IDocumentRetrieve module

class swarmauri.core.document_stores.IDocumentRetrieve.IDocumentRetrieve[source]

Bases: ABC

Abstract base class for document retrieval operations.

This class defines the interface for retrieving documents based on a query or other criteria. Implementations may use various indexing or search technologies to fulfill these retrievals.

abstract retrieve(query, top_k=5)[source]

Retrieve the most relevant documents based on the given query.

Parameters:
  • query (str) – The query string used for document retrieval.

  • top_k (int) – The number of top relevant documents to retrieve.

Returns:

A list of the top_k most relevant documents.

Return type:

List[Document]