Repository navigation
feat: depend on docling-slim and convert sources locally or with a Docling service - #59
Merged
Merged
Conversation
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>
Contributor
Merge Protections🟢 All 2 merge protections satisfied — ready to merge. Show 2 satisfied protections🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 Require two reviewer for test updatesWhen test data is updated, we require two reviewers
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
PeterStaar-IBM
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes
docling-agentinstallable and usable on top ofdocling-slimonly, following the setup of docling-mcp: a light base install that converts with a Docling service, and an extra for local conversion.Dependencies
docling>=2.61.0(PyTorch, layout and table models)docling-slim[service-client,format-html,format-markdown]~=2.140local(new)docling-slim[standard]~=2.140: convert source files in-processvlmdocling[vlm]~=2.53docling-slim[standard,models-vlm-inline]~=2.140: theDoclingExtractingAgentevaluationtransformers>=5.4,<5.9pindocling-slim[standard,models-vlm-inline]A clean install of
docling-agent==0.6.0takes 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 asDocumentConverteris imported, which the agents use to turn Markdown and HTML intoDoclingDocuments. Thetransformerspin ofevaluationis dropped: it was a workaround for docling-project/docling#4205, fixed in that release, and it conflicted withmlx-vlmon Apple Silicon.Conversion of source files
New module
docling_agent.conversion, used by the orchestrator (addmode and the tasks that ingest files):LocalSourceConverter: the existingDocumentConverterwith thefast/standard/expensivepresets, moved out of the orchestrator.RemoteSourceConverter:DoclingServiceClientwith the same presets mapped toConvertDocumentsOptions.ConversionSettings, read from the environment or.env:DOCLING_AGENT_CONVERSION_MODEautoremote,local, orauto: remote when a service URL is set, local otherwiseDOCLING_AGENT_SERVICE_URLDOCLING_AGENT_SERVICE_API_KEYDOCLING_AGENT_SERVICE_TIMEOUT300Using local conversion without the
localextra, or the extracting agent without thevlmextra, raises anImportErrornaming the extra to install.DocumentExtractoris 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 usedfeat:rather thanfeat!:; happy to change it if you want a major bump.Docs and CI
perfs/agentic_rag_eval_README.mdpoints to theevaluationextra.run-slim-tests: installs without extras, checks that PyTorch and the Docling models are absent, and runs the test suite.Testing
ruff,mypy,pytest -m "not slow": 166 passed.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 thevlmextra.addtask converted a PDF and a DOCX with Docling for IBM watsonx, the library recordedDoclingServiceClient:fastand the right MIME types, and PyTorch was never loaded. Without a service URL, the same task fails with thedocling-agent[local]message.Independent of #58 (editor outline).