class langchain_core.documents.base.Document[source]

Bases: Serializable

Class for storing a piece of text and associated metadata.


from langchain_core.documents import Document

document = Document(
    page_content="Hello, world!",
    metadata={"source": ""}

Pass page_content in as positional or named arg.

param metadata: dict [Optional]

Arbitrary metadata about the page content (e.g., source, relationships to other documents, etc.).

param page_content: str [Required]

String text.

param type: Literal['Document'] = 'Document'

Examples using Document