LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-coredocument_loaderslangsmithLangSmithLoader
    Class●Since v0.2

    LangSmithLoader

    Copy
    LangSmithLoader(
      self,
      *,
      dataset_id: uuid.UUID | str |

    Bases

    BaseLoader

    Used in Docs

    • LangSmithLoader integration

    Constructors

    Attributes

    Methods

    Inherited fromBaseLoader

    Methods

    Mload
    —

    Load data into Document objects.

    Maload
    —

    Load data into Document objects.

    Mload_and_split
    —

    Load Document and split into chunks. Chunks are returned as Document.

    M
    View source on GitHub
    None
    =
    None
    ,
    dataset_name
    :
    str
    |
    None
    =
    None
    ,
    example_ids
    :
    Sequence
    [
    uuid
    .
    UUID
    |
    str
    ]
    |
    None
    =
    None
    ,
    as_of
    :
    datetime
    .
    datetime
    |
    str
    |
    None
    =
    None
    ,
    splits
    :
    Sequence
    [
    str
    ]
    |
    None
    =
    None
    ,
    inline_s3_urls
    :
    bool
    =
    True
    ,
    offset
    :
    int
    =
    0
    ,
    limit
    :
    int
    |
    None
    =
    None
    ,
    metadata
    :
    dict
    |
    None
    =
    None
    ,
    filter
    :
    str
    |
    None
    =
    None
    ,
    content_key
    :
    str
    =
    ''
    ,
    format_content
    :
    Callable
    [
    .
    .
    .
    ,
    str
    ]
    |
    None
    =
    None
    ,
    client
    :
    LangSmithClient
    |
    None
    =
    None
    ,
    **
    client_kwargs
    :
    Any
    =
    {
    }
    )
    alazy_load
    —

    A lazy loader for Document.

    Parameters

    NameTypeDescription
    dataset_iduuid.UUID | str | None
    Default:None

    The ID of the dataset to filter by.

    dataset_namestr | None
    Default:None

    The name of the dataset to filter by.

    content_keystr
    Default:''
    format_contentCallable[..., str] | None
    Default:None
    example_idsSequence[uuid.UUID | str] | None
    Default:None
    as_ofdatetime.datetime | str | None
    Default:None
    splitsSequence[str] | None
    Default:None
    inline_s3_urlsbool
    Default:True
    offsetint
    Default:0
    limitint | None
    Default:None
    metadatadict | None
    Default:None
    filterstr | None
    Default:None
    clientLangSmithClient | None
    Default:None
    client_kwargsAny
    Default:{}
    constructor
    __init__
    NameType
    dataset_iduuid.UUID | str | None
    dataset_namestr | None
    example_idsSequence[uuid.UUID | str] | None
    as_ofdatetime.datetime | str | None
    splitsSequence[str] | None
    inline_s3_urlsbool
    offsetint
    limitint | None
    metadatadict | None
    filterstr | None
    content_keystr
    format_contentCallable[..., str] | None
    clientLangSmithClient | None
    attribute
    content_key
    attribute
    format_content
    attribute
    dataset_id: dataset_id
    attribute
    dataset_name: dataset_name
    attribute
    example_ids: example_ids
    attribute
    as_of: as_of
    attribute
    splits: splits
    attribute
    inline_s3_urls: inline_s3_urls
    attribute
    offset: offset
    attribute
    limit: limit
    attribute
    metadata: metadata
    attribute
    filter: filter
    method
    lazy_load

    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.

    Lazy loading
    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.