Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docling/backend/abstract_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def unload(self):
def supported_formats(cls) -> Set["InputFormat"]:
pass

@abstractmethod
Copy link
Contributor

@cau-git cau-git Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This @abstractmethod tag should not be necessary since you are providing a default implementation.

def extract_metadata(self) -> Dict[str, Any]:
return {}


class PaginatedDocumentBackend(AbstractDocumentBackend):
"""DeclarativeDocumentBackend.
Expand Down
4 changes: 4 additions & 0 deletions docling/backend/xml/uspto_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ def convert(self) -> DoclingDocument:
f"Cannot convert doc (hash={self.document_hash}, "
f"name={self.file.name}) because the backend failed to init."
)

@override
def extract_metadata(self) -> Dict[str, Any]:
return {}


class PatentUspto(ABC):
Expand Down
1 change: 1 addition & 0 deletions docling/datamodel/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class ConversionResult(BaseModel):
confidence: ConfidenceReport = Field(default_factory=ConfidenceReport)

document: DoclingDocument = _EMPTY_DOCLING_DOC
metadata: Dict[str, Any] = {}

@property
@deprecated("Use document instead.")
Expand Down
1 change: 1 addition & 0 deletions docling/pipeline/simple_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def _build_document(self, conv_res: ConversionResult) -> ConversionResult:
# a DoclingDocument straight.
with TimeRecorder(conv_res, "doc_build", scope=ProfilingScope.DOCUMENT):
conv_res.document = conv_res.input._backend.convert()
conv_res.metadata = conv_res.input._backend.extract_metadata()
return conv_res

def _determine_status(self, conv_res: ConversionResult) -> ConversionStatus:
Expand Down
Loading