mirror of
https://github.com/hwchase17/langchain
synced 2024-10-31 15:20:26 +00:00
d32e511826
Changes: - remove langchain_core/schema since no clear distinction b/n schema and non-schema modules - make every module that doesn't end in -y plural - where easy have 1-2 classes per file - no more than one level of nesting in directories - only import from top level core modules in langchain
24 lines
663 B
Python
24 lines
663 B
Python
from __future__ import annotations
|
|
|
|
from typing import Literal
|
|
|
|
from langchain_core.load.serializable import Serializable
|
|
from langchain_core.pydantic_v1 import Field
|
|
|
|
|
|
class Document(Serializable):
|
|
"""Class for storing a piece of text and associated metadata."""
|
|
|
|
page_content: str
|
|
"""String text."""
|
|
metadata: dict = Field(default_factory=dict)
|
|
"""Arbitrary metadata about the page content (e.g., source, relationships to other
|
|
documents, etc.).
|
|
"""
|
|
type: Literal["Document"] = "Document"
|
|
|
|
@classmethod
|
|
def is_lc_serializable(cls) -> bool:
|
|
"""Return whether this class is serializable."""
|
|
return True
|