Skip to main content

Classes

CLASS RichDocument

A RichDocument is a block of content with an underlying DoclingDocument. It has helper functions for working with the document and extracting parts of it.
Methods:

FUNC parts

parts(self) -> list[Component | CBlock]
RichDocument has no parts. In the future, we should allow chunking of DoclingDocuments to correspond to parts().

FUNC format_for_llm

format_for_llm(self) -> TemplateRepresentation | str
Return Document content as Markdown. No template needed here.

FUNC docling

docling(self) -> DoclingDocument
Get the underlying Docling Document.

FUNC to_markdown

to_markdown(self)
Get the full text of the document as markdown.

FUNC get_tables

get_tables(self) -> list[Table]
Return the Tables that are a part of this document.

FUNC save

save(self, filename: str | Path) -> None
Save the underlying DoclingDocument for reuse later.

FUNC load

load(cls, filename: str | Path) -> RichDocument
Load a DoclingDocument from a file. The file must already be a DoclingDocument.

FUNC from_document_file

from_document_file(cls, source: str | Path | DocumentStream) -> RichDocument
Process a document with Docling.

CLASS TableQuery

Table-specific query.
Methods:

FUNC parts

parts(self) -> list[Component | CBlock]
The list of cblocks/components on which TableQuery depends.

FUNC format_for_llm

format_for_llm(self) -> TemplateRepresentation
Template arguments for Formatter.

CLASS TableTransform

Table-specific transform.
Methods:

FUNC parts

parts(self) -> list[Component | CBlock]
The parts for this component.

FUNC format_for_llm

format_for_llm(self) -> TemplateRepresentation
Template arguments for Formatter.

CLASS Table

A Table represents a single table within a larger Docling Document.
Methods:

FUNC from_markdown

from_markdown(cls, md: str) -> Table | None
Creates a fake document from the markdown and attempts to extract the first table found.

FUNC parts

parts(self)
The current implementation does not necessarily entail any string re-use, so parts is empty.

FUNC to_markdown

to_markdown(self) -> str
Get the Table as markdown.

FUNC transpose

transpose(self) -> Table | None
Transposes the table. Will return a new transposed Table if successful.

FUNC format_for_llm

format_for_llm(self) -> TemplateRepresentation | str
Return Table representation for Formatter.