document.ChunkedMarkdownDocument

A Markdown document with an attached sequence of chunks.

Usage

Source

document.ChunkedMarkdownDocument(
    content, origin=None, attributes=None, *, chunks
)

This is the chunked form of MarkdownDocument, combining its Markdown source tracking with the chunks of a ChunkedDocument. It is what MarkdownChunker.chunk() returns, and what you pass to a store’s upsert(). Like ChunkedDocument, it can be iterated, sized with len(), and indexed to reach its chunks.

Parameters

content: str

The Markdown text of the document.

origin: Optional[str] = None

Where the content came from (a URL or file path), used for citation and provenance. Stores require a populated origin at upsert time.

attributes: Optional[dict[str, Any]] = None

Optional user-defined attributes applied at insertion time. Chunks can inherit them, and they are returned during retrieval for filtering and downstream prompt/context use.

chunks: list[Chunk]
The chunks produced from this document’s content, in document order.

Methods

Name Description
from_any() Convert any chunked document-like object to a ChunkedMarkdownDocument.

from_any()

Convert any chunked document-like object to a ChunkedMarkdownDocument.

Usage

Source

from_any(doc, origin=None)

Use MarkdownDocument.from_any() for unchunked inputs.