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.
FUNC parts
- 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
Document into a string.
Returns: a string