Skip to content

fix: wire allow_custom_*_config flags from settings to DoclingConverterManagerConfig#527

Merged
dolfim-ibm merged 1 commit intodocling-project:mainfrom
pvliesdonk:fix/wire-allow-custom-config-env-vars
Mar 2, 2026
Merged

fix: wire allow_custom_*_config flags from settings to DoclingConverterManagerConfig#527
dolfim-ibm merged 1 commit intodocling-project:mainfrom
pvliesdonk:fix/wire-allow-custom-config-env-vars

Conversation

@pvliesdonk
Copy link
Contributor

vlm_pipeline_custom_config (and its picture-description and code/formula siblings) always raises a 422 error claiming custom configuration is not allowed, even when an administrator intends to permit it. There is no environment variable that actually enables these features.

Root cause: DoclingConverterManagerConfig in docling-jobkit has three admin-facing flags:

  • allow_custom_vlm_config (default False)
  • allow_custom_picture_description_config (default False)
  • allow_custom_code_formula_config (default False)

Neither instantiation site in docling-serve (orchestrator_factory.py, __main__.py) passes these flags, so they are permanently False regardless of any environment variable.

Fix: Add the three fields to DoclingServeSettings, which pydantic-settings maps to env vars automatically:

  • DOCLING_SERVE_ALLOW_CUSTOM_VLM_CONFIG
  • DOCLING_SERVE_ALLOW_CUSTOM_PICTURE_DESCRIPTION_CONFIG
  • DOCLING_SERVE_ALLOW_CUSTOM_CODE_FORMULA_CONFIG

Then pass them through in both DoclingConverterManagerConfig instantiation sites. This follows the identical pattern established for allow_external_plugins in #328.

Also updates docs/configuration.md to document the three new env vars.

Issue resolved by this Pull Request:
Resolves #526

…erManagerConfig

The `allow_custom_vlm_config`, `allow_custom_picture_description_config`,
and `allow_custom_code_formula_config` flags exist in docling-jobkit's
`DoclingConverterManagerConfig` but were never exposed in docling-serve.
As a result, `vlm_pipeline_custom_config` (and its siblings) always raised
a 422 error regardless of any env var an administrator set.

Add the three fields to `DoclingServeSettings`, wired via pydantic-settings to:
- `DOCLING_SERVE_ALLOW_CUSTOM_VLM_CONFIG`
- `DOCLING_SERVE_ALLOW_CUSTOM_PICTURE_DESCRIPTION_CONFIG`
- `DOCLING_SERVE_ALLOW_CUSTOM_CODE_FORMULA_CONFIG`

Pass the fields through in both `DoclingConverterManagerConfig` instantiation
sites (`orchestrator_factory.py` and `__main__.py`), following the same
pattern established for `allow_external_plugins` in docling-project#328.

Update `docs/configuration.md` to document the three new env vars.

Resolves docling-project#526

Signed-off-by: Peter van Liesdonk <peter@liesdonk.nl>
@github-actions
Copy link
Contributor

DCO Check Passed

Thanks @pvliesdonk, all your commits are properly signed off. 🎉

@mergify
Copy link

mergify bot commented Feb 28, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

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)(?:\(.+\))?(!)?:

@dosubot
Copy link

dosubot bot commented Feb 28, 2026

Documentation Updates

2 document(s) were updated by changes in this PR:

How can I use Docling's REST API to convert a PDF from a URL to Markdown with OpenAI-generated image descriptions, and is base64 encoding required for URL sources?
View Changes
@@ -14,7 +14,7 @@
 | `to_formats` | list | Output formats. Example: `["md"]`. |
 | `do_picture_description` | bool | If enabled, describe pictures in documents. Boolean. Optional, defaults to false. |
 | `picture_description_preset` | str or null | Preset ID for picture description. Recommended for most users. |
-| `picture_description_custom_config` | dict or null | Custom configuration for picture description (advanced). **Requires administrator permission** - see note below. |
+| `picture_description_custom_config` | dict or null | Custom configuration for picture description (advanced). **Requires administrator permission** - see note above. |
 | `picture_description_api` | dict or null | **DEPRECATED**: API details for using a vision-language model in the picture description. Please migrate to `picture_description_preset` or `picture_description_custom_config`. |
 | `picture_description_area_threshold` | float | Minimum percentage of the area for a picture to be processed with the models. |
 | `image_alt_mode` | str | Controls how alt text is generated for images: `static`, `caption`, or `description`. |
How can you use Docling's REST API to convert a PDF to Markdown and generate image descriptions using an OpenAI model?
View Changes
@@ -78,12 +78,12 @@
 > 
 > Custom configuration parameters require administrator permission to use. By default, these features are disabled for security reasons.
 > 
-> **To enable custom configurations, your administrator must set:**
-> - `DOCLING_SERVE_ALLOW_CUSTOM_PICTURE_DESCRIPTION_CONFIG=true` for custom picture description configs
-> - `DOCLING_SERVE_ALLOW_CUSTOM_VLM_CONFIG=true` for custom VLM pipeline configs  
-> - `DOCLING_SERVE_ALLOW_CUSTOM_CODE_FORMULA_CONFIG=true` for custom code/formula configs
+> **To enable custom configurations, your administrator must set these environment variables:**
+> - `DOCLING_SERVE_ALLOW_CUSTOM_PICTURE_DESCRIPTION_CONFIG=true` — Enables `picture_description_custom_config`
+> - `DOCLING_SERVE_ALLOW_CUSTOM_VLM_CONFIG=true` — Enables `vlm_pipeline_custom_config`
+> - `DOCLING_SERVE_ALLOW_CUSTOM_CODE_FORMULA_CONFIG=true` — Enables `code_formula_custom_config`
 > 
-> If these environment variables are not enabled, attempting to use `picture_description_custom_config`, `vlm_pipeline_custom_config`, or `code_formula_custom_config` will result in a **422 error**.
+> When set to `false` (the default), only presets are accepted. If these environment variables are not enabled, attempting to use the respective custom configuration parameters will result in a **422 error**.
 > 
 > **Contact your Docling Serve administrator if you need access to custom configuration options.**
 

How did I do? Any feedback?  Join Discord

Copy link
Member

@dolfim-ibm dolfim-ibm left a comment

Choose a reason for hiding this comment

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

lgtm

@dolfim-ibm dolfim-ibm merged commit 0de3b4f into docling-project:main Mar 2, 2026
13 of 17 checks passed
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.

bug: allow_custom_vlm_config (and sibling flags) never wired from docling-serve settings to DoclingConverterManagerConfig

2 participants