core[patch]: Add an example to the Document schema doc-string (#23131)

Add an example to the document schema
This commit is contained in:
Eugene Yurtsev
2024-06-19 11:35:30 -04:00
committed by GitHub
parent 2b08e9e265
commit 883e90d06e
4 changed files with 26 additions and 12 deletions

View File

@@ -7,7 +7,19 @@ from langchain_core.pydantic_v1 import Field
class Document(Serializable):
"""Class for storing a piece of text and associated metadata."""
"""Class for storing a piece of text and associated metadata.
Example:
.. code-block:: python
from langchain_core.documents import Document
document = Document(
page_content="Hello, world!",
metadata={"source": "https://example.com"}
)
"""
page_content: str
"""String text."""