mellea.stdlib.components.docs.document
Document component for grounding model inputs with text passages.
Document wraps a text passage with an optional title and doc_id, and
renders them inline as a formatted citation string for the model. Documents are
typically attached to a Message via its documents parameter, enabling
retrieval-augmented generation (RAG) workflows.
Classes
CLASS Document
A text passage with optional metadata for grounding model inputs.
Documents are typically attached to a Message via its documents
parameter to enable retrieval-augmented generation (RAG) workflows.
Args:
text: The text content of the document.title: An optional human-readable title for the document.doc_id: An optional unique identifier for the document.
Methods:
FUNC parts
parts(self) -> list[Component | CBlock]
Returns the constituent parts of this document.
Returns:
- list[Component | CBlock]: An empty list by default since the base
Documentclass has no constituent parts. Subclasses may override- this method to return meaningful parts.
FUNC format_for_llm
format_for_llm(self) -> TemplateRepresentation
Formats the Document as a TemplateRepresentation.
Returns: a TemplateRepresentation with text, title, and doc_id args.