From 80e3ae0280fc50c30b34e016fd0bc516bfe989f8 Mon Sep 17 00:00:00 2001 From: Yiorgis Gozadinos Date: Thu, 21 May 2026 13:45:40 +0300 Subject: [PATCH] clean up deprecation warnings: docling annotations + haiku.skills 0.17.1 --- CHANGELOG.md | 3 +- .../haiku/rag/store/models/document_item.py | 12 +++---- haiku_rag_slim/pyproject.toml | 2 +- tests/test_converters.py | 31 +++++++------------ uv.lock | 8 ++--- 5 files changed, 22 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 122329db..9a0bb5c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/haiku_rag_slim/haiku/rag/store/models/document_item.py b/haiku_rag_slim/haiku/rag/store/models/document_item.py index 3daf3aed..f86080e7 100644 --- a/haiku_rag_slim/haiku/rag/store/models/document_item.py +++ b/haiku_rag_slim/haiku/rag/store/models/document_item.py @@ -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 diff --git a/haiku_rag_slim/pyproject.toml b/haiku_rag_slim/pyproject.toml index 545c1aaf..50c4600f 100644 --- a/haiku_rag_slim/pyproject.toml +++ b/haiku_rag_slim/pyproject.toml @@ -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", diff --git a/tests/test_converters.py b/tests/test_converters.py index 67cc4ce7..6dda3bb4 100644 --- a/tests/test_converters.py +++ b/tests/test_converters.py @@ -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" diff --git a/uv.lock b/uv.lock index 9282c378..d376f667 100644 --- a/uv.lock +++ b/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]]