The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
style(core): more refs work (#33664)
Mason Daughertyf3d7152074f3
diff --git a/libs/core/langchain_core/document_loaders/base.py b/libs/core/langchain_core/document_loaders/base.pyindex 6da1e4336f..e74bc5976c 100644--- a/libs/core/langchain_core/document_loaders/base.py+++ b/libs/core/langchain_core/document_loaders/base.py@@ -27,7 +27,7 @@ class BaseLoader(ABC): # noqa: B024"""Interface for Document Loader.Implementations should implement the lazy-loading method using generators- to avoid loading all Documents into memory at once.+ to avoid loading all documents into memory at once.`load` is provided just for user convenience and should not be overridden."""@@ -53,9 +53,11 @@ class BaseLoader(ABC): # noqa: B024def load_and_split(self, text_splitter: TextSplitter | None = None) -> list[Document]:- """Load Documents and split into chunks. Chunks are returned as `Document`.+ """Load `Document` and split into chunks. Chunks are returned as `Document`.- Do not override this method. It should be considered to be deprecated!+ !!! danger++ Do not override this method. It should be considered to be deprecated!Args:text_splitter: `TextSplitter` instance to use for splitting documents.@@ -135,7 +137,7 @@ class BaseBlobParser(ABC):"""def parse(self, blob: Blob) -> list[Document]:- """Eagerly parse the blob into a `Document` or `Document` objects.+ """Eagerly parse the blob into a `Document` or list of `Document` objects.This is a convenience method for interactive development environment.diff --git a/libs/core/langchain_core/document_loaders/blob_loaders.py b/libs/core/langchain_core/document_loaders/blob_loaders.pyindex 6f26106ee3..8c6832177f 100644--- a/libs/core/langchain_core/document_loaders/blob_loaders.py+++ b/libs/core/langchain_core/document_loaders/blob_loaders.py@@ -28,7 +28,7 @@ class BlobLoader(ABC):def yield_blobs(self,) -> Iterable[Blob]:- """A lazy loader for raw data represented by LangChain's Blob object.+ """A lazy loader for raw data represented by LangChain's `Blob` object.Returns:A generator over blobsdiff --git a/libs/core/langchain_core/document_loaders/langsmith.py b/libs/core/langchain_core/document_loaders/langsmith.pyindex a826281a92..0ac054dc3b 100644--- a/libs/core/langchain_core/document_loaders/langsmith.py+++ b/libs/core/langchain_core/document_loaders/langsmith.py@@ -14,13 +14,13 @@ from langchain_core.documents import Documentclass LangSmithLoader(BaseLoader):- """Load LangSmith Dataset examples as Documents.+ """Load LangSmith Dataset examples as `Document` objects.- Loads the example inputs as the Document page content and places the entire example- into the Document metadata. This allows you to easily create few-shot example- retrievers from the loaded documents.+ Loads the example inputs as the `Document` page content and places the entire+ example into the `Document` metadata. This allows you to easily create few-shot+ example retrievers from the loaded documents.- ??? note "Lazy load"+ ??? note "Lazy loading example"```pythonfrom langchain_core.document_loaders import LangSmithLoader@@ -66,12 +66,11 @@ class LangSmithLoader(BaseLoader):format_content: Function for converting the content extracted from the exampleinputs into a string. Defaults to JSON-encoding the contents.example_ids: The IDs of the examples to filter by.- as_of: The dataset version tag OR- timestamp to retrieve the examples as of.- Response examples will only be those that were present at the time- of the tagged (or timestamped) version.+ as_of: The dataset version tag or timestamp to retrieve the examples as of.+ Response examples will only be those that were present at the time of+ the tagged (or timestamped) version.splits: A list of dataset splits, which are- divisions of your dataset such as 'train', 'test', or 'validation'.+ divisions of your dataset such as `train`, `test`, or `validation`.Returns examples only from the specified splits.inline_s3_urls: Whether to inline S3 URLs.offset: The offset to start from.diff --git a/libs/core/langchain_core/documents/base.py b/libs/core/langchain_core/documents/base.pyindex 56870f2447..9967c8a70d 100644--- a/libs/core/langchain_core/documents/base.py+++ b/libs/core/langchain_core/documents/base.py@@ -51,7 +51,7 @@ class Blob(BaseMedia):help to decouple the development of data loaders from the downstream parsing ofthe raw data.- Inspired by: https://developer.mozilla.org/en-US/docs/Web/API/Blob+ Inspired by [Mozilla's `Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)Example: Initialize a blob from in-memory data@@ -103,7 +103,7 @@ class Blob(BaseMedia):"""data: bytes | str | None = None- """Raw data associated with the blob."""+ """Raw data associated with the `Blob`."""mimetype: str | None = None"""MimeType not to be confused with a file extension."""encoding: str = "utf-8"@@ -123,7 +123,7 @@ class Blob(BaseMedia):def source(self) -> str | None:"""The source location of the blob as string if known otherwise none.- If a path is associated with the blob, it will default to the path location.+ If a path is associated with the `Blob`, it will default to the path location.Unless explicitly set via a metadata field called `"source"`, in whichcase that value will be used instead.@@ -211,13 +211,13 @@ class Blob(BaseMedia):Args:path: Path-like object to file to be readencoding: Encoding to use if decoding the bytes into a string- mime_type: If provided, will be set as the mime-type of the data- guess_type: If `True`, the mimetype will be guessed from the file extension,- if a mime-type was not provided- metadata: Metadata to associate with the blob+ mime_type: If provided, will be set as the MIME type of the data+ guess_type: If `True`, the MIME type will be guessed from the file+ extension, if a mime-type was not provided+ metadata: Metadata to associate with the `Blob`Returns:- Blob instance+ `Blob` instance"""if mime_type is None and guess_type:mimetype = mimetypes.guess_type(path)[0] if guess_type else None@@ -243,17 +243,17 @@ class Blob(BaseMedia):path: str | None = None,metadata: dict | None = None,) -> Blob:- """Initialize the blob from in-memory data.+ """Initialize the `Blob` from in-memory data.Args:- data: The in-memory data associated with the blob+ data: The in-memory data associated with the `Blob`encoding: Encoding to use if decoding the bytes into a string- mime_type: If provided, will be set as the mime-type of the data+ mime_type: If provided, will be set as the MIME type of the datapath: If provided, will be set as the source from which the data came- metadata: Metadata to associate with the blob+ metadata: Metadata to associate with the `Blob`Returns:- Blob instance+ `Blob` instance"""return cls(data=data,diff --git a/libs/core/langchain_core/load/dump.py b/libs/core/langchain_core/load/dump.pyindex 07bfa3844d..4cb9ca5989 100644--- a/libs/core/langchain_core/load/dump.py+++ b/libs/core/langchain_core/load/dump.py@@ -17,7 +17,7 @@ def default(obj: Any) -> Any:obj: The object to serialize to json if it is a Serializable object.Returns:- A json serializable object or a SerializedNotImplemented object.+ A JSON serializable object or a SerializedNotImplemented object."""if isinstance(obj, Serializable):return obj.to_json()diff --git a/libs/core/langchain_core/load/serializable.py b/libs/core/langchain_core/load/serializable.pyindex 8234c3141f..13898d292d 100644--- a/libs/core/langchain_core/load/serializable.py+++ b/libs/core/langchain_core/load/serializable.py@@ -194,7 +194,7 @@ class Serializable(BaseModel, ABC):ValueError: If the class has deprecated attributes.Returns:- A json serializable object or a `SerializedNotImplemented` object.+ A JSON serializable object or a `SerializedNotImplemented` object."""if not self.is_lc_serializable():return self.to_json_not_implemented()