ractogateway.rag.readers.base
Abstract base class for all file readers.
- class ractogateway.rag.readers.base.BaseReader[source]
Bases:
ABCRead content from a file path, raw bytes, or a binary buffer.
Concrete subclasses must implement
_read_path()and may override_read_bytes()to support bytes/buffer input. The publicread()method handles all type coercion automatically.- abstract property supported_extensions: frozenset[str]
Lower-case extensions (with dot) this reader handles, e.g.
{".pdf"}.
- read(source)[source]
Load source and return its content as a
Document.- Parameters:
source (
str|Path|bytes|BinaryIO) –strorPathFile path read from disk. Both absolute and relative paths are accepted.
bytesRaw file bytes.
Document.sourceis set to"<bytes>".- binary file-like object
Any object with a
.read() -> bytesmethod — e.g.io.BytesIO, an open binary file handle, a network stream.Document.sourceis set to"<buffer>".
- Return type: