LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-coredocumentsbaseDocument
    Class●Since v0.1

    Document

    Copy
    Document(
        self,
        page_content: str,
        **kwargs: Any = {},
    )

    Bases

    BaseMedia

    Used in Docs

    • Build a RAG agent with LangChain
    • Build a semantic search engine with LangChain
    • (MODULE_NAME) integration
    • AI21SemanticTextSplitter integration
    • Alibaba cloud mysql integration
    (61 more not shown)

    Constructors

    Attributes

    Methods

    Inherited fromBaseMedia

    Attributes

    Aid: str | None
    —

    An optional identifier for the document.

    Ametadata: dict
    —

    Arbitrary metadata associated with the content.

    Inherited fromSerializable

    Attributes

    A
    View source on GitHub
    lc_secrets
    : dict[str, str]
    —

    A map of constructor argument names to secret ids.

    Alc_attributes: dict
    —

    List of attribute names that should be included in the serialized kwargs.

    Amodel_config

    Methods

    Mlc_id
    —

    Return a unique identifier for this class for serialization purposes.

    Mto_json
    —

    Serialize the object to JSON.

    Mto_json_not_implemented
    —

    Serialize a "not implemented" object.

    constructor
    __init__
    NameType
    page_contentstr
    attribute
    page_content: str
    attribute
    type: Literal['Document']
    method
    is_lc_serializable
    method
    get_lc_namespace

    Class for storing a piece of text and associated metadata.

    Note

    Document is for retrieval workflows, not chat I/O. For sending text to an LLM in a conversation, use message types from langchain.messages.

    Example:

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

    String text.

    Return True as this class is serializable.

    Get the namespace of the LangChain object.