StringConstraints() takes no arguments
Bug
I created a virtual environment and pip install docling. When I run the given example code, it failed and returned the above error.
from docling.document_converter import DocumentConverter
source = "https://arxiv.org/pdf/2408.09869" # file path or URL converter = DocumentConverter() doc = converter.convert(source).document
print(doc.export_to_markdown()) # output: "### Docling Technical Report[...]"
Hi @yiminl18! I'm Dosu and I’m helping the docling team.
The error happens because the installed version of Pydantic is too old—docling expects Pydantic v2 or higher, where StringConstraints is available and accepts arguments. In older versions, StringConstraints either doesn't exist or can't be called with arguments, which triggers this error when docling tries to validate fields like version in its data models (example).
To fix this, upgrade Pydantic in your environment:
pip install --upgrade pydantic
Then re-run your code. This should resolve the error and allow the example to work as intended.
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
Hi @yiminl18, dosubot suggested an answer above but there's been no confirmation either way. Did that resolve it for you, or should this stay open? If we don't hear back within a week, we'll close it. Feel free to reopen if you see a need.
Closing this issue because we did not hear back after our check-in on September 1. If it is still relevant for you, please reopen it or open a new issue with a current Docling version and a reproducer. Thanks!