document.py 371 B

12345678910111213141516
  1. from typing import Optional
  2. from pydantic import BaseModel, Field
  3. class Document(BaseModel):
  4. """Class for storing a piece of text and associated metadata."""
  5. page_content: str
  6. """Arbitrary metadata about the page content (e.g., source, relationships to other
  7. documents, etc.).
  8. """
  9. metadata: Optional[dict] = Field(default_factory=dict)