localvectordb.extractors.all2md_extractor module
all2md-backed file content extractor.
This single extractor replaces the former per-format extractors (DOCX, PPTX, XLSX, PDF, HTML, XML, EPUB, RTF, plain text) by delegating to the all2md library, which converts 20+ document formats and 200+ source/text formats to Markdown.
The extractor is dependency-aware: the set of extensions/mimetypes it reports as
supported reflects which all2md format parsers actually have their optional
dependencies installed (via all2md.registry.check_dependencies). Formats
whose extras are missing are simply not advertised, so the registry will fall
back to any other registered extractor.
Output is Markdown (not plain text). This preserves document structure (headings, tables, lists), which downstream chunking/section detection can exploit for better boundaries.
Security
Conversion of untrusted uploads is hardened by default:
Remote document/asset fetching is disabled (no SSRF surface).
Local
file://access is disabled.For HTML, dangerous elements (scripts, event handlers) are stripped and attachments are skipped.
The base-class file-size guard and a ZIP-bomb guard (for ZIP-based formats such as DOCX/XLSX/PPTX/EPUB/ODF) run before content is handed to all2md.
These defaults can be overridden per call via keyword arguments (plumbed from
server configuration); see All2MdExtractor._build_parser_options().
- class localvectordb.extractors.all2md_extractor.All2MdExtractor(max_file_size_bytes: int | None = None)
Bases:
BaseExtractorExtractor that delegates to the all2md library for all supported formats.
Initialize the extractor.
- Parameters:
max_file_size_bytes (Optional[int]) – Maximum file size in bytes. If None, uses the module default MAX_FILE_SIZE_BYTES. Set to 0 to disable file size checking (not recommended for production).
- __init__(max_file_size_bytes: int | None = None)
Initialize the extractor.
- Parameters:
max_file_size_bytes (Optional[int]) – Maximum file size in bytes. If None, uses the module default MAX_FILE_SIZE_BYTES. Set to 0 to disable file size checking (not recommended for production).
- property priority: int
Priority level for this extractor (higher = preferred). Default should be 10.
- property supported_extensions: List[str]
List of file extensions this extractor supports (with dots, e.g., [‘.pdf’]).
- property metadata_schema: dict[str, MetadataField]