Version: 0.0.5 (stable)
agrag.common.data_models.document.DocumentSection
Bases: BaseModel
One heading of a document and the content directly under it.
Sections are in reading order. A section has no text of its own: the units hold it. Content before the first heading, or in a document with no headings, goes in a section with an empty heading.
Attributes:
- heading (
str) – The heading text. Empty for a section made for content that has no heading. - depth (
int) – The heading depth. A top-level heading has depth 1. A document title or a section made for content with no heading has depth 0. - parent (
int | None) – The positional index inDocument.sectionsof the section that contains this one.Nonefor a section that sits directly under the document. The index must come before this section, and the parent must be shallower. Always an int index, never a key or id. - source_id (
str | None) – The id of the source record, such as a chat message id. - units (
list[Unit]) – The content directly under the heading, in reading order.
depth
depth: int = Field(ge=0)
heading
heading: str
parent
parent: int | None = None
source_id
source_id: str | None = None
units
units: list[Unit] = Field(default_factory=list)