swarmauri.standard.document_stores.base.DocumentStoreRetrieveBase module
- class swarmauri.standard.document_stores.base.DocumentStoreRetrieveBase.DocumentStoreRetrieveBase[source]
Bases:
DocumentStoreBase
,IDocumentRetrieve
,ABC
- abstract add_document(document)
Add a single document to the document store.
Parameters: - document (IDocument): The document to be added to the store.
- Return type:
None
- abstract add_documents(documents)
Add multiple documents to the document store in a batch operation.
Parameters: - documents (List[IDocument]): A list of documents to be added to the store.
- Return type:
None
- abstract delete_document(doc_id)
Delete a document from the document store by its identifier.
Parameters: - doc_id (str): The unique identifier of the document to delete.
- Return type:
None
- document_count()
- dump(file_path)
- abstract get_all_documents()
Retrieve all documents stored in the document store.
Returns: - List[IDocument]: A list of all documents in the store.
- Return type:
List
[IDocument
]
- abstract get_document(doc_id)
Retrieve a single document by its identifier.
Parameters: - doc_id (str): The unique identifier of the document to retrieve.
Returns: - Optional[IDocument]: The requested document if found; otherwise, None.
- Return type:
Optional
[IDocument
]
- load(file_path)
- abstract retrieve(query, top_k=5)[source]
Retrieve the top_k 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[IDocument]
- abstract update_document(doc_id, updated_document)
Update a document in the document store.
Parameters: - doc_id (str): The unique identifier of the document to update. - updated_document (IDocument): The updated document instance.
- Return type:
None