agrag.loaders.docling.loader.DoclingLoader
Bases: ProseLoader
Reads documents with the docling library.
This loader registers for the PDF, DOCX, PPTX, and image formats, plus the Markdown, HTML, CSV, AsciiDoc, and XML formats it can also parse. It wins by default only for the formats no core loader claims.
Attributes:
- extensions – Every format docling can read.
- extra – The package extra required to use this loader.
Functions:
- load – Yield one prose Document parsed by docling.
extensions
extensions = frozenset(_DOCLING_FORMATS.keys())
extra
extra = 'docling'
family
family = DocumentFamily.PROSE
load
load(source:SourceRef, stream:BinaryIO, opts:ReadOptions, *, start_at:int = 0) -> Iterator[Document]
Yield one prose Document parsed by docling.
The content hash comes from the raw source bytes, not from docling's parsed output, because the parsed output can change between docling versions and runs.
Parameters:
- source (
SourceRef) – The source to read. - stream (
BinaryIO) – The open binary stream for the source. - opts (
ReadOptions) – The read options. - start_at (
int) – Ignored by prose loaders.
Yields:
Document– One Document holding docling's Markdown export of the source.
Raises:
MissingExtraError– The docling extra is not installed.DocumentTooLargeError– The source is larger than the configured byte limit.DocumentConversionError– Docling could not parse or convert the source.ValueError–opts.max_document_bytesis not a positive integer.
mime_types
mime_types: frozenset[str] = frozenset()