Text Reader

Parameters and methods of TextReader, which reads text files into documents.

TextReader reads data from text files.

Parameters

ParameterTypeDefaultDescription
chunking_strategyOptional[ChunkingStrategy]FixedSizeChunking()Strategy used to chunk documents

TextReader also accepts the base Reader constructor parameters.

Methods

read()

Reads a text file and returns a list of documents.

ParameterTypeDefaultDescription
fileUnion[Path, IO[Any]]RequiredA Path or a binary file-like object such as BytesIO; string paths and text-mode handles are not supported
nameOptional[str]NoneName override for the resulting documents

async_read()

Async variant of read(). Accepts the same parameters.