langchain_community.chat_loaders.langsmith.LangSmithDatasetChatLoader¶

class langchain_community.chat_loaders.langsmith.LangSmithDatasetChatLoader(*, dataset_name: str, client: Optional['Client'] = None)[source]¶

Load chat sessions from a LangSmith dataset with the “chat” data type.

dataset_name¶

The name of the LangSmith dataset.

Type

str

client¶

Instance of LangSmith client for fetching data.

Type

Client

Initialize a new LangSmithChatDatasetLoader instance.

Parameters
  • dataset_name – The name of the LangSmith dataset.

  • client – An instance of LangSmith client; if not provided, a new client instance will be created.

Methods

__init__(*, dataset_name[, client])

Initialize a new LangSmithChatDatasetLoader instance.

lazy_load()

Lazy load the chat sessions from the specified LangSmith dataset.

load()

Eagerly load the chat sessions into memory.

__init__(*, dataset_name: str, client: Optional['Client'] = None)[source]¶

Initialize a new LangSmithChatDatasetLoader instance.

Parameters
  • dataset_name – The name of the LangSmith dataset.

  • client – An instance of LangSmith client; if not provided, a new client instance will be created.

lazy_load() Iterator[ChatSession][source]¶

Lazy load the chat sessions from the specified LangSmith dataset.

This method fetches the chat data from the dataset and converts each data point to chat sessions on-the-fly, yielding one session at a time.

Returns

Iterator of chat sessions containing messages.

load() List[ChatSession]¶

Eagerly load the chat sessions into memory.