clean up deprecation warnings: docling annotations + haiku.skills 0.17.1
This commit is contained in:
parent
392c74039b
commit
80e3ae0280
5 changed files with 22 additions and 34 deletions
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
### Changed
|
||||
|
||||
- Bump `haiku.skills>=0.17.0` and `pydantic-ai-slim>=1.100.0` (the last pre-2.0 release). Migrate off two APIs slated for removal in pydantic-ai 2.0: `Agent(tool_retries=, output_retries=)` → `Agent(retries={"tools": …, "output": …})` in the LLM-as-judge evaluator, and `Evaluator.evaluation_name` class attribute → overriding `get_default_evaluation_name()` on `CitationMRREvaluator` / `CitationMAPEvaluator`.
|
||||
- Bump `haiku.skills>=0.17.1` and `pydantic-ai-slim>=1.100.0` (the last pre-2.0 release). Migrate off two APIs slated for removal in pydantic-ai 2.0: `Agent(tool_retries=, output_retries=)` → `Agent(retries={"tools": …, "output": …})` in the LLM-as-judge evaluator, and `Evaluator.evaluation_name` class attribute → overriding `get_default_evaluation_name()` on `CitationMRREvaluator` / `CitationMAPEvaluator`.
|
||||
- Drop the `item.annotations` fallback in `_picture_description_text`. Docling's `PictureItem` runs a `@model_validator(mode="after")` on load that migrates the deprecated `annotations` field into `meta.description`, so reading `meta.description.text` covers both legacy and current blobs. Tests in `test_converters.py` switched to `meta.description.text` for the same reason.
|
||||
- Documentation generator swapped from `mkdocs-material` to `zensical`. Drops `mkdocs` / `mkdocs-material` dev deps, replaces `mkdocs.yml` with `zensical.toml`, adds `overrides/main.html` (OG/Twitter share meta) and `docs/stylesheets/extra.css`. `build-docs` workflow now runs `uv run zensical build` and publishes via the GitHub Pages artifact actions instead of `mkdocs gh-deploy`.
|
||||
|
||||
### Fixed
|
||||
|
|
|
|||
|
|
@ -25,19 +25,15 @@ class DocumentItem(BaseModel):
|
|||
def _picture_description_text(item: "PictureItem") -> str | None:
|
||||
"""Return the VLM-generated description text for a PictureItem, if any.
|
||||
|
||||
Tries the modern ``meta.description`` location first (docling 2.91+) and
|
||||
falls back to ``annotations`` entries that carry a ``text`` field
|
||||
(PictureDescriptionData and similar).
|
||||
Reads ``meta.description.text``. Pre-2.91 blobs that stored the
|
||||
description under the deprecated ``annotations`` field are migrated to
|
||||
``meta`` by ``PictureItem``'s own ``@model_validator(mode="after")`` at
|
||||
load time, so this single check covers both formats.
|
||||
"""
|
||||
if item.meta and item.meta.description:
|
||||
text = item.meta.description.text
|
||||
if text and text.strip():
|
||||
return text
|
||||
# Annotations is a tagged union; only some variants carry `text`.
|
||||
for ann in item.annotations:
|
||||
text = getattr(ann, "text", None)
|
||||
if isinstance(text, str) and text.strip():
|
||||
return text
|
||||
return None
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ classifiers = [
|
|||
|
||||
dependencies = [
|
||||
"docling-core>=2.75.0",
|
||||
"haiku.skills>=0.17.0",
|
||||
"haiku.skills>=0.17.1",
|
||||
"httpx>=0.28.1",
|
||||
"jinja2>=3.1.0",
|
||||
"jsonpatch>=1.33",
|
||||
|
|
|
|||
|
|
@ -829,19 +829,14 @@ class TestDoclingLocalConverter:
|
|||
# The document should have pictures with descriptions
|
||||
assert doc.pictures, "Document should have pictures"
|
||||
|
||||
# Check that at least one picture has a description annotation
|
||||
from docling_core.types.doc.document import PictureDescriptionData
|
||||
|
||||
# Check that at least one picture carries a VLM description.
|
||||
pictures_with_descriptions = []
|
||||
for pic in doc.pictures:
|
||||
for ann in pic.annotations:
|
||||
if isinstance(ann, PictureDescriptionData):
|
||||
pictures_with_descriptions.append(pic)
|
||||
# Description should appear in markdown output
|
||||
assert ann.text in markdown, (
|
||||
f"Picture description '{ann.text[:50]}...' should be in markdown"
|
||||
)
|
||||
break
|
||||
if pic.meta and pic.meta.description and pic.meta.description.text:
|
||||
pictures_with_descriptions.append(pic)
|
||||
assert pic.meta.description.text in markdown, (
|
||||
f"Picture description '{pic.meta.description.text[:50]}...' should be in markdown"
|
||||
)
|
||||
|
||||
assert pictures_with_descriptions, (
|
||||
"At least one picture should have a VLM description"
|
||||
|
|
@ -1349,18 +1344,14 @@ class TestDoclingServeConverterIntegration:
|
|||
|
||||
assert doc.pictures, "Document should have pictures"
|
||||
|
||||
from docling_core.types.doc.document import PictureDescriptionData
|
||||
|
||||
pictures_with_descriptions = []
|
||||
markdown = doc.export_to_markdown()
|
||||
for pic in doc.pictures:
|
||||
for ann in pic.annotations:
|
||||
if isinstance(ann, PictureDescriptionData):
|
||||
pictures_with_descriptions.append(pic)
|
||||
assert ann.text in markdown, (
|
||||
f"Picture description '{ann.text[:50]}...' should be in markdown"
|
||||
)
|
||||
break
|
||||
if pic.meta and pic.meta.description and pic.meta.description.text:
|
||||
pictures_with_descriptions.append(pic)
|
||||
assert pic.meta.description.text in markdown, (
|
||||
f"Picture description '{pic.meta.description.text[:50]}...' should be in markdown"
|
||||
)
|
||||
|
||||
assert pictures_with_descriptions, (
|
||||
"At least one picture should have a VLM description"
|
||||
|
|
|
|||
8
uv.lock
8
uv.lock
|
|
@ -1599,7 +1599,7 @@ requires-dist = [
|
|||
{ name = "cohere", marker = "extra == 'cohere'", specifier = ">=5.21.1" },
|
||||
{ name = "docling", marker = "extra == 'docling'", specifier = ">=2.93.0" },
|
||||
{ name = "docling-core", specifier = ">=2.75.0" },
|
||||
{ name = "haiku-skills", specifier = ">=0.17.0" },
|
||||
{ name = "haiku-skills", specifier = ">=0.17.1" },
|
||||
{ name = "httpx", specifier = ">=0.28.1" },
|
||||
{ name = "jinja2", specifier = ">=3.1.0" },
|
||||
{ name = "jsonpatch", specifier = ">=1.33" },
|
||||
|
|
@ -1638,7 +1638,7 @@ provides-extras = ["docling", "s3", "voyageai", "mxbai", "cohere", "zeroentropy"
|
|||
|
||||
[[package]]
|
||||
name = "haiku-skills"
|
||||
version = "0.17.0"
|
||||
version = "0.17.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "ag-ui-protocol" },
|
||||
|
|
@ -1648,9 +1648,9 @@ dependencies = [
|
|||
{ name = "pyyaml" },
|
||||
{ name = "skills-ref" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/2f/e2/f96659f7fddbd6209934eb4b69c78b611f4a2890c8a76735c065d5b0aa12/haiku_skills-0.17.0.tar.gz", hash = "sha256:16cccdf5efa74085bd063271ae653d049bb5ea814d92a29c231343a8807cbaea", size = 187886, upload-time = "2026-05-21T09:38:51.411Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/01/90/7eb6c20aada4e861589ecc300bcf5c827335d803c4e225a79b0924dd9793/haiku_skills-0.17.1.tar.gz", hash = "sha256:062385ae67f61e37a9790721da50f7b38ed0b903e9a8efb2bd76b4b9fcf94651", size = 187965, upload-time = "2026-05-21T10:37:45.242Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/71/d2/6a2012bf23e870bfd73c1ef5dda308f408347bc60a81968ea0404477f34d/haiku_skills-0.17.0-py3-none-any.whl", hash = "sha256:4f8865e594d5c39bb1dcb3521eca2188f252a7fc1a7fbea0db6e3649d6185caf", size = 32972, upload-time = "2026-05-21T09:38:49.851Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c9/86/ff441d3c5fba2e66d29c135659d536dd47a5e920e4b351c9621a89599510/haiku_skills-0.17.1-py3-none-any.whl", hash = "sha256:7bdcafc5f184bb765eb9c86e0147d535272dc42c1dc8cef4ce1a4d1464376ff0", size = 32965, upload-time = "2026-05-21T10:37:44.192Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
Loading…
Reference in a new issue