dllmforge.IE_agent_extractor_docling¶
Synchronous Information Extractor using Docling as a structured document front-end.
Docling serializes PDFs in reading order (sections, markdown tables, figure captions) with [PAGE N] tags. The LLM extracts against a Pydantic schema; source_page is recovered from source_quote via IE_agent_provenance.
Functions
|
Turn a Docling document into tagged markdown plus an element index. |
Classes
|
Document processor using Docling for advanced PDF processing |
|
Extract structured information from Docling-preprocessed documents using an LLM. |
|
Class representing a document processed by Docling |
|
Class representing a chunk of document content |
|
Fallback stub used when the real docling package isn't available. |
- class dllmforge.IE_agent_extractor_docling.DocumentConverter(*args, **kwargs)[source]¶
Fallback stub used when the real docling package isn’t available.
- dllmforge.IE_agent_extractor_docling.serialize_docling_document(document: Any) Tuple[str, List[Dict[str, Any]], Dict[str, Any]][source]¶
Turn a Docling document into tagged markdown plus an element index.
Returns (markdown, element_index, stats).
- class dllmforge.IE_agent_extractor_docling.DoclingProcessedDocument(content: str | bytes | list, content_type: str, metadata: Dict[str, Any] | None = None, docling_result=None)[source]¶
Class representing a document processed by Docling
- class dllmforge.IE_agent_extractor_docling.DocumentChunk(content: str | bytes, content_type: str, metadata: Dict[str, Any] | None = None, docling_elements: List | None = None)[source]¶
Class representing a chunk of document content
- class dllmforge.IE_agent_extractor_docling.DoclingDocumentProcessor(config: Any = None, input_dir: str | Path | None = None, file_pattern: str | None = None, output_dir: str | Path | None = None)[source]¶
Document processor using Docling for advanced PDF processing
- __init__(config: Any = None, input_dir: str | Path | None = None, file_pattern: str | None = None, output_dir: str | Path | None = None)[source]¶
- process_document(file_path: Path) DoclingProcessedDocument | None[source]¶
Process a single document using Docling into tagged markdown.
- process_directory() List[DoclingProcessedDocument][source]¶
Process all documents in the configured directory
- class dllmforge.IE_agent_extractor_docling.DoclingInfoExtractor(config: IEAgentConfig | None = None, output_schema: type[BaseModel] | None = None, llm_api: LangchainAPI | None = None, system_prompt: str | None = None, chunk_size: int | None = None, chunk_overlap: int | None = None, doc_processor: DoclingDocumentProcessor | None = None, use_vision: bool = False)[source]¶
Extract structured information from Docling-preprocessed documents using an LLM.
Initialize the information extractor.
Pass
config(IEAgentConfig) for the original path, or the same plain arguments as InfoExtractor. Direct mode does not callrefine_system_prompt.- __init__(config: IEAgentConfig | None = None, output_schema: type[BaseModel] | None = None, llm_api: LangchainAPI | None = None, system_prompt: str | None = None, chunk_size: int | None = None, chunk_overlap: int | None = None, doc_processor: DoclingDocumentProcessor | None = None, use_vision: bool = False)[source]¶
Initialize the information extractor.
Pass
config(IEAgentConfig) for the original path, or the same plain arguments as InfoExtractor. Direct mode does not callrefine_system_prompt.
- refine_system_prompt(task_description: str) str[source]¶
Use LLM to refine user’s task description into a proper system prompt
- chunk_document(doc: DoclingProcessedDocument) Generator[DocumentChunk, None, None][source]¶
Split on section/table/page tags when the document exceeds chunk_size.
- create_text_extraction_prompt() ChatPromptTemplate[source]¶
Create prompt template for text-based information extraction with Docling awareness
- process_text_chunk(chunk: DocumentChunk) Dict[str, Any] | None[source]¶
Process a text document chunk with Docling enhancements
- create_multimodal_extraction_prompt() ChatPromptTemplate[source]¶
Create prompt template for multimodal extraction with Docling structure
- process_multimodal_chunk(chunk: DocumentChunk, doc: DoclingProcessedDocument) Dict[str, Any] | None[source]¶
Attach only figures whose page appears in this chunk’s [PAGE N] tags.
- process_chunk(chunk: DocumentChunk, doc: DoclingProcessedDocument) Dict[str, Any] | None[source]¶
Process a document chunk with Docling context (text by default).
- process_document(doc: DoclingProcessedDocument | List[DoclingProcessedDocument]) List[Dict[str, Any]][source]¶
Process document, recover source_page from quotes, merge processor metadata.