Webhook icon
Schedule icon
Script icon
OutputValues icon
SlackIncomingWebhook icon

Multimodal Complex PDF and Table Parsing with Docling

Parse complex PDFs, extract tables, and isolate references into RAG chunks with IBM Docling in Kestra. Connect directly to vector databases and APIs.

Categories
AIData

Standard PDF parsers in RAG pipelines fail when processing real-world enterprise documents, such as financial statements, quarterly 10-K reports, legal contracts, and scientific papers. Common failure modes include garbled multi-column reading order, crushed tabular structures where numbers lose their corresponding row and column headers, and reference sections polluting semantic vector retrieval with irrelevant author bibliographies.

This blueprint implements an enterprise-grade document ingestion and multimodal layout parsing pipeline powered by IBM Docling. It provides configurable parsing toggles (TableFormer table recognition, deep learning OCR, reference decoupling, and hierarchical semantic chunking), generating clean, structured Markdown and JSON outputs ready for vector stores like Milvus, Qdrant, or Pinecone.

How it works

  1. Ingestion & Invocation: The flow receives document URIs via on-demand HTTP webhooks (on_demand_parsing_webhook), scheduled batch refresh schedules, or direct API execution.
  2. Configurable Multimodal Parsing: An isolated container runs the parsing engine with fine-grained parameter control:
    • Table Recognition (parse_tables): Toggles Docling's TableFormer deep learning model. When enabled, complex tables with merged cells and multiline headers are extracted into clean GitHub-flavored Markdown tables. When disabled, the engine bypasses table modeling for 5x-10x faster plain-text parsing.
    • Optical Character Recognition (enable_ocr): Toggles OCR for scanned documents or rasterized pages, while leaving native digital vector PDFs on the fast path.
    • Figure & Chart Extraction (extract_figures): Captures bounding boxes and captions for illustrations, charts, and equations.
    • Citation & Reference Decoupling (separate_references): Detects bibliography and reference sections, isolates them into a structured isolated_references.json array, and strips them from the main text body so vector embeddings are not polluted.
  3. Hierarchical Semantic Chunking: The parsed document Abstract Syntax Tree (AST) is segmented into token-bounded chunks (structured_chunks.json). Each chunk inherits its ancestral heading path (H1 > H2 > H3), ensuring that retrieval queries retain full structural context.
  4. Typed Downstream Outputs: The task outputs structured URIs for the generated chunks, isolated references, and clean markdown, alongside metadata metrics (tables_extracted, chunks_generated, references_isolated).
  5. Slack Notification: Posts an operational summary to #rag-ops detailing page count, extraction duration, and chunk totals.

What you get

  • High-Fidelity Table Extraction: Retains row and column relationships for complex financial, biomedical, and technical tables using TableFormer.
  • Clean Vector Embeddings: Isolating references prevents RAG models from matching queries against bibliography citations instead of factual answers.
  • Hierarchical Heading Context: Chunks preserve ancestral headings so embeddings understand exactly which section each paragraph or table belongs to.
  • Flexible Ingestion Modes: Switch easily between fast-path digital PDF parsing and deep OCR layout analysis.

Expected outputs

Downstream vector ingestion pipelines or microservices can consume the typed values emitted by output_parsing_metrics:

Output Variable Description Expression Example
document_title Extracted title of the parsed document {{ outputs.output_parsing_metrics.values.document_title }}
total_pages Total number of pages processed {{ outputs.output_parsing_metrics.values.total_pages }}
tables_extracted Total number of structured tables reconstructed {{ outputs.output_parsing_metrics.values.tables_extracted }}
references_isolated Count of bibliography entries decoupled from body text {{ outputs.output_parsing_metrics.values.references_isolated }}
chunks_generated Total number of hierarchical RAG chunks generated {{ outputs.output_parsing_metrics.values.chunks_generated }}
duration_seconds Total processing time in seconds {{ outputs.output_parsing_metrics.values.duration_seconds }}
chunks_file_uri Internal Kestra storage URI to structured_chunks.json {{ outputs.output_parsing_metrics.values.chunks_file_uri }}
references_file_uri Internal Kestra storage URI to isolated_references.json {{ outputs.output_parsing_metrics.values.references_file_uri }}
markdown_file_uri Internal Kestra storage URI to parsed_document.md {{ outputs.output_parsing_metrics.values.markdown_file_uri }}

Who it's for

  • AI & RAG Engineers building semantic search and question-answering systems over complex PDFs, research papers, and technical manuals.
  • Financial & Legal Analysts needing automated extraction of multi-column tables and balance sheets from SEC 10-K and 10-Q filings.
  • Data Platform Teams establishing centralized, scalable document ingestion microservices for enterprise knowledge bases.

Why orchestrate this with Kestra

Running multimodal models like Docling in ad-hoc Python scripts leads to memory leaks, container dependency conflicts, and unmonitored failures. Kestra delivers:

  • Isolated Execution Environments: Runs Docling in self-contained Docker containers with dedicated memory and GPU resources.
  • Modular Microservice Invocation: Trigger parsing from external Python, TypeScript, or Go codebases via REST APIs, Webhooks, or native Subflows.
  • Artifact Lineage & Storage: Persists raw PDFs, parsed markdown, extracted tables, and chunk metadata with automated retention policies and cryptographic hashes.

Prerequisites

  • Kestra runner with Docker or Kubernetes access to pull container images.
  • An incoming Slack webhook URL for operational notifications.

Secrets

Configure the following secrets in your Kestra namespace or instance settings:

Secret Name Description Example
SLACK_WEBHOOK_URL Incoming webhook URL for RAG ops alerts https://hooks.slack.com/services/T00/B00/X00
WEBHOOK_KEY Secret authentication key for triggering document parsing via webhook whk_docling_secure_99182

Quick start

  1. Import this blueprint into your Kestra instance under the company.ai namespace.
  2. Add SLACK_WEBHOOK_URL and WEBHOOK_KEY in Settings > Secrets.
  3. Click Execute with default parameters to parse the sample research paper and review the generated chunks.
  4. Connect your backend application or S3 ingestion pipeline to the webhook endpoint.

Common pitfalls & notes

  • Table Recognition Overhead: TableFormer runs deep vision-transformer models. If your corpus consists primarily of narrative text without tables, set parse_tables: false to reduce processing time significantly.
  • Reference Pollution: Keep separate_references: true enabled for RAG workflows. Citations like [1] Smith et al. can cause vector retrieval models to match query terms to author names instead of actual factual content.
  • OCR Selection: Enable enable_ocr: true only for scanned documents; digital vector PDFs already contain selectable text and do not require OCR.

How to extend

  • Vector Database Ingestion: Chain downstream Kestra tasks to load structured_chunks.json directly into Milvus (io.kestra.plugin.milvus), Qdrant, or Pinecone.
  • Embedding Generation: Add a task invoking OpenAI text-embedding-3-large or HuggingFace BGE models to embed chunks before indexing.
  • Multi-Modal Vision Inspection: Pass extracted figure bounding boxes to vision LLMs (e.g., Gemini 1.5 Pro or GPT-4o) to generate rich text descriptions of complex diagrams.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.