Skip to content

Commit 0de3b4f

Browse files
authored
fix: wire allow_custom_*_config flags from settings to DoclingConverterManagerConfig (#527)
Signed-off-by: Peter van Liesdonk <peter@liesdonk.nl>
1 parent be7ac72 commit 0de3b4f

File tree

5 files changed

+41
-0
lines changed

5 files changed

+41
-0
lines changed

docling_serve/__main__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,9 @@ def rq_worker() -> Any:
419419
options_cache_size=docling_serve_settings.options_cache_size,
420420
enable_remote_services=docling_serve_settings.enable_remote_services,
421421
allow_external_plugins=docling_serve_settings.allow_external_plugins,
422+
allow_custom_vlm_config=docling_serve_settings.allow_custom_vlm_config,
423+
allow_custom_picture_description_config=docling_serve_settings.allow_custom_picture_description_config,
424+
allow_custom_code_formula_config=docling_serve_settings.allow_custom_code_formula_config,
422425
max_num_pages=docling_serve_settings.max_num_pages,
423426
max_file_size=docling_serve_settings.max_file_size,
424427
queue_max_size=docling_serve_settings.queue_max_size,

docling_serve/orchestrator_factory.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,9 @@ def get_async_orchestrator() -> BaseOrchestrator:
400400
options_cache_size=docling_serve_settings.options_cache_size,
401401
enable_remote_services=docling_serve_settings.enable_remote_services,
402402
allow_external_plugins=docling_serve_settings.allow_external_plugins,
403+
allow_custom_vlm_config=docling_serve_settings.allow_custom_vlm_config,
404+
allow_custom_picture_description_config=docling_serve_settings.allow_custom_picture_description_config,
405+
allow_custom_code_formula_config=docling_serve_settings.allow_custom_code_formula_config,
403406
max_num_pages=docling_serve_settings.max_num_pages,
404407
max_file_size=docling_serve_settings.max_file_size,
405408
queue_max_size=docling_serve_settings.queue_max_size,

docling_serve/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ class DoclingServeSettings(BaseSettings):
5757
options_cache_size: int = 2
5858
enable_remote_services: bool = False
5959
allow_external_plugins: bool = False
60+
allow_custom_vlm_config: bool = False
61+
allow_custom_picture_description_config: bool = False
62+
allow_custom_code_formula_config: bool = False
6063
show_version_info: bool = True
6164
enable_management_endpoints: bool = False
6265

docs/configuration.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ THe following table describes the options to configure the Docling Serve app.
4444
| | `DOCLING_SERVE_SHOW_VERSION_INFO` | `true` | If enabled, the `/version` endpoint will provide the Docling package versions, otherwise it will return a forbidden 403 error. |
4545
| | `DOCLING_SERVE_ENABLE_REMOTE_SERVICES` | `false` | Allow pipeline components making remote connections. For example, this is needed when using a vision-language model via APIs. |
4646
| | `DOCLING_SERVE_ALLOW_EXTERNAL_PLUGINS` | `false` | Allow the selection of third-party plugins. |
47+
| | `DOCLING_SERVE_ALLOW_CUSTOM_VLM_CONFIG` | `false` | Allow users to specify a fully custom VLM pipeline configuration (`vlm_pipeline_custom_config`). When `false`, only presets are accepted. |
48+
| | `DOCLING_SERVE_ALLOW_CUSTOM_PICTURE_DESCRIPTION_CONFIG` | `false` | Allow users to specify a fully custom picture description configuration. When `false`, only presets are accepted. |
49+
| | `DOCLING_SERVE_ALLOW_CUSTOM_CODE_FORMULA_CONFIG` | `false` | Allow users to specify a fully custom code/formula configuration. When `false`, only presets are accepted. |
4750
| | `DOCLING_SERVE_SINGLE_USE_RESULTS` | `true` | If true, results can be accessed only once. If false, the results accumulate in the scratch directory. |
4851
| | `DOCLING_SERVE_RESULT_REMOVAL_DELAY` | `300` | When `DOCLING_SERVE_SINGLE_USE_RESULTS` is active, this is the delay before results are removed from the task registry. |
4952
| | `DOCLING_SERVE_MAX_DOCUMENT_TIMEOUT` | `604800` (7 days) | The maximum time for processing a document. |
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""Tests for allow_custom_*_config settings in docling-serve."""
2+
3+
from docling_serve.settings import DoclingServeSettings
4+
5+
6+
class TestAllowCustomConfigSettings:
7+
def test_allow_custom_vlm_config_defaults_false(self):
8+
settings = DoclingServeSettings()
9+
assert settings.allow_custom_vlm_config is False
10+
11+
def test_allow_custom_picture_description_config_defaults_false(self):
12+
settings = DoclingServeSettings()
13+
assert settings.allow_custom_picture_description_config is False
14+
15+
def test_allow_custom_code_formula_config_defaults_false(self):
16+
settings = DoclingServeSettings()
17+
assert settings.allow_custom_code_formula_config is False
18+
19+
def test_allow_custom_vlm_config_is_configurable(self):
20+
settings = DoclingServeSettings(allow_custom_vlm_config=True)
21+
assert settings.allow_custom_vlm_config is True
22+
23+
def test_allow_custom_picture_description_config_is_configurable(self):
24+
settings = DoclingServeSettings(allow_custom_picture_description_config=True)
25+
assert settings.allow_custom_picture_description_config is True
26+
27+
def test_allow_custom_code_formula_config_is_configurable(self):
28+
settings = DoclingServeSettings(allow_custom_code_formula_config=True)
29+
assert settings.allow_custom_code_formula_config is True

0 commit comments

Comments
 (0)