Coverage for src/qdrant_loader/core/chunking/docling/outcome.py: 100%
9 statements
« prev ^ index » next coverage.py v7.15.0, created at 2026-07-20 10:15 +0000
« prev ^ index » next coverage.py v7.15.0, created at 2026-07-20 10:15 +0000
1"""The chunker -> mapper handoff type.
3A :class:`Chunk` is the engine-neutral unit the chunker emits: the body text, the
4heading-contextualised text that will actually be embedded, and the
5projected :class:`~.structure.ChunkStructure`. It is the contract boundary between
6the docling-touching :mod:`.docling_chunker` and the docling-free :mod:`.mapper`
7that turns chunks into qdrant-loader ``Document`` chunks — so the mapper, and its
8tests, never need docling.
9"""
11from __future__ import annotations
13from dataclasses import dataclass
15from .structure import ChunkStructure
18@dataclass(frozen=True, slots=True)
19class Chunk:
20 """One chunk, before projection into the qdrant-loader ``Document`` contract."""
22 text: str # the chunk body — docling DocChunk.text
23 # contextualize() output. Contextual embedding is NOT YET IMPLEMENTED, so this
24 # mirrors text while the toggle is off; it is the carrier for when it lands.
25 embed_text: str
26 structure: ChunkStructure
27 token_count: int | None = None # tokens in embed_text — drives the budget check