fabricatio_rag.models.document
Base class for document models.
Classes
A base class for document models. |
|
A base class for document models retrieved from a vector database. |
Module Contents
- class fabricatio_rag.models.document.StoredDocumentModel[ST](/, **data: Any)
Bases:
fabricatio_core.models.generic.Base,fabricatio_core.models.generic.VectorizableA base class for document models.
- abstractmethod prepare_insertion(vector: Sequence[float]) ST
Prepares the data for insertion into a vector database.
- classmethod from_txt_files[S: StoredDocumentModel[ST]](files: Sequence[pathlib.Path], chunk_size: int = 512, overlap: float = 0.2) List[S]
Create documents by splitting text files into chunks.
- Parameters:
files – Sequence of text file paths to read.
chunk_size – Maximum word count per chunk.
overlap – Overlap ratio between consecutive chunks (0.0-1.0).
- Returns:
List of text chunk document model instances, one per chunk.
- class fabricatio_rag.models.document.SearchedDocumentModel[SD](/, **data: Any)
Bases:
fabricatio_capabilities.models.generic.AsPrompt,fabricatio_core.models.generic.BaseA base class for document models retrieved from a vector database.
- classmethod from_raw(raw: SD) Self
- Abstractmethod:
Create the searched model from the rawdata searched from the db.