diff --git a/docling_serve/__main__.py b/docling_serve/__main__.py index 74b4f30..70d19fd 100644 --- a/docling_serve/__main__.py +++ b/docling_serve/__main__.py @@ -419,6 +419,9 @@ def rq_worker() -> Any: options_cache_size=docling_serve_settings.options_cache_size, enable_remote_services=docling_serve_settings.enable_remote_services, allow_external_plugins=docling_serve_settings.allow_external_plugins, + allow_custom_vlm_config=docling_serve_settings.allow_custom_vlm_config, + allow_custom_picture_description_config=docling_serve_settings.allow_custom_picture_description_config, + allow_custom_code_formula_config=docling_serve_settings.allow_custom_code_formula_config, max_num_pages=docling_serve_settings.max_num_pages, max_file_size=docling_serve_settings.max_file_size, queue_max_size=docling_serve_settings.queue_max_size, diff --git a/docling_serve/orchestrator_factory.py b/docling_serve/orchestrator_factory.py index f9a1cbd..373e128 100644 --- a/docling_serve/orchestrator_factory.py +++ b/docling_serve/orchestrator_factory.py @@ -400,6 +400,9 @@ def get_async_orchestrator() -> BaseOrchestrator: options_cache_size=docling_serve_settings.options_cache_size, enable_remote_services=docling_serve_settings.enable_remote_services, allow_external_plugins=docling_serve_settings.allow_external_plugins, + allow_custom_vlm_config=docling_serve_settings.allow_custom_vlm_config, + allow_custom_picture_description_config=docling_serve_settings.allow_custom_picture_description_config, + allow_custom_code_formula_config=docling_serve_settings.allow_custom_code_formula_config, max_num_pages=docling_serve_settings.max_num_pages, max_file_size=docling_serve_settings.max_file_size, queue_max_size=docling_serve_settings.queue_max_size, diff --git a/docling_serve/settings.py b/docling_serve/settings.py index 936a419..d28087c 100644 --- a/docling_serve/settings.py +++ b/docling_serve/settings.py @@ -57,6 +57,9 @@ class DoclingServeSettings(BaseSettings): options_cache_size: int = 2 enable_remote_services: bool = False allow_external_plugins: bool = False + allow_custom_vlm_config: bool = False + allow_custom_picture_description_config: bool = False + allow_custom_code_formula_config: bool = False show_version_info: bool = True enable_management_endpoints: bool = False diff --git a/docs/configuration.md b/docs/configuration.md index cd2951f..39c35e8 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -44,6 +44,9 @@ THe following table describes the options to configure the Docling Serve app. | | `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. | | | `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. | | | `DOCLING_SERVE_ALLOW_EXTERNAL_PLUGINS` | `false` | Allow the selection of third-party plugins. | +| | `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. | +| | `DOCLING_SERVE_ALLOW_CUSTOM_PICTURE_DESCRIPTION_CONFIG` | `false` | Allow users to specify a fully custom picture description configuration. When `false`, only presets are accepted. | +| | `DOCLING_SERVE_ALLOW_CUSTOM_CODE_FORMULA_CONFIG` | `false` | Allow users to specify a fully custom code/formula configuration. When `false`, only presets are accepted. | | | `DOCLING_SERVE_SINGLE_USE_RESULTS` | `true` | If true, results can be accessed only once. If false, the results accumulate in the scratch directory. | | | `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. | | | `DOCLING_SERVE_MAX_DOCUMENT_TIMEOUT` | `604800` (7 days) | The maximum time for processing a document. | diff --git a/tests/test_allow_custom_config_settings.py b/tests/test_allow_custom_config_settings.py new file mode 100644 index 0000000..335b4aa --- /dev/null +++ b/tests/test_allow_custom_config_settings.py @@ -0,0 +1,29 @@ +"""Tests for allow_custom_*_config settings in docling-serve.""" + +from docling_serve.settings import DoclingServeSettings + + +class TestAllowCustomConfigSettings: + def test_allow_custom_vlm_config_defaults_false(self): + settings = DoclingServeSettings() + assert settings.allow_custom_vlm_config is False + + def test_allow_custom_picture_description_config_defaults_false(self): + settings = DoclingServeSettings() + assert settings.allow_custom_picture_description_config is False + + def test_allow_custom_code_formula_config_defaults_false(self): + settings = DoclingServeSettings() + assert settings.allow_custom_code_formula_config is False + + def test_allow_custom_vlm_config_is_configurable(self): + settings = DoclingServeSettings(allow_custom_vlm_config=True) + assert settings.allow_custom_vlm_config is True + + def test_allow_custom_picture_description_config_is_configurable(self): + settings = DoclingServeSettings(allow_custom_picture_description_config=True) + assert settings.allow_custom_picture_description_config is True + + def test_allow_custom_code_formula_config_is_configurable(self): + settings = DoclingServeSettings(allow_custom_code_formula_config=True) + assert settings.allow_custom_code_formula_config is True