langchain.chat_loaders.langsmith.LangSmithRunChatLoader

class langchain.chat_loaders.langsmith.LangSmithRunChatLoader(runs: Iterable[Union[str, Run]], client: Optional['Client'] = None)[source]

Load chat sessions from a list of LangSmith “llm” runs.

runs

The list of LLM run IDs or run objects.

Type

Iterable[Union[str, Run]]

client

Instance of LangSmith client for fetching data.

Type

Client

Initialize a new LangSmithRunChatLoader instance.

Parameters
  • runs – List of LLM run IDs or run objects.

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

Methods

__init__(runs[, client])

Initialize a new LangSmithRunChatLoader instance.

lazy_load()

Lazy load the chat sessions from the iterable of run IDs.

load()

Eagerly load the chat sessions into memory.

__init__(runs: Iterable[Union[str, Run]], client: Optional['Client'] = None)[source]

Initialize a new LangSmithRunChatLoader instance.

Parameters
  • runs – List of LLM run IDs or run objects.

  • 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 iterable of run IDs.

This method fetches the runs and converts them 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.