fix: reset _default_converter on init failure (H5)

If the lazy-init of the default converter fails (e.g. model download
error), the singleton was left as None but subsequent calls would not
retry. Now the failed state is cleared so the next request retries.

Ref #57 (H5)
This commit is contained in:
Pier-Jean Malandrino 2026-04-07 14:41:20 +02:00
parent 4b1a15f49a
commit f89dc51661

View file

@ -118,7 +118,11 @@ def _build_docling_converter(options: ConversionOptions) -> DoclingConverter:
def _get_default_converter() -> DoclingConverter:
global _default_converter
if _default_converter is None:
_default_converter = _build_docling_converter(ConversionOptions())
try:
_default_converter = _build_docling_converter(ConversionOptions())
except Exception:
_default_converter = None
raise
return _default_converter