A lazy loader for Document.
| Name | Type | Description |
|---|---|---|
dataset_id | uuid.UUID | str | None | Default: NoneThe ID of the dataset to filter by. |
dataset_name | str | None | Default: NoneThe name of the dataset to filter by. |
content_key | str | Default: '' |
format_content | Callable[..., str] | None | Default: None |
example_ids | Sequence[uuid.UUID | str] | None | Default: None |
as_of | datetime.datetime | str | None | Default: None |
splits | Sequence[str] | None | Default: None |
inline_s3_urls | bool | Default: True |
offset | int | Default: 0 |
limit | int | None | Default: None |
metadata | dict | None | Default: None |
filter | str | None | Default: None |
client | LangSmithClient | None | Default: None |
client_kwargs | Any | Default: {} |
| Name | Type |
|---|---|
| dataset_id | uuid.UUID | str | None |
| dataset_name | str | None |
| example_ids | Sequence[uuid.UUID | str] | None |
| as_of | datetime.datetime | str | None |
| splits | Sequence[str] | None |
| inline_s3_urls | bool |
| offset | int |
| limit | int | None |
| metadata | dict | None |
| filter | str | None |
| content_key | str |
| format_content | Callable[..., str] | None |
| client | LangSmithClient | None |
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.
from langchain_core.document_loaders import LangSmithLoader
loader = LangSmithLoader(dataset_id="...", limit=100)
docs = []
for doc in loader.lazy_load():
docs.append(doc)
# -> [Document("...", metadata={"inputs": {...}, "outputs": {...}, ...}), ...]The inputs key to set as Document page content.
'.' characters are interpreted as nested keys, e.g.
content_key="first.second" will result in
Document(page_content=format_content(example.inputs["first"]["second"]))
Function for converting the content extracted from the example inputs into a string.
Defaults to JSON-encoding the contents.
The IDs of the examples to filter by.
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.
A list of dataset splits, which are divisions of your dataset such
as train, test, or validation.
Returns examples only from the specified splits.
Whether to inline S3 URLs.
The offset to start from.
The maximum number of examples to return.
Metadata to filter by.
A structured filter string to apply to the examples.
LangSmith Client.
If not provided will be initialized from below args.
Keyword args to pass to LangSmith client init.
Should only be specified if client isn't.