langchain_core.documents.base.Document

class langchain_core.documents.base.Document[source]

Bases: Serializable

Class for storing a piece of text and associated metadata.

Example

from langchain_core.documents import Document

document = Document(
    page_content="Hello, world!",
    metadata={"source": "https://example.com"}
)

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