Skip to content

The agent engineering platform.

add metadata to documents (#153)

Harrison Chased2f9288be6c6
diff --git a/langchain/docstore/document.py b/langchain/docstore/document.py
index 2c6e04bb0b..cd6349d531 100644
--- a/langchain/docstore/document.py
+++ b/langchain/docstore/document.py
@@ -1,7 +1,7 @@
"""Interface for interacting with a document."""
from typing import List
-from pydantic import BaseModel
+from pydantic import BaseModel, Field
class Document(BaseModel):
@@ -10,6 +10,7 @@ class Document(BaseModel):
page_content: str
lookup_str: str = ""
lookup_index = 0
+ metadata: dict = Field(default_factory=dict)
@property
def paragraphs(self) -> List[str]: