Overview
Text loader processes various text-based files (.txt, .rst, .log, code files, etc.) with options for whitespace handling and content filtering. Simple and efficient for plain text documents. Loader Class:TextLoader
Config Class: TextLoaderConfig
Install
Install the Text loader optional dependency group:
Examples
Parameters
| Parameter | Type | Description | Default | Source |
|---|---|---|---|---|
encoding | str | None | File encoding (auto-detected if None) | None | Base |
error_handling | "ignore" | "warn" | "raise" | How to handle loading errors | ”warn” | Base |
include_metadata | bool | Whether to include file metadata | True | Base |
custom_metadata | dict | Additional metadata to include | Base | |
max_file_size | int | None | Maximum file size in bytes | None | Base |
skip_empty_content | bool | Skip documents with empty content | True | Base |
strip_whitespace | bool | Remove leading/trailing whitespace | True | Specific |
min_chunk_length | int | Minimum character length for chunks | 1 | Specific |

