Skip to content

feat: depend on docling-slim and convert sources locally or with a Docling service - #59

Merged
PeterStaar-IBM merged 2 commits into
mainfrom
feat/docling-slim
Oct 21, 2026
Merged

PeterStaar-IBM merged 2 commits into
mainfrom
feat/docling-slim

Conversation

@dolfim-ibm

Copy link
Copy Markdown
Member

Makes docling-agent installable and usable on top of docling-slim only, following the setup of docling-mcp: a light base install that converts with a Docling service, and an extra for local conversion.

Dependencies

Before After
base docling>=2.61.0 (PyTorch, layout and table models) docling-slim[service-client,format-html,format-markdown]~=2.140
local (new) docling-slim[standard]~=2.140: convert source files in-process
vlm docling[vlm]~=2.53 docling-slim[standard,models-vlm-inline]~=2.140: the DoclingExtractingAgent
evaluation metrics libraries + transformers>=5.4,<5.9 pin metrics libraries + docling-slim[standard,models-vlm-inline]

A clean install of docling-agent==0.6.0 takes 1.3 GB on macOS (with PyTorch; much more on Linux with the CUDA wheels). The base install of this branch takes 367 MB and imports all agents without PyTorch.

The minimum is docling-slim 2.140 because earlier versions import the PDF parsers (docling_parse, pypdfium2) as soon as DocumentConverter is imported, which the agents use to turn Markdown and HTML into DoclingDocuments. The transformers pin of evaluation is dropped: it was a workaround for docling-project/docling#4205, fixed in that release, and it conflicted with mlx-vlm on Apple Silicon.

Conversion of source files

New module docling_agent.conversion, used by the orchestrator (add mode and the tasks that ingest files):

  • LocalSourceConverter: the existing DocumentConverter with the fast / standard / expensive presets, moved out of the orchestrator.
  • RemoteSourceConverter: DoclingServiceClient with the same presets mapped to ConvertDocumentsOptions.
  • ConversionSettings, read from the environment or .env:
Variable Default
DOCLING_AGENT_CONVERSION_MODE auto remote, local, or auto: remote when a service URL is set, local otherwise
DOCLING_AGENT_SERVICE_URL Docling Serve endpoint
DOCLING_AGENT_SERVICE_API_KEY API key
DOCLING_AGENT_SERVICE_TIMEOUT 300 seconds

Using local conversion without the local extra, or the extracting agent without the vlm extra, raises an ImportError naming the extra to install. DocumentExtractor is now imported when the extracting agent is created (first commit), so importing the package no longer needs PyTorch.

Breaking change

Users who convert source files locally now need pip install 'docling-agent[local]' (or [vlm]). Without it, and without a service URL, ingestion fails with the message above. I used feat: rather than feat!:; happy to change it if you want a major bump.

Docs and CI

  • README: install extras and the conversion environment variables; notes on which examples need which extra. perfs/agentic_rag_eval_README.md points to the evaluation extra.
  • New CI job run-slim-tests: installs without extras, checks that PyTorch and the Docling models are absent, and runs the test suite.

Testing

  • All extras: ruff, mypy, pytest -m "not slow": 166 passed.
  • Base install only: 163 passed, 3 skipped (local conversion presets and the extracting agent, which need the extras).
  • New tests: tests/test_conversion.py (mode resolution, environment, remote preset mapping, missing URL, missing extra), tests/test_imports.py, and a test that the extracting agent names the vlm extra.
  • Manually, on the base install: an add task converted a PDF and a DOCX with Docling for IBM watsonx, the library recorded DoclingServiceClient:fast and the right MIME types, and PyTorch was never loaded. Without a service URL, the same task fails with the docling-agent[local] message.

Independent of #58 (editor outline).

Importing docling_agent loaded docling.document_extractor through the
extracting agent, which requires PyTorch and the VLM stack. Import it when
the agent is created, so the other agents can be imported without it.

Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
…cling service

The base install now depends on docling-slim with the service client and
the Markdown and HTML backends, instead of the full docling package. It
needs no PyTorch or local models.

- New `local` extra (docling-slim[standard]) for converting source files
  in-process; the `vlm` extra adds the VLM models for the extracting agent.
- New docling_agent.conversion module: the orchestrator converts sources
  with a local DocumentConverter or with DoclingServiceClient, chosen by
  DOCLING_AGENT_CONVERSION_MODE (auto, local, remote) and
  DOCLING_AGENT_SERVICE_URL / _API_KEY / _TIMEOUT. The fast, standard and
  expensive presets map to the same options in both modes.
- Clear errors naming the extra to install when local conversion or the
  extracting agent is used without it.
- Require docling-slim 2.140, whose DocumentConverter imports without the
  PDF parsers, and drop the transformers pin of the evaluation extra, as
  docling-project/docling#4205 is fixed there.
- CI runs the test suite on the base install as well.

Users who convert source files locally now install docling-agent[local].

Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
@mergify

mergify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 2 merge protections satisfied — ready to merge.

Show 2 satisfied protections

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

🟢 Require two reviewer for test updates

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 1

@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.75862% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
docling_agent/agent/orchestrator.py 27.77% 13 Missing ⚠️
docling_agent/conversion.py 92.47% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

@ceberam ceberam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@PeterStaar-IBM
PeterStaar-IBM merged commit c3e47bb into main Oct 21, 2026
12 checks passed
@PeterStaar-IBM
PeterStaar-IBM deleted the feat/docling-slim branch October 21, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants