Toggle Menu
Prev Up Next

# `langchain_community.chat_loaders.langsmith`.LangSmithRunChatLoader

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

  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 (Iterable[Union[str, Run]]) – List of LLM run IDs or run objects.

    - client (Optional['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)

    Initialize a new LangSmithRunChatLoader instance.

    Parameters

      - runs (Iterable[Union[str, Run]]) – List of LLM run IDs or run objects.

      - client (Optional['Client']) – An instance of LangSmith client, if not provided, a new client instance will be created.

  lazy_load() → Iterator[ChatSession]

    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.

    Return type

      Iterator[ChatSession]

  load() → List[ChatSession]

    Eagerly load the chat sessions into memory.

    Return type

      List[ChatSession]

# Examples using LangSmithRunChatLoader

- Wait for the fine-tuning to complete (this may take some time)