From 8ffcd767d9162c46095da589c4b7c94a88b6457b Mon Sep 17 00:00:00 2001 From: Luke Harrison Date: Mon, 6 Jan 2025 10:08:47 -0500 Subject: [PATCH] use pydantic to parse dict suggested by @dolfim-ibm Co-authored-by: Michele Dolfi <97102151+dolfim-ibm@users.noreply.github.com> Signed-off-by: Luke Harrison --- docling/cli/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docling/cli/main.py b/docling/cli/main.py index 32d57325..e1ce289e 100644 --- a/docling/cli/main.py +++ b/docling/cli/main.py @@ -286,7 +286,8 @@ def convert( parsed_headers: Optional[Dict[str, str]] = None if headers is not None: - parsed_headers = json.loads(headers) + headers_t = TypeAdapter(Dict[str, str]) + parsed_headers = headers_t.validate_json(headers) with tempfile.TemporaryDirectory() as tempdir: input_doc_paths: List[Path] = []