swarmauri.core.document_stores.IDocumentStore module

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

Bases: ABC

Interface for a Document Store responsible for storing, indexing, and retrieving documents.

abstract add_document(document)[source]

Stores a single document in the document store.

Parameters: - document (IDocument): The document to store.

Return type:

None

abstract add_documents(documents)[source]

Stores multiple documents in the document store.

Parameters: - documents (List[IDocument]): The list of documents to store.

Return type:

None

abstract delete_document(doc_id)[source]

Deletes a document from the document store by its ID.

Parameters: - doc_id (str): The unique identifier of the document to delete.

Return type:

None

abstract document_count()[source]
Return type:

int

abstract get_all_documents()[source]

Retrieves all documents stored in the document store.

Returns: - List[IDocument]: A list of all documents.

Return type:

List[IDocument]

abstract get_document(doc_id)[source]

Retrieves a document by its ID.

Parameters: - doc_id (str): The unique identifier for the document.

Returns: - Union[IDocument, None]: The requested document, or None if not found.

Return type:

Optional[IDocument]

abstract update_document(doc_id, updated_document)[source]

Updates a document in the document store.

Parameters: - doc_id (str): The unique identifier for the document to update. - updated_document (IDocument): The updated document object.

Note: It’s assumed that the updated_document will retain the same doc_id but may have different content or metadata.

Return type:

None