Source code for agentscope.rag._reader._reader_base
# -*- coding: utf-8 -*-"""The reader base class for retrieval-augmented generation (RAG)."""fromabcimportabstractmethodfromtypingimportAnyfrom.._documentimportDocument
[docs]classReaderBase:"""The reader base class, which is responsible for reading the original data, splitting it into chunks, and converting each chunk into a `Document` object."""
[docs]@abstractmethodasyncdef__call__(self,*args:Any,**kwargs:Any)->list[Document]:"""The async call function that takes the input files and returns the vector records"""
[docs]@abstractmethoddefget_doc_id(self,*args:Any,**kwargs:Any)->str:"""Get a unique document ID for the input data. This method is to expose the document ID generation logic to the developers Returns: `str`: A unique document ID for the input data. """